[2] | 1 | #!/usr/bin/perl -w |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
| 5 | use Getopt::Long; |
---|
| 6 | use Pod::Usage; |
---|
| 7 | use Catalyst::Helper; |
---|
| 8 | |
---|
| 9 | my $force = 0; |
---|
| 10 | my $mech = 0; |
---|
| 11 | my $help = 0; |
---|
| 12 | |
---|
| 13 | GetOptions( |
---|
| 14 | 'nonew|force' => \$force, |
---|
| 15 | 'mech|mechanize' => \$mech, |
---|
| 16 | 'help|?' => \$help |
---|
| 17 | ); |
---|
| 18 | |
---|
| 19 | pod2usage(1) if ( $help || !$ARGV[0] ); |
---|
| 20 | |
---|
| 21 | my $helper = Catalyst::Helper->new( { '.newfiles' => !$force, mech => $mech } ); |
---|
| 22 | |
---|
[242] | 23 | pod2usage(1) unless $helper->mk_component( 'Epoll', @ARGV ); |
---|
[2] | 24 | |
---|
| 25 | 1; |
---|
| 26 | |
---|
| 27 | =head1 NAME |
---|
| 28 | |
---|
[242] | 29 | epoll_create.pl - Create a new Catalyst Component |
---|
[2] | 30 | |
---|
| 31 | =head1 SYNOPSIS |
---|
| 32 | |
---|
[242] | 33 | epoll_create.pl [options] model|view|controller name [helper] [options] |
---|
[2] | 34 | |
---|
| 35 | Options: |
---|
| 36 | -force don't create a .new file where a file to be created exists |
---|
| 37 | -mechanize use Test::WWW::Mechanize::Catalyst for tests if available |
---|
| 38 | -help display this help and exits |
---|
| 39 | |
---|
| 40 | Examples: |
---|
[242] | 41 | epoll_create.pl controller My::Controller |
---|
| 42 | epoll_create.pl -mechanize controller My::Controller |
---|
| 43 | epoll_create.pl view My::View |
---|
| 44 | epoll_create.pl view MyView TT |
---|
| 45 | epoll_create.pl view TT TT |
---|
| 46 | epoll_create.pl model My::Model |
---|
| 47 | epoll_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\ |
---|
[2] | 48 | dbi:SQLite:/tmp/my.db |
---|
[242] | 49 | epoll_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\ |
---|
[2] | 50 | dbi:Pg:dbname=foo root 4321 |
---|
| 51 | |
---|
| 52 | See also: |
---|
| 53 | perldoc Catalyst::Manual |
---|
| 54 | perldoc Catalyst::Manual::Intro |
---|
| 55 | |
---|
| 56 | =head1 DESCRIPTION |
---|
| 57 | |
---|
| 58 | Create a new Catalyst Component. |
---|
| 59 | |
---|
| 60 | Existing component files are not overwritten. If any of the component files |
---|
| 61 | to be created already exist the file will be written with a '.new' suffix. |
---|
| 62 | This behavior can be suppressed with the C<-force> option. |
---|
| 63 | |
---|
| 64 | =head1 AUTHOR |
---|
| 65 | |
---|
| 66 | Sebastian Riedel, C<sri@oook.de> |
---|
| 67 | Maintained by the Catalyst Core Team. |
---|
| 68 | |
---|
| 69 | =head1 COPYRIGHT |
---|
| 70 | |
---|
| 71 | This library is free software, you can redistribute it and/or modify |
---|
| 72 | it under the same terms as Perl itself. |
---|
| 73 | |
---|
| 74 | =cut |
---|