line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Lexical::Thief; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
69474
|
use 5.012; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
74
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
66
|
|
5
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
88
|
|
6
|
2
|
|
|
2
|
|
8
|
no warnings qw( once void uninitialized numeric ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
136
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
BEGIN { |
9
|
2
|
|
|
2
|
|
3
|
$Acme::Lexical::Thief::AUTHORITY = 'cpan:TOBYINK'; |
10
|
2
|
|
|
|
|
43
|
$Acme::Lexical::Thief::VERSION = '0.002'; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
10
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
151
|
|
14
|
2
|
|
|
2
|
|
1767
|
use Keyword::Simple (); |
|
2
|
|
|
|
|
102975
|
|
|
2
|
|
|
|
|
59
|
|
15
|
2
|
|
|
2
|
|
2536
|
use PadWalker (); |
|
2
|
|
|
|
|
3224
|
|
|
2
|
|
|
|
|
59
|
|
16
|
2
|
|
|
2
|
|
3029
|
use Text::Balanced (); |
|
2
|
|
|
|
|
46175
|
|
|
2
|
|
|
|
|
4172
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $KEYWORD = 'steal'; |
19
|
|
|
|
|
|
|
my $CLASS = __PACKAGE__; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub import |
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
Keyword::Simple::define $KEYWORD, sub |
24
|
|
|
|
|
|
|
{ |
25
|
6
|
|
|
6
|
|
130
|
my $ref = shift; |
26
|
6
|
|
|
|
|
29
|
$$ref =~ s/^\s+//; |
27
|
|
|
|
|
|
|
|
28
|
6
|
|
|
|
|
10
|
my $depth = 0; |
29
|
6
|
100
|
|
|
|
37
|
if ($$ref =~ /^((?: 0x[0-9A-F]+ | 0b[0-1]+ | 0[0-7]* | [1-9][0-9]* )\s*)/ixs) |
30
|
|
|
|
|
|
|
{ |
31
|
2
|
|
|
|
|
143
|
$depth = eval $1; |
32
|
2
|
|
|
|
|
18
|
substr($$ref, 0, length $1) = ''; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
6
|
|
|
|
|
9
|
my $extracted; |
36
|
6
|
100
|
|
|
|
16
|
if ($$ref =~ /^\(/) |
37
|
|
|
|
|
|
|
{ |
38
|
2
|
50
|
|
|
|
9
|
$extracted = Text::Balanced::extract_bracketed($$ref) |
39
|
|
|
|
|
|
|
or croak "usage: $KEYWORD (VARIABLES);"; |
40
|
2
|
|
|
|
|
359
|
$extracted =~ s/(^\(|\)$)//gs; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
else |
43
|
|
|
|
|
|
|
{ |
44
|
4
|
50
|
|
|
|
36
|
($extracted, $$ref) = ($$ref =~ /^([^;]+)(;.*)$/s) |
45
|
|
|
|
|
|
|
or croak "usage: $KEYWORD VARIABLES;"; |
46
|
|
|
|
|
|
|
} |
47
|
6
|
|
|
|
|
27
|
(my $globs = $extracted) =~ s/[\$\%\@]/*/gs; |
48
|
6
|
|
|
|
|
879
|
$$ref = "our($extracted); local($globs) = $CLASS\::_callback(q($extracted), $depth);$$ref"; |
49
|
|
|
|
|
|
|
} |
50
|
2
|
|
|
2
|
|
45
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub unimport |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
0
|
|
0
|
Keyword::Simple::undefine $KEYWORD; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _callback |
58
|
|
|
|
|
|
|
{ |
59
|
7
|
|
|
7
|
|
2193
|
my $vars = shift; |
60
|
7
|
|
50
|
|
|
18
|
my $depth = shift // 0; |
61
|
|
|
|
|
|
|
|
62
|
7
|
|
|
|
|
57
|
$vars =~ s/(^\s*|\s*$)//g; |
63
|
7
|
|
|
|
|
32
|
my @vars = split /\s*,\s*/, $vars; |
64
|
|
|
|
|
|
|
|
65
|
7
|
|
|
|
|
51
|
my $MY = PadWalker::peek_my($depth + 2); |
66
|
7
|
|
|
|
|
39
|
my $OUR = PadWalker::peek_our($depth + 2); |
67
|
8
|
50
|
|
|
|
261
|
return map { |
|
|
100
|
|
|
|
|
|
68
|
7
|
|
|
|
|
16
|
exists $MY->{$_} ? $MY->{$_} : |
69
|
|
|
|
|
|
|
exists $OUR->{$_} ? $OUR->{$_} : |
70
|
|
|
|
|
|
|
croak "$KEYWORD($_) failed; caller has no $_ defined"; |
71
|
|
|
|
|
|
|
} @vars; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |