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