fix tests for new HTTP::Request::AsCGI, release
[catagits/Catalyst-Controller-WrapCGI.git] / lib / CatalystX / GlobalContext.pm
CommitLineData
32b32c62 1package CatalystX::GlobalContext;
2
3use strict;
4use warnings;
5use parent 'Exporter';
6
7use Scalar::Util 'weaken';
8
457c1d76 9use vars '$c';
10our @EXPORT_OK = '$c';
11
32b32c62 12=head1 NAME
13
14CatalystX::GlobalContext - Export Catalyst Context
15
32b32c62 16=cut
17
05f3f060 18our $VERSION = '0.029';
32b32c62 19
20=head1 SYNOPSIS
21
22 package MyApp::Controller::Root;
23
24 use CatalystX::GlobalContext ();
25
26 sub auto {
27 my ($self, $c) = @_;
28 CatalystX::GlobalContext->set_context($c);
29 1;
30 }
31
32 package Some::Other::Module;
33
34 use CatalystX::GlobalContext '$c';
35
36 ...
37 do stuff with $c
38 ...
39
40=head1 DESCRIPTION
41
21a20b7e 42This module, in combination with L<Catalyst::Controller::WrapCGI> or
43L<Catalyst::Controller::CGIBin> is for helping you run legacy mod_perl code in
44L<Catalyst>.
32b32c62 45
46You save a copy of $c somewhere at the beginning of the request cycle, and it is
47then accessible through an export where you need it.
48
21a20b7e 49You can then rip out C<Apache::> type things, and replace them with things based on
50C<$c>.
32b32c62 51
21a20b7e 52What we really need is a set of C<Apache::> compatibility classes, but that doesn't
32b32c62 53exist yet.
54
55DO NOT USE THIS MODULE IN NEW CODE
56
57=head1 CLASS METHODS
58
59=head2 CatalystX::GlobalContext->set_context($c)
60
61Saves a weakened reference to the Catalyst context,
62which is accessible from other modules as an export.
63
64=cut
65
66sub set_context {
67 $c = $_[1];
68 weaken $c;
69}
70
21a20b7e 71=head1 SEE ALSO
72
73L<Catalyst::Controller::CGIBin>, L<Catalyst::Controller::WrapCGI>,
74L<Catalyst>
75
32b32c62 76=head1 BUGS
77
78Please report any bugs or feature requests to C<bug-catalyst-controller-wrapcgi
79at rt.cpan.org>, or through the web interface at
80L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Controller-WrapCGI>.
81I will be notified, and then you'll automatically be notified of progress on
82your bug as I make changes.
83
84=head1 SUPPORT
85
86More information at:
87
88=over 4
89
90=item * RT: CPAN's request tracker
91
92L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-Controller-WrapCGI>
93
94=item * AnnoCPAN: Annotated CPAN documentation
95
96L<http://annocpan.org/dist/Catalyst-Controller-WrapCGI>
97
98=item * CPAN Ratings
99
100L<http://cpanratings.perl.org/d/Catalyst-Controller-WrapCGI>
101
102=item * Search CPAN
103
104L<http://search.cpan.org/dist/Catalyst-Controller-WrapCGI>
105
106=back
107
efa4a434 108=head1 AUTHOR
109
110See L<Catalyst::Controller::WrapCGI/AUTHOR> and
111L<Catalyst::Controller::WrapCGI/CONTRIBUTORS>.
112
32b32c62 113=head1 COPYRIGHT & LICENSE
114
efa4a434 115Copyright (c) 2008-2009 L<Catalyst::Controller::WrapCGI/AUTHOR> and
116L<Catalyst::Controller::WrapCGI/CONTRIBUTORS>.
32b32c62 117
118This program is free software; you can redistribute it and/or modify it
119under the same terms as Perl itself.
120
121=cut
122
1231; # End of CatalystX::GlobalContext
124
125# vim: expandtab shiftwidth=4 ts=4 tw=80: