Skip to content

Commit

Permalink
Version 1.06
Browse files Browse the repository at this point in the history
  • Loading branch information
jplesnik committed Jan 19, 2022
1 parent a909f49 commit a8e8f25
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 12 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Revision history for perl-generators.

1.06 Tue Oct 5 2015
- Do not process results that contain direct method calls

1.05 Fri Oct 2 2015
- Fixed parsing of "use base" to find out a bareword (BZ#1267267)
- Update parsing of provides version when 'use version' is called
Expand Down
4 changes: 2 additions & 2 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ExtUtils::MakeMaker;

WriteMakefile(
'NAME' => 'generators',
'VERSION' => '1.05',
'VERSION' => '1.06',
'AUTHOR' => 'Jitka Plesnikova <[email protected]>',
'LICENSE' => 'gpl',
'EXE_FILES' => [ ( glob 'bin/*' ) ],
Expand All @@ -16,7 +16,7 @@ WriteMakefile(
},
TEST_REQUIRES => {
'Test::More' => 0,
'strict' => 0,
'strict' => 0,
'warnings' => 0,
},
'CONFIGURE_REQUIRES' => {
Expand Down
27 changes: 17 additions & 10 deletions bin/perl.req
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ exit 0;
sub add_require {
my ($module, $newver) = @_;

# __EXAMPLE__ is not valid requirement
return if ($module =~ m/^__[A-Z]+__$/o);

# To prevent that module does not end with '::'
# Example: use base Object::Event::;
$module =~ s/::$//;
Expand Down Expand Up @@ -188,31 +191,35 @@ sub process_file {
(?:$begin_re\s*
([^)\/"'\$!|}]*?)
\s*$end_re|
(?:qw<|qq?<)([^>]*?)>|([\w\:]+)|)\s*(.*)
(?:qw<|qq?<)([^>]*?)>|([\w\:]+)|)\s*(.*)
/x)
) {
my ($whitespace, $statement, $module, $version, $params, $list, $rest) = ($1, $2, $3, $5, $6, $7 || $8 || $9, $10);
$version = undef if ($version eq '');
# Ignore line which contains direct method calls
# use base __PACKAGE__->subroutine(...);
$list = "" if ($list =~ /^[^;#]*?->/ || $rest =~ /^[^;#]*?->/);

#
# Executed in case that multiline q{} quoted sections is used for
# list of modules
if (defined($list) and $list =~ /^q[qxwr]?$/) {
$list = undef;
if ($rest =~ m/^\s*([{([#|!\/])\s*([^})\]#|!\/]*)$/) {
if (defined($list) && $list =~ /^q[qxwr]?$/) {
$list = "";
if ($rest =~ m/^\s*([{([#|!\/])\s*([^})\]#|!\/]*)$/) {
$tag = $1;
$list = $2;
$list = $2;
chomp($list);
$tag =~ tr/{\(\[\#|!\//})]#|!\//;
$tag = quotemeta($tag);
while (<FILE>) {
my $line = $_;
chomp($line);
if ($line =~ m/^\s*(.*?)$tag/) {
$list .= ' ' . $1 if ($1 ne '');
last;
} else { $list .= ' ' . $line; }
}
if ($line =~ m/^\s*(.*?)$tag/) {
$list .= ' ' . $1 if ($1 ne '');
last;
} else { $list .= ' ' . $line; }
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions t/02_list.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ my @expectedrequires = (
"perl(Try)\n",
"perl(This)\n",
"perl(One)\n",
"perl(constant)\n",
"perl(TARGET_CLASS)\n",
"perl(XML::XQL::Element)\n",
);

is_deeply([ sort @requires ], [ sort @expectedrequires ], "Only expected requires were found.");
11 changes: 11 additions & 0 deletions t/data/list
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@ use base qw/
use base qw (
This
One );

# Two examples from perl-Sys-Info-Base
# "__PACKAGE__" should not be found
use base __PACKAGE__->load_subclass('Sys::Info::Driver::%s::Device::CPU');

# It is not possible to filter constant which is used as a module
use constant TARGET_CLASS => __PACKAGE__->load_subclass('Sys::Info::Driver::%s::OS');
use base TARGET_CLASS;

# Do not ignore line which contains '->' in a coment
use base 'XML::XQL::Element'; # L -> L

0 comments on commit a8e8f25

Please sign in to comment.