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