Updated helper templates
[catagits/Catalyst-Runtime.git] / script / catalyst.pl
CommitLineData
fc7ec1d9 1#!/usr/bin/perl -w
2
3use strict;
4use Getopt::Long;
5use Pod::Usage;
6use Catalyst::Helper;
7
ef3250bc 8my $help = 0;
9my $nonew = 0;
8264c145 10my $short = 0;
fc7ec1d9 11
1c773d18 12GetOptions(
13 'help|?' => \$help,
8264c145 14 'nonew' => \$nonew,
15 'short' => \$short
1c773d18 16);
fc7ec1d9 17
18pod2usage(1) if ( $help || !$ARGV[0] );
19
8264c145 20my $helper =
21 Catalyst::Helper->new( { '.newfiles' => !$nonew, 'short' => $short } );
fc7ec1d9 22pod2usage(1) unless $helper->mk_app( $ARGV[0] );
23
241;
25__END__
26
27=head1 NAME
28
29catalyst - Bootstrap a Catalyst application
30
31=head1 SYNOPSIS
32
d459eb44 33catalyst.pl [options] application-name
fc7ec1d9 34
35 Options:
8264c145 36 -help display this help and exits
37 -nonew don't create a .new file where a file to be created exists
38 -short use short types, like C instead of Controller...
fc7ec1d9 39
4be535b1 40 application-name must be a valid Perl module name and can include "::"
fc7ec1d9 41
42 Examples:
d459eb44 43 catalyst.pl My::App
44 catalyst.pl MyApp
fc7ec1d9 45
03a53815 46
fc7ec1d9 47=head1 DESCRIPTION
48
4be535b1 49The C<catalyst.pl> script bootstraps a Catalyst application, creating a
50directory structure populated with skeleton files.
51
52The application name must be a valid Perl module name. The name of the
53directory created is formed from the application name supplied, with double
54colons replaced with hyphens (so, for example, the directory for C<My::App> is
55C<My-App>).
56
57Using the example application name C<My::App>, the application directory will
58contain the following items:
59
60=over 4
61
62=item README
63
64a skeleton README file, which you are encouraged to expand on
65
66=item Build.PL
67
68a C<Module::Build> build script
69
70=item Changes
71
72a changes file with an initial entry for the creation of the application
73
74=item Makefile.PL
75
76an old-style MakeMaker script. Catalyst uses the C<Module::Build> system so
77this script actually generates a Makeifle that invokes the Build script.
78
79=item lib
80
81contains the application module (C<My/App.pm>) and
82subdirectories for model, view, and controller components (C<My/App/M>,
83C<My/App/V>, and C<My/App/C>).
84
85=item root
86
87root directory for your web document content. This is left empty.
88
89=item script
90
91a directory containing helper scripts:
92
93=over 4
94
95=item C<my_app_create.pl>
96
97helper script to generate new component modules
98
99=item C<my_app_server.pl>
100
101runs the generated application within a Catalyst test server, which can be
102used for testing without resorting to a full-blown web server configuration.
103
104=item C<my_app_cgi.pl>
105
106runs the generated application as a CGI script
107
108=item C<my_app_fastcgi.pl>
109
110runs the generated application as a FastCGI script
111
112
113=item C<my_app_test.pl>
114
115runs an action of the generated application from the comand line.
116
117=back
118
119=item t
120
121test directory
122
123=back
124
125
126The application module generated by the C<catalyst.pl> script is functional,
1c773d18 127although it reacts to all requests by outputting a friendly welcome screen.
4be535b1 128
129
130=head1 NOTE
131
132Neither C<catalyst.pl> nor the generated helper script will overwrite existing
133files. In fact the scripts will generate new versions of any existing files,
134adding the extension C<.new> to the filename. The C<.new> file is not created
135if would be identical to the existing file.
136
137This means you can re-run the scripts for example to see if newer versions of
138Catalyst or its plugins generate different code, or to see how you may have
139changed the generated code (although you do of course have all your code in a
140version control system anyway, don't you ...).
141
142
fc7ec1d9 143
03a53815 144=head1 SEE ALSO
145
4be535b1 146L<Catalyst::Manual>, L<Catalyst::Manual::Intro>
03a53815 147
fc7ec1d9 148=head1 AUTHOR
149
1c773d18 150Sebastian Riedel, C<sri@oook.de>,
151Andrew Ford, C<A.Ford@ford-mason.co.uk>
4be535b1 152
fc7ec1d9 153
154=head1 COPYRIGHT
155
4be535b1 156Copyright 2004-2005 Sebastian Riedel. All rights reserved.
fc7ec1d9 157
1c773d18 158This library is free software, you can redistribute it and/or modify it under
159the same terms as Perl itself.
fc7ec1d9 160
161=cut