line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Declare::Syntax::EmptyBlockIfMissing; |
2
|
|
|
|
|
|
|
# ABSTRACT: Handle missing blocks after keywords |
3
|
|
|
|
|
|
|
$MooseX::Declare::Syntax::EmptyBlockIfMissing::VERSION = '0.39'; |
4
|
24
|
|
|
24
|
|
21806
|
use Moose::Role; |
|
24
|
|
|
|
|
61
|
|
|
24
|
|
|
|
|
226
|
|
5
|
|
|
|
|
|
|
|
6
|
24
|
|
|
24
|
|
184397
|
use namespace::clean -except => 'meta'; |
|
24
|
|
|
|
|
67
|
|
|
24
|
|
|
|
|
319
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
9
|
|
|
|
|
|
|
#pod |
10
|
|
|
|
|
|
|
#pod The L<MooseX::Declare::Syntax::NamespaceHandling> role will require that the |
11
|
|
|
|
|
|
|
#pod consumer handles the case of non-existant blocks. This role will inject |
12
|
|
|
|
|
|
|
#pod an empty block with only the generated code parts in it. |
13
|
|
|
|
|
|
|
#pod |
14
|
|
|
|
|
|
|
#pod =method handle_missing_block |
15
|
|
|
|
|
|
|
#pod |
16
|
|
|
|
|
|
|
#pod Object->handle_missing_block (Object $context, Str $body, %args) |
17
|
|
|
|
|
|
|
#pod |
18
|
|
|
|
|
|
|
#pod This will inject the generated code surrounded by C<{ ... }> into the code |
19
|
|
|
|
|
|
|
#pod where the keyword was called. |
20
|
|
|
|
|
|
|
#pod |
21
|
|
|
|
|
|
|
#pod =cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub handle_missing_block { |
24
|
1
|
|
|
1
|
1
|
25
|
my ($self, $ctx, $inject, %args) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# default to block with nothing more than the default contents |
27
|
1
|
|
|
|
|
16
|
$ctx->inject_code_parts_here("{ $inject }"); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod =for :list |
33
|
|
|
|
|
|
|
#pod * L<MooseX::Declare> |
34
|
|
|
|
|
|
|
#pod * L<MooseX::Declare::Syntax::NamespaceHandling> |
35
|
|
|
|
|
|
|
#pod |
36
|
|
|
|
|
|
|
#pod =cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=encoding UTF-8 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
MooseX::Declare::Syntax::EmptyBlockIfMissing - Handle missing blocks after keywords |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 VERSION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
version 0.39 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
The L<MooseX::Declare::Syntax::NamespaceHandling> role will require that the |
57
|
|
|
|
|
|
|
consumer handles the case of non-existant blocks. This role will inject |
58
|
|
|
|
|
|
|
an empty block with only the generated code parts in it. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 METHODS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 handle_missing_block |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Object->handle_missing_block (Object $context, Str $body, %args) |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This will inject the generated code surrounded by C<{ ... }> into the code |
67
|
|
|
|
|
|
|
where the keyword was called. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SEE ALSO |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=over 4 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item * |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
L<MooseX::Declare> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L<MooseX::Declare::Syntax::NamespaceHandling> |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=back |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This software is copyright (c) 2008 by Florian Ragwitz. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
92
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |