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