Commit | Line | Data |
628f1440 |
1 | package Catalyst::Helper::SCGI; |
2 | |
3 | use warnings; |
4 | use strict; |
5 | use Config; |
6 | use File::Spec; |
7 | |
5ca78ffd |
8 | our $VERSION = '0.03'; |
74b7d482 |
9 | |
628f1440 |
10 | =head1 NAME |
11 | |
12 | Catalyst::Helper::SCGI - SCGI helper to create a scgi runner script to run the SCGI engine. |
13 | |
14 | =cut |
15 | |
16 | =head1 SYNOPSIS |
17 | |
18 | use the helper to build the view module and associated templates. |
19 | |
a9251dc3 |
20 | $ script/myapp_create.pl SCGI |
628f1440 |
21 | |
22 | =head1 DESCRIPTION |
23 | |
24 | This helper module creates the runner script for the SCGI engine. |
25 | |
26 | =cut |
27 | |
28 | =head2 $self->mk_stuff ( $c, $helper, @args ) |
29 | |
30 | Create SCGI runner script |
31 | |
32 | =cut |
33 | |
34 | sub mk_stuff { |
35 | my ( $self, $helper, @args ) = @_; |
36 | |
37 | my $base = $helper->{base}; |
29f460bf |
38 | my $app = lc($helper->{app}); |
628f1440 |
39 | |
40 | $helper->render_file( "scgi_script", |
41 | File::Spec->catfile( $base, 'script', "$app\_scgi.pl" ) ); |
42 | chmod 0700, "$base/script/$app\_scgi.pl"; |
43 | } |
44 | |
45 | =head1 AUTHOR |
46 | |
9ca6d100 |
47 | Orlando Vazquez, C< <orlando at 2wycked.net> > |
628f1440 |
48 | |
49 | =head1 BUGS |
50 | |
51 | Please report any bugs or feature requests to |
9ca6d100 |
52 | C<orlando at 2wycked.net> |
628f1440 |
53 | |
54 | =head1 ACKNOWLEDGEMENTS |
55 | |
56 | =head1 COPYRIGHT & LICENSE |
57 | |
9ca6d100 |
58 | Copyright 2009 Orlando Vazquez, all rights reserved. |
628f1440 |
59 | Copyright 2006 Victor Igumnov, all rights reserved. |
60 | |
61 | This program is free software; you can redistribute it and/or modify it |
62 | under the same terms as Perl itself. |
63 | |
64 | =cut |
65 | |
66 | 1; |
67 | |
68 | __DATA__ |
69 | |
70 | __scgi_script__ |
71 | #!/usr/bin/env perl |
72 | |
73 | BEGIN { $ENV{CATALYST_ENGINE} ||= 'SCGI' } |
74 | |
75 | use strict; |
76 | use warnings; |
77 | use Getopt::Long; |
78 | use Pod::Usage; |
79 | use FindBin; |
80 | use lib "$FindBin::Bin/../lib"; |
81 | use [% app %]; |
82 | |
83 | my $help = 0; |
84 | my ( $port, $detach ); |
85 | |
86 | GetOptions( |
87 | 'help|?' => \$help, |
88 | 'port|p=s' => \$port, |
89 | 'daemon|d' => \$detach, |
90 | ); |
91 | |
92 | pod2usage(1) if $help; |
93 | |
94 | [% app %]->run( |
95 | $port, |
96 | $detach, |
97 | ); |
98 | |
99 | 1; |
100 | |
101 | =head1 NAME |
102 | |
103 | [% app %]_scgi.pl - Catalyst SCGI |
104 | |
105 | =head1 SYNOPSIS |
106 | |
107 | [% app %]_scgi.pl [options] |
108 | |
109 | Options: |
110 | -? -help display this help and exits |
111 | -p -port Port to listen on |
112 | -d -daemon daemonize |
113 | |
114 | =head1 DESCRIPTION |
115 | |
116 | Run a Catalyst application as SCGI. |
117 | |
118 | =head1 AUTHOR |
119 | |
9ca6d100 |
120 | Orlando Vazquez C<< orlando@2wycked.net >> |
628f1440 |
121 | |
122 | =head1 COPYRIGHT |
123 | |
124 | This library is free software, you can redistribute it and/or modify |
125 | it under the same terms as Perl itself. |
126 | |
127 | =cut |