line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mason::Component::Moose; ## no critic (Moose::RequireMakeImmutable) |
2
|
|
|
|
|
|
|
$Mason::Component::Moose::VERSION = '2.23'; |
3
|
19
|
|
|
19
|
|
9546
|
use Moose (); |
|
19
|
|
|
|
|
37
|
|
|
19
|
|
|
|
|
449
|
|
4
|
19
|
|
|
19
|
|
9045
|
use MooseX::HasDefaults::RW (); |
|
19
|
|
|
|
|
137750
|
|
|
19
|
|
|
|
|
590
|
|
5
|
19
|
|
|
19
|
|
163
|
use Method::Signatures::Simple (); |
|
19
|
|
|
|
|
33
|
|
|
19
|
|
|
|
|
301
|
|
6
|
19
|
|
|
19
|
|
74
|
use Moose::Exporter; |
|
19
|
|
|
|
|
29
|
|
|
19
|
|
|
|
|
92
|
|
7
|
19
|
|
|
19
|
|
950
|
use strict; |
|
19
|
|
|
|
|
45
|
|
|
19
|
|
|
|
|
487
|
|
8
|
19
|
|
|
19
|
|
103
|
use warnings; |
|
19
|
|
|
|
|
28
|
|
|
19
|
|
|
|
|
2129
|
|
9
|
|
|
|
|
|
|
Moose::Exporter->setup_import_methods( also => ['Moose'] ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init_meta { |
12
|
227
|
|
|
227
|
0
|
23417
|
my $class = shift; |
13
|
227
|
|
|
|
|
925
|
my %params = @_; |
14
|
227
|
|
|
|
|
545
|
my $for_class = $params{for_class}; |
15
|
227
|
|
|
|
|
2299
|
Method::Signatures::Simple->import( into => $for_class ); |
16
|
227
|
|
|
|
|
99858
|
MooseX::HasDefaults::RW->import( { into => $for_class } ); |
17
|
|
|
|
|
|
|
{ |
18
|
19
|
|
|
19
|
|
87
|
no strict 'refs'; |
|
19
|
|
|
|
|
47
|
|
|
19
|
|
|
|
|
1783
|
|
|
227
|
|
|
|
|
1062597
|
|
19
|
227
|
|
|
0
|
|
2353
|
*{ $for_class . '::CLASS' } = sub () { $for_class }; # like CLASS.pm |
|
227
|
|
|
|
|
1264
|
|
|
0
|
|
|
|
|
0
|
|
20
|
227
|
|
|
|
|
477
|
*{ $for_class . '::CLASS' } = \$for_class; |
|
227
|
|
|
|
|
1109
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Mason::Component::Moose - Moose policies and exports for Mason components |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 DESCRIPTION |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This module is automatically included in each generated Mason component class, |
37
|
|
|
|
|
|
|
and is equivalent to |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
use CLASS; |
40
|
|
|
|
|
|
|
use Moose; |
41
|
|
|
|
|
|
|
use MooseX::HasDefaults::RW; |
42
|
|
|
|
|
|
|
use Method::Signatures::Simple; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 OVERRIDING |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
To override the default behavior, subclass this class and specify it as |
47
|
|
|
|
|
|
|
C<base_component_moose_class> to L<Mason::Interp|Mason::Interp>. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
For example, to use L<MooseX::StrictConstructor> in every component: |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
package My::Mason::Component::Moose; |
52
|
|
|
|
|
|
|
use Moose::Exporter; |
53
|
|
|
|
|
|
|
use MooseX::StrictConstructor (); |
54
|
|
|
|
|
|
|
use base qw(Mason::Component::Moose); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub init_meta { |
57
|
|
|
|
|
|
|
my $class = shift; |
58
|
|
|
|
|
|
|
$class->SUPER::init_meta(@_); |
59
|
|
|
|
|
|
|
MooseX::StrictConstructor->init_meta(@_); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
... |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $interp = Mason::Interp->new(..., base_component_moose_class => 'My::Mason::Component::Moose'); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SEE ALSO |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L<Mason|Mason> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Jonathan Swartz <swartz@pobox.com> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Jonathan Swartz. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
79
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |