line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1331
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
53
|
|
2
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
70
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package WebNano::DirController; |
5
|
2
|
|
|
2
|
|
10
|
use WebNano::FindController 'find_nested'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
96
|
|
6
|
2
|
|
|
2
|
|
10
|
use base 'WebNano::Controller'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
936
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub _self_path{ |
9
|
30
|
|
|
30
|
|
45
|
my $class = shift; |
10
|
30
|
|
|
|
|
41
|
my $path = $class; |
11
|
30
|
|
|
|
|
127
|
$path =~ s/.*::Controller(?=(::|$))//; |
12
|
30
|
|
|
|
|
47
|
$path =~ s{::}{/}; |
13
|
30
|
|
|
|
|
140
|
return $path . '/'; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub handle { |
17
|
36
|
|
|
36
|
1
|
149
|
my ( $class, %args ) = @_; |
18
|
36
|
|
|
|
|
68
|
my $path = delete $args{path}; |
19
|
36
|
|
|
|
|
164
|
my $self = $class->new( %args ); |
20
|
36
|
|
|
|
|
1480
|
my $out = $self->local_dispatch( $path ); |
21
|
36
|
100
|
|
|
|
147
|
return $out if $out; |
22
|
30
|
|
|
|
|
243
|
my( $path_part, $new_path ) = ( $path =~ qr{^([^/]*)/?(.*)} ); |
23
|
30
|
50
|
|
|
|
142
|
$path_part =~ s/::|'//g if defined( $path_part ); |
24
|
30
|
50
|
|
|
|
69
|
return if !length( $path_part ); |
25
|
30
|
|
|
|
|
88
|
my $controller_class = find_nested( $class->_self_path . $path_part, $args{app}->controller_search_path ); |
26
|
29
|
100
|
|
|
|
116
|
return if !$controller_class; |
27
|
|
|
|
|
|
|
return $controller_class->handle( |
28
|
|
|
|
|
|
|
%args, |
29
|
|
|
|
|
|
|
path => $new_path, |
30
|
25
|
|
|
|
|
206
|
self_url => $args{self_url} . $path_part . '/', |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=pod |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
WebNano::DirController - WebNano controller class for root |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 VERSION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
version 0.001 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
use base WebNano::DirController; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This is the WebNano pass through base controller - used for root controllers |
56
|
|
|
|
|
|
|
and all other controllers that have sub-controllers. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
In a path C</SomeDeepController/OtherController/LeaveController/method> all |
59
|
|
|
|
|
|
|
C<MyApp::Controoler>, C<MyApp::Controller::SomeDeepController> |
60
|
|
|
|
|
|
|
and C<MyApp::Controller::SomeDeepController::OtherController> need to be DirControllers. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
If there is no suitable method in the current class, child controller classes |
63
|
|
|
|
|
|
|
are tried out. If there is found one that matches the path part then it is |
64
|
|
|
|
|
|
|
instantiated with the current psgi env and it's handle method is called. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 METHODS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 handle |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Zbigniew Lukasiak <zby@cpan.org> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Zbigniew Lukasiak <zby@cpan.org>. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
79
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# ABSTRACT: WebNano controller class for root |
87
|
|
|
|
|
|
|
|