since the prepare_path behaviour has changed, juice the "version" up
[catagits/Catalyst-Engine-SCGI.git] / lib / Catalyst / Helper / SCGI.pm
1 package Catalyst::Helper::SCGI;
2
3 use warnings;
4 use strict;
5 use Config;
6 use File::Spec;
7
8 our $VERSION = '0.02';
9
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
20         $ script/myapp_create.pl SCGI -p 9000
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};
38     my $app  = lc($helper->{app});
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
47 Victor Igumnov, C<< <victori at lamer0.com> >>
48
49 =head1 BUGS
50
51 Please report any bugs or feature requests to
52 C<victori at cpan.org>
53
54 =head1 ACKNOWLEDGEMENTS
55
56 =head1 COPYRIGHT & LICENSE
57
58 Copyright 2006 Victor Igumnov, all rights reserved.
59
60 This program is free software; you can redistribute it and/or modify it
61 under the same terms as Perl itself.
62
63 =cut
64
65 1;
66
67 __DATA__
68
69 __scgi_script__
70 #!/usr/bin/env perl
71
72 BEGIN { $ENV{CATALYST_ENGINE} ||= 'SCGI' }
73
74 use strict;
75 use warnings;
76 use Getopt::Long;
77 use Pod::Usage;
78 use FindBin;
79 use lib "$FindBin::Bin/../lib";
80 use [% app %];
81
82 my $help = 0;
83 my ( $port, $detach );
84  
85 GetOptions(
86     'help|?'      => \$help,
87     'port|p=s'  => \$port,
88     'daemon|d'    => \$detach,
89 );
90
91 pod2usage(1) if $help;
92
93 [% app %]->run( 
94     $port, 
95     $detach,
96 );
97
98 1;
99
100 =head1 NAME
101
102 [% app %]_scgi.pl - Catalyst SCGI
103
104 =head1 SYNOPSIS
105
106 [% app %]_scgi.pl [options]
107  
108  Options:
109    -? -help     display this help and exits
110    -p -port     Port to listen on
111    -d -daemon   daemonize
112
113 =head1 DESCRIPTION
114
115 Run a Catalyst application as SCGI.
116
117 =head1 AUTHOR
118
119 Victor Igumnov, C<victori@cpan.org>
120
121 =head1 COPYRIGHT
122
123 This library is free software, you can redistribute it and/or modify
124 it under the same terms as Perl itself.
125
126 =cut