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