File Coverage

blib/lib/lexical/underscore.pm
Criterion Covered Total %
statement 18 19 94.7
branch 5 6 83.3
condition n/a
subroutine 7 7 100.0
pod n/a
total 30 32 93.7


line stmt bran cond sub pod time code
1             package lexical::underscore;
2              
3 3     3   84926 use 5.008;
  3         13  
  3         131  
4 3     3   20 use strict;
  3         6  
  3         124  
5 3     3   16 use warnings;
  3         10  
  3         161  
6              
7             BEGIN {
8 3     3   8 $lexical::underscore::AUTHORITY = 'cpan:TOBYINK';
9 3         122 $lexical::underscore::VERSION = '0.002';
10             }
11              
12 3     3   3466 use if $] >= 5.009, PadWalker => qw( peek_my );
  3         29  
  3         18  
13             BEGIN {
14 3 50   3   27655 *peek_my = sub { +{} } unless __PACKAGE__->can('peek_my');
  0         0  
15             }
16              
17             sub lexical::underscore
18             {
19 13 100   13   82 my $level = @_ ? shift : 0;
20 13         75 my $lexicals = peek_my($level + 2);
21 13 100       91 exists $lexicals->{'$_'} ? $lexicals->{'$_'} : \$_;
22             }
23              
24             1;
25              
26             __END__