line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Form; |
2
|
3
|
|
|
3
|
|
29518
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
3
|
|
|
|
|
380066
|
|
|
3
|
|
|
|
|
21
|
|
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
3385
|
use Mojo::Loader qw(data_section find_modules load_class); |
|
3
|
|
|
|
|
69100
|
|
|
3
|
|
|
|
|
1190
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.009'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub register { |
9
|
1
|
|
|
1
|
1
|
39
|
my ($self, $app, $conf) = @_; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
50
|
|
|
4
|
$conf ||= {}; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$app->helper( |
14
|
|
|
|
|
|
|
form_handler => sub { |
15
|
6
|
|
|
6
|
|
5867
|
my $self = shift; |
16
|
6
|
|
|
|
|
12
|
my $class_name = shift; |
17
|
|
|
|
|
|
|
|
18
|
6
|
|
100
|
|
|
20
|
$class_name ||= 'Default'; |
19
|
6
|
|
|
|
|
13
|
my $namespace = ref($self->app) . '::Form::'; |
20
|
|
|
|
|
|
|
|
21
|
6
|
100
|
|
|
|
49
|
unless ($class_name =~ m/[A-Z]/) { |
22
|
1
|
|
|
|
|
4
|
my $namespace = ref($self->app) . '::Form::'; |
23
|
1
|
50
|
|
|
|
7
|
$namespace = '' if $namespace =~ m/^Mojolicious::Lite/; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
20
|
$class_name = Mojo::ByteStream->new($class_name)->camelize; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
6
|
|
|
|
|
84
|
$class_name = $namespace . $class_name; |
29
|
|
|
|
|
|
|
#my $e = Mojo::Loader->new->load($class_name); |
30
|
|
|
|
|
|
|
#my $e = Mojo::Loader->load_class($class_name); |
31
|
6
|
|
|
|
|
31
|
my $e = load_class($class_name); |
32
|
|
|
|
|
|
|
|
33
|
6
|
50
|
|
|
|
791
|
Carp::croak qq/Can't load form '$class_name': / . $e->message |
34
|
|
|
|
|
|
|
if ref $e; |
35
|
|
|
|
|
|
|
|
36
|
6
|
100
|
|
|
|
19
|
Carp::croak qq/Can't find form '$class_name'/ if $e; |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
|
|
13
|
return $class_name->new(%$conf, @_); |
39
|
|
|
|
|
|
|
} |
40
|
1
|
|
|
|
|
10
|
); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |