File Coverage

blib/lib/lexical/underscore.pm
Criterion Covered Total %
statement 17 18 94.4
branch 5 6 83.3
condition 1 3 33.3
subroutine 7 7 100.0
pod n/a
total 30 34 88.2


line stmt bran cond sub pod time code
1             package lexical::underscore;
2              
3 3     3   47963 use 5.008;
  3         9  
4 3     3   13 use strict;
  3         12  
  3         61  
5 3     3   9 use warnings;
  3         8  
  3         119  
6              
7             BEGIN {
8 3     3   5 $lexical::underscore::AUTHORITY = 'cpan:TOBYINK';
9 3         84 $lexical::underscore::VERSION = '0.004';
10             }
11              
12 3   33 3   565 use if ($] >= 5.009 && $] < 5.023), PadWalker => qw( peek_my );
  3         9  
  3         32  
13             BEGIN {
14 3 50   3   3240 *peek_my = sub { +{} } unless __PACKAGE__->can('peek_my');
  0         0  
15             }
16              
17             sub lexical::underscore
18             {
19 13 100   13   72 my $level = @_ ? shift : 0;
20 13         54 my $lexicals = peek_my($level + 2);
21 13 100       62 exists $lexicals->{'$_'} ? $lexicals->{'$_'} : \$_;
22             }
23              
24             1;
25              
26             __END__