line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Syntax::Feature::Qwa; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
125133
|
use 5.010; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
404
|
|
4
|
4
|
|
|
4
|
|
25
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
225
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
BEGIN { |
7
|
4
|
|
|
4
|
|
11
|
$Syntax::Feature::Qwa::AUTHORITY = 'cpan:TOBYINK'; |
8
|
4
|
|
|
|
|
97
|
$Syntax::Feature::Qwa::VERSION = '0.001'; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
4
|
|
5468
|
use Devel::Declare 0.006007 (); |
|
4
|
|
|
|
|
38358
|
|
|
4
|
|
|
|
|
390
|
|
12
|
4
|
|
|
4
|
|
5830
|
use Devel::Declare::Context::Simple 0 (); |
|
4
|
|
|
|
|
91532
|
|
|
4
|
|
|
|
|
127
|
|
13
|
4
|
|
|
4
|
|
39
|
use B::Hooks::EndOfScope 0.09; |
|
4
|
|
|
|
|
466
|
|
|
4
|
|
|
|
|
27
|
|
14
|
4
|
|
|
4
|
|
4659
|
use Sub::Install 0.925 qw( install_sub ); |
|
4
|
|
|
|
|
8507
|
|
|
4
|
|
|
|
|
29
|
|
15
|
4
|
|
|
4
|
|
4815
|
use namespace::clean 0; |
|
4
|
|
|
|
|
22641
|
|
|
4
|
|
|
|
|
28
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my @NewOps = qw(qwa qwh qwk); |
18
|
|
|
|
|
|
|
my %QuoteOp = ( |
19
|
|
|
|
|
|
|
qwa => q{ [%s] }, |
20
|
|
|
|
|
|
|
qwh => q{ +{%s} }, |
21
|
|
|
|
|
|
|
qwk => q{ do { my $i = 0; +{ map { $_=>++$i } %s } } }, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub import |
25
|
|
|
|
|
|
|
{ |
26
|
4
|
|
|
4
|
|
38
|
my ($class) = @_; |
27
|
4
|
|
|
|
|
47
|
my $caller = caller(0); |
28
|
4
|
|
|
|
|
12
|
@_ = ($class, 'into', $caller); |
29
|
4
|
|
|
|
|
16
|
goto \&install; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub install |
33
|
|
|
|
|
|
|
{ |
34
|
4
|
|
|
4
|
0
|
12
|
my ($class, %args) = @_; |
35
|
|
|
|
|
|
|
|
36
|
4
|
|
|
|
|
8
|
my $target = $args{into}; |
37
|
12
|
|
|
|
|
16
|
Devel::Declare->setup_for($target => { |
38
|
|
|
|
|
|
|
map { |
39
|
4
|
|
|
|
|
9
|
my $name = $_; |
40
|
|
|
|
|
|
|
($name => { |
41
|
|
|
|
|
|
|
const => sub { |
42
|
3
|
|
|
3
|
|
103
|
my $ctx = Devel::Declare::Context::Simple->new; |
43
|
3
|
|
|
|
|
28
|
$ctx->init(@_); |
44
|
3
|
|
|
|
|
41
|
return $class->_transform($name, $ctx); |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
}) |
47
|
12
|
|
|
|
|
126
|
} @NewOps |
48
|
|
|
|
|
|
|
}); |
49
|
4
|
|
|
|
|
188
|
for my $name (@NewOps) { |
50
|
12
|
|
|
|
|
595
|
install_sub { |
51
|
|
|
|
|
|
|
into => $target, |
52
|
|
|
|
|
|
|
as => $name, |
53
|
|
|
|
|
|
|
code => $class->_run_callback($name), |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
on_scope_end { |
57
|
4
|
|
|
4
|
|
278
|
namespace::clean->clean_subroutines($target, @NewOps); |
58
|
4
|
|
|
|
|
180
|
}; |
59
|
4
|
|
|
|
|
171
|
return 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
3
|
|
|
3
|
|
115
|
sub _run_callback { sub($){shift} } |
|
12
|
|
|
12
|
|
78
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _transform |
65
|
|
|
|
|
|
|
{ |
66
|
3
|
|
|
3
|
|
6
|
my ($class, $name, $ctx) = @_; |
67
|
|
|
|
|
|
|
|
68
|
3
|
|
|
|
|
93
|
$ctx->skip_declarator; |
69
|
3
|
|
|
|
|
133
|
my $length = Devel::Declare::toke_scan_str($ctx->offset); |
70
|
3
|
|
|
|
|
44
|
my $string = Devel::Declare::get_lex_stuff; |
71
|
3
|
|
|
|
|
9
|
Devel::Declare::clear_lex_stuff; |
72
|
3
|
|
|
|
|
10
|
my $linestr = $ctx->get_linestr; |
73
|
3
|
|
|
|
|
21
|
my $quoted = substr $linestr, $ctx->offset, $length; |
74
|
3
|
|
|
|
|
14
|
my $spaced = ''; |
75
|
3
|
|
|
|
|
14
|
$quoted =~ m{^(\s*)}sm; |
76
|
3
|
|
|
|
|
11
|
$spaced = $1; |
77
|
3
|
|
|
|
|
30
|
my $new = sprintf $QuoteOp{$name}, join q[], |
78
|
|
|
|
|
|
|
q[qw], |
79
|
|
|
|
|
|
|
$spaced, |
80
|
|
|
|
|
|
|
substr($quoted, length($spaced), 1), |
81
|
|
|
|
|
|
|
$string, |
82
|
|
|
|
|
|
|
substr($quoted, -1, 1); |
83
|
3
|
|
|
|
|
11
|
substr($linestr, $ctx->offset, $length) = $new; |
84
|
3
|
|
|
|
|
29
|
$ctx->set_linestr($linestr); |
85
|
|
|
|
|
|
|
# my $s = $ctx->get_linestr; |
86
|
|
|
|
|
|
|
# warn ">>> $s\n"; |
87
|
3
|
|
|
|
|
51
|
return 1; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__PACKAGE__ |
91
|
|
|
|
|
|
|
__END__ |