line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Controller::Metal; |
2
|
1
|
|
|
1
|
|
3
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
3
|
|
|
|
|
|
|
extends 'Catalyst::Component'; |
4
|
|
|
|
|
|
|
with 'Catalyst::Component::ApplicationAttribute'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my %metals; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub BUILD { |
9
|
0
|
|
|
0
|
0
|
|
my($self, $args) = @_; |
10
|
0
|
|
|
|
|
|
push @{$metals{$self->_application}}, $self; |
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub metals_for { |
14
|
0
|
|
|
0
|
0
|
|
my($class, $application) = @_; |
15
|
0
|
0
|
|
|
|
|
@{$metals{$application} || []}; |
|
0
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
__END__ |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Catalyst::Controller::Metal - Raw PSGI handling in Catalyst controllers |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
package MyApp::Controller::Metalic; |
31
|
|
|
|
|
|
|
use parent 'Catalyst::Controller::Metal'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub call { |
34
|
|
|
|
|
|
|
my($self, $env) = @_; |
35
|
|
|
|
|
|
|
if ($env->{PATH_INFO} =~ m!^/hello!) { |
36
|
|
|
|
|
|
|
return [ 200, [ "Content-Type" => 'text/plain' ], [ "Hello World" ] ]; |
37
|
|
|
|
|
|
|
} else { |
38
|
|
|
|
|
|
|
return [ 404, [], [] ]; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Catalyst::Controller::Metal allows you to write a raw PSGI handler in |
43
|
|
|
|
|
|
|
your Catalyst application, inspired by Rails Metal that allows you to |
44
|
|
|
|
|
|
|
write raw Rack applications inside Ruby on Rails. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SEE ALSO |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Rails Metal. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |