Skip to content

Commit

Permalink
Fix scanning of "use aliased;" with no import arguments
Browse files Browse the repository at this point in the history
Without this fix, scanning that code would result in:
Can't call method "isa" on an undefined value at .../Perl/PrereqScanner/Scanner.pm line 32.
  • Loading branch information
karenetheridge authored and rjbs committed Dec 24, 2014
1 parent a92cb87 commit ab0ec2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Perl/PrereqScanner/Scanner/Aliased.pm
Expand Up @@ -32,6 +32,7 @@ sub scan_for_prereqs {
|| $_->isa('PPI::Token::Quote')
} $node->arguments;

next unless @args;
my ($module) = $self->_q_contents($args[0]);
$req->add_minimum($module => 0);
}
Expand Down
7 changes: 7 additions & 0 deletions t/autoprereq.t
Expand Up @@ -659,6 +659,13 @@ prereq_is(
},
);

prereq_is(
q{use aliased;},
{
'aliased' => 0,
},
);

# rolsky says this is a problem case
prereq_is(
q{use Test::Requires 'Foo'},
Expand Down

0 comments on commit ab0ec2c

Please sign in to comment.