Commit | Line | Data |
057cf470 |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use Getopt::Long; |
6 | use Pod::Usage; |
7 | eval "use Catalyst::Helper;"; |
8 | |
9 | if ($@) { |
10 | die <<END; |
11 | To use the Catalyst development tools including catalyst.pl and the |
12 | generated script/myapp_create.pl you need Catalyst::Helper, which is |
13 | part of the Catalyst-Devel distribution. Please install this via a |
14 | vendor package or by running one of - |
15 | |
16 | perl -MCPAN -e 'install Catalyst::Devel' |
17 | perl -MCPANPLUS -e 'install Catalyst::Devel' |
18 | END |
19 | } |
20 | |
21 | my $force = 0; |
22 | my $mech = 0; |
23 | my $help = 0; |
24 | |
25 | GetOptions( |
26 | 'nonew|force' => \$force, |
27 | 'mech|mechanize' => \$mech, |
28 | 'help|?' => \$help |
29 | ); |
30 | |
31 | pod2usage(1) if ( $help || !$ARGV[0] ); |
32 | |
33 | my $helper = Catalyst::Helper->new( { '.newfiles' => !$force, mech => $mech } ); |
34 | |
35 | pod2usage(1) unless $helper->mk_component( 'TestAppForComparison', @ARGV ); |
36 | |
37 | 1; |
38 | |
39 | =head1 NAME |
40 | |
41 | testappforcomparison_create.pl - Create a new Catalyst Component |
42 | |
43 | =head1 SYNOPSIS |
44 | |
45 | testappforcomparison_create.pl [options] model|view|controller name [helper] [options] |
46 | |
47 | Options: |
48 | -force don't create a .new file where a file to be created exists |
49 | -mechanize use Test::WWW::Mechanize::Catalyst for tests if available |
50 | -help display this help and exits |
51 | |
52 | Examples: |
53 | testappforcomparison_create.pl controller My::Controller |
54 | testappforcomparison_create.pl controller My::Controller BindLex |
55 | testappforcomparison_create.pl -mechanize controller My::Controller |
56 | testappforcomparison_create.pl view My::View |
57 | testappforcomparison_create.pl view MyView TT |
58 | testappforcomparison_create.pl view TT TT |
59 | testappforcomparison_create.pl model My::Model |
60 | testappforcomparison_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\ |
61 | dbi:SQLite:/tmp/my.db |
62 | testappforcomparison_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\ |
63 | dbi:Pg:dbname=foo root 4321 |
64 | |
65 | See also: |
66 | perldoc Catalyst::Manual |
67 | perldoc Catalyst::Manual::Intro |
68 | |
69 | =head1 DESCRIPTION |
70 | |
71 | Create a new Catalyst Component. |
72 | |
73 | Existing component files are not overwritten. If any of the component files |
74 | to be created already exist the file will be written with a '.new' suffix. |
75 | This behavior can be suppressed with the C<-force> option. |
76 | |
77 | =head1 AUTHORS |
78 | |
79 | Catalyst Contributors, see Catalyst.pm |
80 | |
81 | =head1 COPYRIGHT |
82 | |
83 | This library is free software, you can redistribute it and/or modify |
84 | it under the same terms as Perl itself. |
85 | |
86 | =cut |