line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use Moose::Role; |
2
|
10
|
|
|
10
|
|
17870
|
use Pod::Usage; |
|
10
|
|
|
|
|
36136
|
|
|
10
|
|
|
|
|
57
|
|
3
|
10
|
|
|
10
|
|
61440
|
use MooseX::Getopt; |
|
10
|
|
|
|
|
514731
|
|
|
10
|
|
|
|
|
1360
|
|
4
|
10
|
|
|
10
|
|
4967
|
use Catalyst::EngineLoader; |
|
10
|
|
|
|
|
2964931
|
|
|
10
|
|
|
|
|
476
|
|
5
|
10
|
|
|
10
|
|
3767
|
use Moose::Util::TypeConstraints; |
|
10
|
|
|
|
|
43
|
|
|
10
|
|
|
|
|
396
|
|
6
|
10
|
|
|
10
|
|
81
|
use Catalyst::Utils; |
|
10
|
|
|
|
|
52
|
|
|
10
|
|
|
|
|
100
|
|
7
|
10
|
|
|
10
|
|
24058
|
use namespace::clean -except => [ 'meta' ]; |
|
10
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
338
|
|
8
|
10
|
|
|
10
|
|
59
|
|
|
10
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
128
|
|
9
|
|
|
|
|
|
|
subtype 'Catalyst::ScriptRole::LoadableClass', |
10
|
|
|
|
|
|
|
as 'ClassName'; |
11
|
|
|
|
|
|
|
coerce 'Catalyst::ScriptRole::LoadableClass', |
12
|
|
|
|
|
|
|
from 'Str', |
13
|
|
|
|
|
|
|
via { Catalyst::Utils::ensure_class_loaded($_); $_ }; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with 'MooseX::Getopt' => { |
16
|
|
|
|
|
|
|
-version => 0.48, |
17
|
|
|
|
|
|
|
-excludes => [qw/ |
18
|
|
|
|
|
|
|
_getopt_spec_warnings |
19
|
|
|
|
|
|
|
_getopt_spec_exception |
20
|
|
|
|
|
|
|
print_usage_text |
21
|
|
|
|
|
|
|
/], |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has application_name => ( |
25
|
|
|
|
|
|
|
traits => ['NoGetopt'], |
26
|
|
|
|
|
|
|
isa => 'Str', |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
required => 1, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has loader_class => ( |
32
|
|
|
|
|
|
|
isa => 'Catalyst::ScriptRole::LoadableClass', |
33
|
|
|
|
|
|
|
is => 'ro', |
34
|
|
|
|
|
|
|
coerce => 1, |
35
|
|
|
|
|
|
|
default => 'Catalyst::EngineLoader', |
36
|
|
|
|
|
|
|
documentation => 'The class to use to detect and load the PSGI engine', |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has _loader => ( |
40
|
|
|
|
|
|
|
isa => 'Plack::Loader', |
41
|
|
|
|
|
|
|
default => sub { |
42
|
|
|
|
|
|
|
my $self = shift; |
43
|
|
|
|
|
|
|
$self->loader_class->new(application_name => $self->application_name); |
44
|
|
|
|
|
|
|
}, |
45
|
|
|
|
|
|
|
handles => { |
46
|
|
|
|
|
|
|
load_engine => 'load', |
47
|
|
|
|
|
|
|
autoload_engine => 'auto', |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
lazy => 1, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
0
|
|
|
shift; |
54
|
|
|
|
|
|
|
warn @_; |
55
|
|
|
|
|
|
|
} |
56
|
0
|
|
|
0
|
|
0
|
|
57
|
0
|
|
|
|
|
0
|
my $self = shift; |
58
|
|
|
|
|
|
|
pod2usage(); |
59
|
|
|
|
|
|
|
exit 0; |
60
|
|
|
|
|
|
|
} |
61
|
0
|
|
|
0
|
1
|
0
|
|
62
|
0
|
|
|
|
|
0
|
my $self = shift; |
63
|
0
|
|
|
|
|
0
|
$self->_run_application; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $self = shift; |
67
|
19
|
|
|
19
|
1
|
31640
|
return { |
68
|
19
|
|
|
|
|
86
|
argv => $self->ARGV, |
69
|
|
|
|
|
|
|
extra_argv => $self->extra_argv, |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
41
|
|
|
41
|
|
95
|
|
73
|
|
|
|
|
|
|
my $self = shift; |
74
|
41
|
|
|
|
|
1152
|
my @app_args = $self->_application_args; |
75
|
|
|
|
|
|
|
return (port => $app_args[0]); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $self = shift; |
80
|
4
|
|
|
4
|
|
12
|
my $app = $self->application_name; |
81
|
4
|
|
|
|
|
18
|
Catalyst::Utils::ensure_class_loaded($app); |
82
|
4
|
|
|
|
|
185
|
my $server; |
83
|
|
|
|
|
|
|
if (my $e = $self->_plack_engine_name ) { |
84
|
|
|
|
|
|
|
$server = $self->load_engine($e, $self->_plack_loader_args); |
85
|
|
|
|
2
|
|
|
} |
86
|
|
|
|
|
|
|
else { |
87
|
|
|
|
|
|
|
$server = $self->autoload_engine($self->_plack_loader_args); |
88
|
37
|
|
|
37
|
|
91
|
} |
89
|
37
|
|
|
|
|
1108
|
$app->run($self->_application_args, $server); |
90
|
37
|
|
|
|
|
186
|
} |
91
|
37
|
|
|
|
|
77
|
|
92
|
37
|
100
|
|
|
|
168
|
1; |
93
|
35
|
|
|
|
|
141
|
|
94
|
|
|
|
|
|
|
=head1 NAME |
95
|
|
|
|
|
|
|
|
96
|
2
|
|
|
|
|
10
|
Catalyst::ScriptRole - Common functionality for Catalyst scripts. |
97
|
|
|
|
|
|
|
|
98
|
37
|
|
|
|
|
162519
|
=head1 SYNOPSIS |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
package MyApp::Script::Foo; |
101
|
|
|
|
|
|
|
use Moose; |
102
|
|
|
|
|
|
|
use namespace::autoclean; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
with 'Catalyst::ScriptRole'; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub _application_args { ... } |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 DESCRIPTION |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Role with the common functionality of Catalyst scripts. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 METHODS |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 run |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
The method invoked to run the application. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 print_usage_text |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Prints out the usage text for the script you tried to invoke. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 application_name |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The name of the application class, e.g. MyApp |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 SEE ALSO |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
L<Catalyst> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
L<MooseX::Getopt> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHORS |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Catalyst Contributors, see Catalyst.pm |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 COPYRIGHT |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify |
141
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |