line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package twigils; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
6
|
|
|
6
|
|
296675
|
$twigils::AUTHORITY = 'cpan:FLORA'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$twigils::VERSION = '0.04'; # TRIAL |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
# ABSTRACT: Perl 6 style twigils for Perl 5 |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require 5.014; |
11
|
6
|
|
|
6
|
|
54
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
199
|
|
12
|
6
|
|
|
6
|
|
32
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
319
|
|
13
|
6
|
|
|
6
|
|
38
|
use XSLoader; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
156
|
|
14
|
6
|
|
|
6
|
|
39
|
use Carp 'croak'; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
345
|
|
15
|
6
|
|
|
6
|
|
8217
|
use Devel::CallChecker; |
|
6
|
|
|
|
|
56493
|
|
|
6
|
|
|
|
|
500
|
|
16
|
6
|
|
|
6
|
|
17662
|
use Devel::CallParser; |
|
6
|
|
|
|
|
10464
|
|
|
6
|
|
|
|
|
413
|
|
17
|
6
|
|
|
6
|
|
48
|
use Exporter (); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
16074
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our @EXPORT = map { "intro_twigil_${_}_var" } qw(my state our); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub intro_twigil_my_var { |
23
|
0
|
|
|
0
|
1
|
0
|
croak "intro_twigil_my_var called as a function"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub intro_twigil_state_var { |
28
|
0
|
|
|
0
|
1
|
0
|
croak "intro_twigil_state_var called as a function"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub intro_twigil_our_var { |
33
|
0
|
|
|
0
|
1
|
0
|
croak "intro_twigil_our_var called as a function"; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub import { |
37
|
7
|
|
|
7
|
|
58
|
my ($class, @opts) = @_; |
38
|
|
|
|
|
|
|
|
39
|
7
|
|
|
|
|
18
|
@_ = ($class); |
40
|
7
|
|
|
|
|
726
|
while (my $opt = shift @opts) { |
41
|
3
|
100
|
|
|
|
12
|
if ($opt eq 'fatal_lookup_errors') { |
|
|
50
|
|
|
|
|
|
42
|
2
|
|
|
|
|
13
|
$^H{__PACKAGE__ . '/not_in_pad_fatal'} = 1; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
elsif ($opt eq 'allowed_twigils') { |
45
|
1
|
|
|
|
|
6
|
$^H{__PACKAGE__ . '/no_autovivification'} = 1; |
46
|
1
|
|
|
|
|
10
|
$^H{__PACKAGE__ . '/twigils'} = shift @opts; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else { |
49
|
0
|
|
|
|
|
0
|
push @_, $opt; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
7
|
|
|
|
|
2595
|
goto &Exporter::import; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
XSLoader::load( |
57
|
|
|
|
|
|
|
__PACKAGE__, |
58
|
|
|
|
|
|
|
exists $twigil::{VERSION} ? ${ $twigil::{VERSION} } : (), |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _add_allowed_twigil { |
62
|
172
|
|
|
172
|
|
193396
|
my ($twigil) = @_; |
63
|
|
|
|
|
|
|
|
64
|
4
|
|
|
|
|
18
|
my %h = map { |
65
|
172
|
|
100
|
|
|
2516
|
($_ => 1) |
66
|
|
|
|
|
|
|
} (split '', $^H{ __PACKAGE__ . '/twigils' } || ''); |
67
|
|
|
|
|
|
|
|
68
|
172
|
|
|
|
|
38719
|
$^H{__PACKAGE__ . '/twigils'} = join '' => $twigil, keys %h; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |