1 package Catalyst::Script::Create;
4 use MooseX::Types::Moose qw/Bool/;
5 use namespace::autoclean;
7 with 'Catalyst::ScriptRole';
9 __PACKAGE__->meta->get_attribute('help')->cmd_aliases('h');
12 traits => [qw(Getopt)],
13 cmd_aliases => 'nonew',
16 documentation => 'Force new scripts',
20 traits => [qw(Getopt)],
24 documentation => 'Force debug mode',
28 traits => [qw(Getopt)],
29 cmd_aliases => 'mech',
32 documentation => 'use WWW::Mechanize',
38 $self->_exit_with_usage if !$ARGV[0];
40 my $helper = Catalyst::Helper->new( { '.newfiles' => !$self->force, mech => $self->mech } );
42 $self->_display_help unless $helper->mk_component( $self->app, @ARGV );
46 __PACKAGE__->meta->make_immutable;
50 Catalyst::Script::Create - Create a new Catalyst Component
54 myapp_create.pl [options] model|view|controller name [helper] [options]
57 -force don't create a .new file where a file to be created exists
58 -mechanize use Test::WWW::Mechanize::Catalyst for tests if available
59 -help display this help and exits
62 myapp_create.pl controller My::Controller
63 myapp_create.pl controller My::Controller BindLex
64 myapp_create.pl -mechanize controller My::Controller
65 myapp_create.pl view My::View
66 myapp_create.pl view MyView TT
67 myapp_create.pl view TT TT
68 myapp_create.pl model My::Model
69 myapp_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
71 myapp_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
72 dbi:Pg:dbname=foo root 4321
75 perldoc Catalyst::Manual
76 perldoc Catalyst::Manual::Intro
80 Create a new Catalyst Component.
82 Existing component files are not overwritten. If any of the component files
83 to be created already exist the file will be written with a '.new' suffix.
84 This behavior can be suppressed with the C<-force> option.
88 Catalyst Contributors, see Catalyst.pm
92 This library is free software, you can redistribute it and/or modify
93 it under the same terms as Perl itself.