line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Babble::Plugin::PackageBlock; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
68344
|
use Moo; |
|
1
|
|
|
|
|
7427
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub transform_to_plain { |
6
|
2
|
|
|
2
|
0
|
2960
|
my ($self, $top) = @_; |
7
|
|
|
|
|
|
|
$top->each_match_within(PackageDeclaration => [ |
8
|
|
|
|
|
|
|
[ kw => 'package' ], |
9
|
|
|
|
|
|
|
[ meta => q{ |
10
|
|
|
|
|
|
|
(?>(?&PerlNWS)) (?>(?&PerlQualifiedIdentifier)) |
11
|
|
|
|
|
|
|
(?: (?>(?&PerlNWS)) (?&PerlVersionNumber) )?+ |
12
|
|
|
|
|
|
|
}], |
13
|
|
|
|
|
|
|
[ ws => q{ |
14
|
|
|
|
|
|
|
(?>(?&PerlOWSOrEND)) |
15
|
|
|
|
|
|
|
}], |
16
|
|
|
|
|
|
|
[ block => q{ |
17
|
|
|
|
|
|
|
(?> (?&PerlBlock) ) |
18
|
|
|
|
|
|
|
}], |
19
|
|
|
|
|
|
|
] => sub { |
20
|
2
|
|
|
2
|
|
6
|
my ($m) = @_; |
21
|
2
|
|
|
|
|
5
|
my ($kw, $meta, $ws, $block) = @{$m->submatches}{ qw(kw meta ws block) }; |
|
2
|
|
|
|
|
42
|
|
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
22
|
$kw->replace_text('{ ' . $kw->text); |
24
|
2
|
|
|
|
|
14
|
$meta->replace_text($meta->text . ';'); |
25
|
2
|
|
|
|
|
10
|
$ws->replace_text(''); |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
10
|
my $block_text = $block->text; |
28
|
2
|
|
|
|
|
11
|
$block_text =~ s/\A\{//; |
29
|
2
|
|
|
|
|
10
|
$block->replace_text($block_text); |
30
|
2
|
|
|
|
|
28
|
}); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Babble::Plugin::PackageBlock - Plugin for package block syntax |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Converts usage of the package block syntax from |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
package NAMESPACE BLOCK |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
to |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
{ package NAMESPACE; } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SEE ALSO |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
L<package-block syntax|Syntax::Construct/package-block> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |