X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FHelper.pm;h=b6b06759ab8014d8ef3d21c95285435c8933b7bf;hb=1a622f5ed9c276446168d7e8b50ed1b329b5c7ea;hp=74fe38c0d61c2297f61ca3f473f83c3aa12022dd;hpb=3736410fe6b86ea7cda39b23625a47a8a946af0e;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Helper.pm b/lib/Catalyst/Helper.pm index 74fe38c..b6b0675 100644 --- a/lib/Catalyst/Helper.pm +++ b/lib/Catalyst/Helper.pm @@ -501,7 +501,7 @@ So when you call C, create would try to execute Catalyst::Helper::View::TT->mk_compclass and Catalyst::Helper::View::TT->mk_comptest. -See L and L for +See L and L for examples. All helper classes should be under one of the following namespaces. @@ -544,14 +544,21 @@ use warnings; # Set flags and add plugins for the application # # -Debug: activates the debug mode for very useful log messages +# ConfigLoader: will load the configuration from a YAML file in the +# application's home directory # Static::Simple: will serve static files from the application's root -# directory +# directory # use Catalyst qw/-Debug ConfigLoader Static::Simple/; our $VERSION = '0.01'; # +# Configure the application +# +__PACKAGE__->config( name => '[% name %]' ); + +# # Start the application # __PACKAGE__->setup; @@ -837,28 +844,30 @@ use Pod::Usage; use FindBin; use lib "$FindBin::Bin/../lib"; -my $debug = 0; -my $fork = 0; -my $help = 0; -my $host = undef; -my $port = 3000; -my $keepalive = 0; -my $restart = 0; -my $restart_delay = 1; -my $restart_regex = '\.yml$|\.yaml$|\.pm$'; +my $debug = 0; +my $fork = 0; +my $help = 0; +my $host = undef; +my $port = 3000; +my $keepalive = 0; +my $restart = 0; +my $restart_delay = 1; +my $restart_regex = '\.yml$|\.yaml$|\.pm$'; +my $restart_directory = undef; my @argv = @ARGV; GetOptions( - 'debug|d' => \$debug, - 'fork' => \$fork, - 'help|?' => \$help, - 'host=s' => \$host, - 'port=s' => \$port, - 'keepalive|k' => \$keepalive, - 'restart|r' => \$restart, - 'restartdelay|rd=s' => \$restart_delay, - 'restartregex|rr=s' => \$restart_regex + 'debug|d' => \$debug, + 'fork' => \$fork, + 'help|?' => \$help, + 'host=s' => \$host, + 'port=s' => \$port, + 'keepalive|k' => \$keepalive, + 'restart|r' => \$restart, + 'restartdelay|rd=s' => \$restart_delay, + 'restartregex|rr=s' => \$restart_regex, + 'restartdirectory=s' => \$restart_directory, ); pod2usage(1) if $help; @@ -875,12 +884,13 @@ if ( $debug ) { require [% name %]; [% name %]->run( $port, $host, { - argv => \@argv, - 'fork' => $fork, - keepalive => $keepalive, - restart => $restart, - restart_delay => $restart_delay, - restart_regex => qr/$restart_regex/ + argv => \@argv, + 'fork' => $fork, + keepalive => $keepalive, + restart => $restart, + restart_delay => $restart_delay, + restart_regex => qr/$restart_regex/, + restart_directory => $restart_directory, } ); 1; @@ -907,6 +917,9 @@ require [% name %]; -rr -restartregex regex match files that trigger a restart when modified (defaults to '\.yml$|\.yaml$|\.pm$') + -restartdirectory the directory to search for + modified files + (defaults to '../') See also: perldoc Catalyst::Manual @@ -1029,8 +1042,8 @@ pod2usage(1) unless $helper->mk_component( '[% name %]', @ARGV ); [% appprefix %]_create.pl view MyView TT [% appprefix %]_create.pl view TT TT [% appprefix %]_create.pl model My::Model - [% appprefix %]_create.pl model SomeDB CDBI dbi:SQLite:/tmp/my.db - [% appprefix %]_create.pl model AnotherDB CDBI dbi:Pg:dbname=foo root 4321 + [% appprefix %]_create.pl model SomeDB DBIC::SchemaLoader dbi:SQLite:/tmp/my.db + [% appprefix %]_create.pl model AnotherDB DBIC::SchemaLoader dbi:Pg:dbname=foo root 4321 See also: perldoc Catalyst::Manual @@ -1109,8 +1122,7 @@ it under the same terms as Perl itself. __comptest__ use strict; use warnings; -[% IF long_type == 'Controller' %][% IF mech %]our $test_count; -use Test::More; +[% IF long_type == 'Controller' %][% IF mech %]use Test::More; eval "use Test::WWW::Mechanize::Catalyst '[% app %]'"; plan $@