line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::ExposeControllerMethod::Proxy; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
146
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.000001'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $AUTOLOAD; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
84
|
sub import { return } |
11
|
0
|
|
|
0
|
|
0
|
sub DESTROY { return } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
## no critic (ClassHierarchies::ProhibitAutoloading) |
14
|
|
|
|
|
|
|
sub AUTOLOAD { |
15
|
3
|
|
|
3
|
|
3
|
my $self = shift; |
16
|
3
|
|
|
|
|
2
|
my $c = ${$self}; |
|
3
|
|
|
|
|
7
|
|
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
|
|
24
|
my ($what) = $AUTOLOAD =~ /([^:]+)$/; |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
|
|
7
|
my $controller_method_name = $c->can('controller_method_name'); |
21
|
3
|
50
|
|
|
|
6
|
unless ($controller_method_name) { |
22
|
0
|
|
|
|
|
0
|
die 'Controller class ' |
23
|
|
|
|
|
|
|
. ref($c) |
24
|
|
|
|
|
|
|
. ' does not allow calling methods from the template'; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
|
|
7
|
my $method_name = $controller_method_name->( $c, $what ); |
28
|
3
|
50
|
|
|
|
24
|
unless ($method_name) { |
29
|
0
|
|
|
|
|
0
|
die "Invalid method '$what' called on contolling class"; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# install a method in the proxy class so we don't have to do this lookup again |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
## no critic (TestingAndDebugging::ProhibitNoStrict) |
35
|
1
|
|
|
1
|
|
4
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
89
|
|
|
3
|
|
|
|
|
3
|
|
36
|
3
|
|
|
|
|
8
|
*{$AUTOLOAD} = sub { |
37
|
0
|
|
|
0
|
|
0
|
my $that_self = shift; |
38
|
0
|
|
|
|
|
0
|
my $that_c = ${$self}; |
|
0
|
|
|
|
|
0
|
|
39
|
0
|
|
|
|
|
0
|
return $that_c->$method_name(@_); |
40
|
3
|
|
|
|
|
8
|
}; |
41
|
|
|
|
|
|
|
## use critic |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
11
|
return $c->$method_name(@_); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Mojolicious::Plugin::ExposeControllerMethod::Proxy - helper class for Mojolicious::Plugin::ExposeControllerMethod |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
The proxy class for Mojolicious::Plugin::ExposeControllerMethod. No user |
56
|
|
|
|
|
|
|
service parts here. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SEE ALSO |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|