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