line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CatalystX::GlobalContext; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:RKITOVER'; |
3
|
|
|
|
|
|
|
$CatalystX::GlobalContext::VERSION = '0.039'; |
4
|
2
|
|
|
2
|
|
2070031
|
use strict; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
61
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
56
|
|
6
|
2
|
|
|
2
|
|
12
|
use parent 'Exporter'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
13
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
125
|
use Scalar::Util 'weaken'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
117
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
12
|
use vars '$c'; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
235
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = '$c'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
CatalystX::GlobalContext - Export Catalyst Context |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package MyApp::Controller::Root; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use CatalystX::GlobalContext (); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub auto : Private { |
24
|
|
|
|
|
|
|
my ($self, $c) = @_; |
25
|
|
|
|
|
|
|
CatalystX::GlobalContext->set_context($c); |
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
package Some::Other::Module; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use CatalystX::GlobalContext '$c'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
... |
34
|
|
|
|
|
|
|
do stuff with $c |
35
|
|
|
|
|
|
|
... |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 DESCRIPTION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This module, in combination with L<Catalyst::Controller::WrapCGI> or |
40
|
|
|
|
|
|
|
L<Catalyst::Controller::CGIBin> is for helping you run legacy mod_perl code in |
41
|
|
|
|
|
|
|
L<Catalyst>. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
You save a copy of $c somewhere at the beginning of the request cycle, and it is |
44
|
|
|
|
|
|
|
then accessible through an export where you need it. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
You can then rip out C<Apache::> type things, and replace them with things based on |
47
|
|
|
|
|
|
|
C<$c>. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 CLASS METHODS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 CatalystX::GlobalContext->set_context($c) |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Saves a weakened reference to the Catalyst context, |
54
|
|
|
|
|
|
|
which is accessible from other modules as an export. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub set_context { |
59
|
1
|
|
|
1
|
1
|
25408
|
$c = $_[1]; |
60
|
1
|
|
|
|
|
6
|
weaken $c; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SEE ALSO |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
L<Catalyst::Controller::CGIBin>, L<Catalyst::Controller::WrapCGI>, |
66
|
|
|
|
|
|
|
L<Catalyst> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 BUGS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Please report any bugs or feature requests to C<bug-catalyst-controller-wrapcgi |
71
|
|
|
|
|
|
|
at rt.cpan.org>, or through the web interface at |
72
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Controller-WrapCGI>. |
73
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
74
|
|
|
|
|
|
|
your bug as I make changes. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Rafael Kitover <rkitover@gmail.com> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Copyright (c) 2008-2015 Rafael Kitover <rkitover@gmail.com> and |
83
|
|
|
|
|
|
|
L<Catalyst::Controller::WrapCGI/CONTRIBUTORS>. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
86
|
|
|
|
|
|
|
under the same terms as Perl itself. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__PACKAGE__; # End of CatalystX::GlobalContext |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# vim: expandtab shiftwidth=4 ts=4 tw=80: |