line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use Moose::Role; |
2
|
10
|
|
|
10
|
|
14223
|
use Pod::Usage; |
|
10
|
|
|
|
|
30079
|
|
|
10
|
|
|
|
|
52
|
|
3
|
10
|
|
|
10
|
|
49983
|
use MooseX::Getopt; |
|
10
|
|
|
|
|
429830
|
|
|
10
|
|
|
|
|
1101
|
|
4
|
10
|
|
|
10
|
|
4166
|
use Catalyst::EngineLoader; |
|
10
|
|
|
|
|
2420482
|
|
|
10
|
|
|
|
|
429
|
|
5
|
10
|
|
|
10
|
|
3187
|
use Moose::Util::TypeConstraints; |
|
10
|
|
|
|
|
63
|
|
|
10
|
|
|
|
|
385
|
|
6
|
10
|
|
|
10
|
|
63
|
use Catalyst::Utils; |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
96
|
|
7
|
10
|
|
|
10
|
|
19707
|
use namespace::clean -except => [ 'meta' ]; |
|
10
|
|
|
|
|
33
|
|
|
10
|
|
|
|
|
270
|
|
8
|
10
|
|
|
10
|
|
51
|
|
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
89
|
|
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
|
55021
|
return { |
68
|
19
|
|
|
|
|
51
|
argv => $self->ARGV, |
69
|
|
|
|
|
|
|
extra_argv => $self->extra_argv, |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
41
|
|
|
41
|
|
73
|
|
73
|
|
|
|
|
|
|
my $self = shift; |
74
|
41
|
|
|
|
|
934
|
my @app_args = $self->_application_args; |
75
|
|
|
|
|
|
|
return (port => $app_args[0]); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $self = shift; |
80
|
4
|
|
|
4
|
|
6
|
my $app = $self->application_name; |
81
|
4
|
|
|
|
|
14
|
Catalyst::Utils::ensure_class_loaded($app); |
82
|
4
|
|
|
|
|
147
|
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
|
|
73
|
} |
89
|
37
|
|
|
|
|
890
|
$app->run($self->_application_args, $server); |
90
|
37
|
|
|
|
|
179
|
} |
91
|
37
|
|
|
|
|
68
|
|
92
|
37
|
100
|
|
|
|
115
|
1; |
93
|
35
|
|
|
|
|
106
|
|
94
|
|
|
|
|
|
|
=head1 NAME |
95
|
|
|
|
|
|
|
|
96
|
2
|
|
|
|
|
6
|
Catalyst::ScriptRole - Common functionality for Catalyst scripts. |
97
|
|
|
|
|
|
|
|
98
|
37
|
|
|
|
|
134038
|
=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 |