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