| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CatalystX::self; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
123904
|
use warnings; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
131
|
|
|
4
|
4
|
|
|
4
|
|
23
|
use strict; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
138
|
|
|
5
|
4
|
|
|
4
|
|
3762
|
use parent 'self'; |
|
|
4
|
|
|
|
|
2429
|
|
|
|
4
|
|
|
|
|
23
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Sub::Exporter -setup => { |
|
8
|
|
|
|
|
|
|
exports => [qw/self catalyst args/], |
|
9
|
|
|
|
|
|
|
groups => { |
|
10
|
|
|
|
|
|
|
default => [-all] |
|
11
|
|
|
|
|
|
|
} |
|
12
|
|
|
|
|
|
|
}; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
CatalystX::self - A customized self for Catalyst controllers |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 VERSION |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Version 0.01 |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This is a very simple but handy module that shifts some of bits |
|
29
|
|
|
|
|
|
|
around from L to allow for an easier usage with (and with in) |
|
30
|
|
|
|
|
|
|
Catalyst controllers. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
package MyApp::Foo; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use parent 'Catalyst::Controller'; |
|
35
|
|
|
|
|
|
|
use CatalystX::self; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub bar : Local { |
|
38
|
|
|
|
|
|
|
my ($some,$params) = args; |
|
39
|
|
|
|
|
|
|
self->action_for('name'); |
|
40
|
|
|
|
|
|
|
catalyst->response->body('Hello World'); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
... |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 What if I don't like the names of these block words? |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Simple! Since L and this module utilize L you |
|
48
|
|
|
|
|
|
|
may rename the methods as you see fit. |
|
49
|
|
|
|
|
|
|
Here is an example that renames the args block word into some else and the |
|
50
|
|
|
|
|
|
|
catalyst block word into the more common and shorter 'c'. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
package MyApp::LostShoes; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use parent 'Catalyst::Controller'; |
|
55
|
|
|
|
|
|
|
use CatalystX::self ( |
|
56
|
|
|
|
|
|
|
catalyst => { -as => 'c' }, |
|
57
|
|
|
|
|
|
|
args => { -as => 'gnargles' }, |
|
58
|
|
|
|
|
|
|
self => { -as => 'this' } |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub bar : Local { |
|
62
|
|
|
|
|
|
|
this->{shoe} = gnargles; |
|
63
|
|
|
|
|
|
|
c->res->body($this->{shoe}); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
... |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
You may also use the '-as' import renaming trick to do "aliases". |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
use CatalystX::self ( |
|
71
|
|
|
|
|
|
|
catalyst => { -as => 'c' }, |
|
72
|
|
|
|
|
|
|
'-all' |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Now we have both 'catalyst' and 'c' block words. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 EXPORT |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 self |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
See L |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 args |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns properly shifted L for Catalyst controllers |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub args { |
|
90
|
|
|
|
|
|
|
my @a = self::_args; |
|
91
|
|
|
|
|
|
|
return @a[2..$#a]; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 catalyst |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Returns Catalyst object. |
|
97
|
|
|
|
|
|
|
Also known as the second argument in a Catalyst controller method. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub catalyst { |
|
102
|
|
|
|
|
|
|
return (self::_args)[1]; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 AUTHOR |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Jason M. Mills, C<< >> |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 BUGS |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
112
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
113
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SUPPORT |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
perldoc CatalystX::self |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
You can also look for information at: |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=over 4 |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
L |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
L |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
L |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * Search CPAN |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
L |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=back |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Copyright 2008 Jason M. Mills, all rights reserved. |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
156
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
1; # End of CatalystX::self |