line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Declare::Syntax::Keyword::Clean; |
2
|
|
|
|
|
|
|
# ABSTRACT: Explicit namespace cleanups |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.43'; |
5
|
|
|
|
|
|
|
|
6
|
24
|
|
|
24
|
|
12114
|
use Moose; |
|
24
|
|
|
|
|
32
|
|
|
24
|
|
|
|
|
131
|
|
7
|
24
|
|
|
24
|
|
101571
|
use constant NAMESPACING_ROLE => 'MooseX::Declare::Syntax::NamespaceHandling'; |
|
24
|
|
|
|
|
35
|
|
|
24
|
|
|
|
|
1691
|
|
8
|
24
|
|
|
24
|
|
103
|
use Carp qw( cluck ); |
|
24
|
|
|
|
|
27
|
|
|
24
|
|
|
|
|
1258
|
|
9
|
24
|
|
|
24
|
|
99
|
use namespace::autoclean; |
|
24
|
|
|
|
|
32
|
|
|
24
|
|
|
|
|
181
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod This keyword will inject a call to L<namespace::clean> into its current |
14
|
|
|
|
|
|
|
#pod position. |
15
|
|
|
|
|
|
|
#pod |
16
|
|
|
|
|
|
|
#pod =head1 CONSUMES |
17
|
|
|
|
|
|
|
#pod |
18
|
|
|
|
|
|
|
#pod =for :list |
19
|
|
|
|
|
|
|
#pod * L<MooseX::Declare::Syntax::KeywordHandling> |
20
|
|
|
|
|
|
|
#pod |
21
|
|
|
|
|
|
|
#pod =cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
with qw( |
24
|
|
|
|
|
|
|
MooseX::Declare::Syntax::KeywordHandling |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub find_namespace_handler { |
28
|
3
|
|
|
3
|
0
|
6
|
my ($self, $ctx) = @_; |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
|
|
7
|
for my $item (reverse @{ $ctx->stack }) { |
|
3
|
|
|
|
|
74
|
|
31
|
3
|
50
|
|
|
|
76
|
return $item |
32
|
|
|
|
|
|
|
if $item->handler->does(NAMESPACING_ROLE); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
return undef; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#pod =method parse |
39
|
|
|
|
|
|
|
#pod |
40
|
|
|
|
|
|
|
#pod Object->parse(Object $context) |
41
|
|
|
|
|
|
|
#pod |
42
|
|
|
|
|
|
|
#pod This will inject a call to L<namespace::clean> C<< -except => 'meta' >> into |
43
|
|
|
|
|
|
|
#pod the code at the position of the keyword. |
44
|
|
|
|
|
|
|
#pod |
45
|
|
|
|
|
|
|
#pod =cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub parse { |
48
|
3
|
|
|
3
|
1
|
7
|
my ($self, $ctx) = @_; |
49
|
|
|
|
|
|
|
|
50
|
3
|
50
|
|
|
|
11
|
if (my $stack_item = $self->find_namespace_handler($ctx)) { |
51
|
3
|
|
|
|
|
71
|
my $namespace = $stack_item->namespace; |
52
|
|
|
|
|
|
|
|
53
|
3
|
100
|
|
|
|
72
|
cluck "Attempted to clean an already cleaned namespace ($namespace). Did you mean to use 'is dirty'?" |
54
|
|
|
|
|
|
|
unless $stack_item->is_dirty; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
3
|
|
|
|
|
193
|
$ctx->skip_declarator; |
58
|
3
|
|
|
|
|
111
|
$ctx->inject_code_parts_here( |
59
|
|
|
|
|
|
|
';use namespace::clean -except => [qw( meta )]', |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
64
|
|
|
|
|
|
|
#pod |
65
|
|
|
|
|
|
|
#pod =for :list |
66
|
|
|
|
|
|
|
#pod * L<MooseX::Declare> |
67
|
|
|
|
|
|
|
#pod * L<MooseX::Declare::Syntax::KeywordHandling> |
68
|
|
|
|
|
|
|
#pod |
69
|
|
|
|
|
|
|
#pod =cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=pod |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=encoding UTF-8 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 NAME |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
MooseX::Declare::Syntax::Keyword::Clean - Explicit namespace cleanups |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 VERSION |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
version 0.43 |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 DESCRIPTION |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This keyword will inject a call to L<namespace::clean> into its current |
90
|
|
|
|
|
|
|
position. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 METHODS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 parse |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Object->parse(Object $context) |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This will inject a call to L<namespace::clean> C<< -except => 'meta' >> into |
99
|
|
|
|
|
|
|
the code at the position of the keyword. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 CONSUMES |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=over 4 |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item * |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
L<MooseX::Declare::Syntax::KeywordHandling> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=back |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SEE ALSO |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=over 4 |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L<MooseX::Declare> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L<MooseX::Declare::Syntax::KeywordHandling> |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=back |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 AUTHOR |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This software is copyright (c) 2008 by Florian Ragwitz. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
134
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |