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