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