line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Mojolyst; |
2
|
1
|
|
|
1
|
|
786
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
195
|
use Mojo::Loader qw/find_modules load_class/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
182
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub register { |
9
|
1
|
|
|
1
|
1
|
39
|
my ($self, $app, $conf) = @_; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Discover controllers |
12
|
1
|
|
|
|
|
4
|
for my $class ( find_modules $conf->{controllers} ) { |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Steal children |
15
|
0
|
|
|
|
|
|
my $e = load_class $class; |
16
|
0
|
|
|
|
|
|
my @children = @{$class->new->routes->children}; |
|
0
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
$app->routes->add_child($_) for @children; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Make DATA sections accessible |
20
|
0
|
|
|
|
|
|
push @{$app->static->classes}, $class; |
|
0
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
push @{$app->renderer->classes}, $class; |
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
__END__ |