line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::HelloMojo; |
2
|
1
|
|
|
1
|
|
936
|
use Mojolicious::Lite; |
|
1
|
|
|
|
|
112865
|
|
|
1
|
|
|
|
|
6
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
15820
|
use Cwd; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
417
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
app->moniker(Mojo::Util::decamelize(app->moniker)); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
plugin 'Config' => {default => {hello_mojo => ['hello_mojo']}}; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
foreach my $app_dir ( $ENV{HELLO_MOJO} ? split /:/, $ENV{HELLO_MOJO} : @{app->config->{hello_mojo}} ) { |
13
|
|
|
|
|
|
|
$app_dir = Mojo::Path->new($app_dir)->leading_slash ? Mojo::Home->new($app_dir) : Mojo::Home->new(Mojo::Path->new(getcwd)->trailing_slash(1)->merge($app_dir)); |
14
|
|
|
|
|
|
|
opendir(my $dh, $app_dir) or next; |
15
|
|
|
|
|
|
|
foreach ( grep { !/^\./ } readdir($dh) ) { |
16
|
|
|
|
|
|
|
my $app; |
17
|
|
|
|
|
|
|
# Create a directory by the name of your lite_app |
18
|
|
|
|
|
|
|
# Change to that directory, then generate your lite_app by the same name |
19
|
|
|
|
|
|
|
$app = $app_dir->rel_file("$_/$_.pl"); |
20
|
|
|
|
|
|
|
$app = $app_dir->rel_file("$_/$_") unless $app && -f $app; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$app = $app_dir->rel_file("$_/script/$_") unless $app && -f $app; |
23
|
|
|
|
|
|
|
$app = $app_dir->rel_file("$_/script/$_.pl") unless $app && -f $app; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
if ( -f $app_dir->rel_file("$_/.nomojo") ) { |
26
|
|
|
|
|
|
|
app->log->info("No Mojo for $app, skipping"); |
27
|
|
|
|
|
|
|
} elsif ( $app && -f $app ) { |
28
|
|
|
|
|
|
|
plugin Mount => {"/$_" => $app}; |
29
|
|
|
|
|
|
|
app->log->info("Mounted /$_ => $app"); |
30
|
|
|
|
|
|
|
} else { |
31
|
|
|
|
|
|
|
app->log->info("No start script found for $app, skipping"); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
closedir $dh; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=encoding utf8 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Mojo::HelloMojo - Mount All full and lite apps! |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
use Mojo::HelloMojo; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $hello = Mojo::HelloMojo->new; |
50
|
|
|
|
|
|
|
$hello->start; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
L is a L application. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 SEE ALSO |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
L, L, L. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |