Working on a dist for WrapCGI...
[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
9=head1 NAME
10
11CatalystX::GlobalContext - Export Catalyst Context
12
13=head1 VERSION
14
15Version 0.01
16
17=cut
18
19our $VERSION = '0.01';
20
21=head1 SYNOPSIS
22
23 package MyApp::Controller::Root;
24
25 use CatalystX::GlobalContext ();
26
27 sub auto {
28 my ($self, $c) = @_;
29 CatalystX::GlobalContext->set_context($c);
30 1;
31 }
32
33 package Some::Other::Module;
34
35 use CatalystX::GlobalContext '$c';
36
37 ...
38 do stuff with $c
39 ...
40
41=head1 DESCRIPTION
42
43This module, in combination with L<Catalyst::Controller::WrapCGI> is for helping
44you run legacy mod_perl code in L<Catalyst>.
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
49You can then rip out Apache:: type things, and replace them with things based on
50$c.
51
52What we really need is a set of Apache:: compatibility classes, but that doesn't
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
71=head1 AUTHOR
72
73Rafael Kitover, C<< <rkitover at cpan.org> >>
74
75=head1 BUGS
76
77Please report any bugs or feature requests to C<bug-catalyst-controller-wrapcgi
78at rt.cpan.org>, or through the web interface at
79L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Controller-WrapCGI>.
80I will be notified, and then you'll automatically be notified of progress on
81your bug as I make changes.
82
83=head1 SUPPORT
84
85More information at:
86
87=over 4
88
89=item * RT: CPAN's request tracker
90
91L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-Controller-WrapCGI>
92
93=item * AnnoCPAN: Annotated CPAN documentation
94
95L<http://annocpan.org/dist/Catalyst-Controller-WrapCGI>
96
97=item * CPAN Ratings
98
99L<http://cpanratings.perl.org/d/Catalyst-Controller-WrapCGI>
100
101=item * Search CPAN
102
103L<http://search.cpan.org/dist/Catalyst-Controller-WrapCGI>
104
105=back
106
107=head1 COPYRIGHT & LICENSE
108
109Copyright (c) 2008 Rafael Kitover
110
111This program is free software; you can redistribute it and/or modify it
112under the same terms as Perl itself.
113
114=cut
115
1161; # End of CatalystX::GlobalContext
117
118# vim: expandtab shiftwidth=4 ts=4 tw=80: