line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Engine::Middleware::MobileAttribute; |
2
|
1
|
|
|
1
|
|
460
|
use HTTP::Engine::Middleware; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
4
|
use HTTP::MobileAttribute; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
my $req; |
7
|
|
|
|
|
|
|
my $mobile_attribute; |
8
|
|
|
|
|
|
|
middleware_method 'mobile_attribute' => sub { |
9
|
2
|
50
|
|
2
|
|
84
|
return unless $req; |
10
|
2
|
|
33
|
|
|
16
|
$mobile_attribute ||= HTTP::MobileAttribute->new( $req->headers ); |
11
|
|
|
|
|
|
|
}; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
before_handle { |
14
|
|
|
|
|
|
|
(undef, undef, $req) = @_; |
15
|
|
|
|
|
|
|
$mobile_attribute = undef; |
16
|
|
|
|
|
|
|
$req; |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
__MIDDLEWARE__ |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
__END__ |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
HTTP::Engine::Middleware::MobileAttribute - wrapper for HTTP::MobileAttribute |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $mw = HTTP::Engine::Middleware->new({method_class => 'HTTP::Engine::Request'}); |
31
|
|
|
|
|
|
|
$mw->install(qw/ HTTP::Engine::Middleware::MobileAttribute /); |
32
|
|
|
|
|
|
|
HTTP::Engine->new( |
33
|
|
|
|
|
|
|
interface => { |
34
|
|
|
|
|
|
|
module => 'YourFavoriteInterfaceHere', |
35
|
|
|
|
|
|
|
request_handler => $mw->handler( \&handler ), |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
)->run(); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This module injects one method named 'mobile_attribute'. |
42
|
|
|
|
|
|
|
This method returns the instance of HTTP::MobileAttribute. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 AUTHORS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Tokuhiro Matsuno |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SEE ALSO |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
L<HTTP::MobileAttribute> |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |