package B::Lint;
-our $VERSION = '1.04';
+our $VERSION = '1.05';
=head1 NAME
sub B::PMOP::lint {
my $op = shift;
if ($check{implicit_read}) {
- if ($op->name eq "match" && !($op->flags & OPf_STACKED)) {
+ if ($op->name eq "match"
+ and not ( $op->flags & OPf_STACKED
+ or join( " ",
+ map $_->name,
+ @{B::parents()} )
+ =~ /^(?:leave )?(?:null )*grep/ ) ) {
warning('Implicit match on $_');
}
}
require 'test.pl';
}
-plan tests => 16; # adjust also number of skipped tests !
+plan tests => 18; # adjust also number of skipped tests !
# Runs a separate perl interpreter with the appropriate lint options
# turned on
Implicit match on $_ at -e line 1
RESULT
+runlint 'implicit-read', 'grep /foo/, ()', '';
+
+runlint 'implicit-read', 'grep { /foo/ } ()', '';
+
runlint 'implicit-write', 's/foo/bar/', <<'RESULT';
Implicit substitution on $_ at -e line 1
RESULT