# Needs to be here for PAR
require Catalyst;
- if ( $name =~ /[^\w\:]/ ) {
+ if ( $name =~ /[^\w:]/ || $name =~ /^\d/ || $name =~ /\b:\b|:{3,}/) {
warn "Error: Invalid application name.\n";
return 0;
}
$self->{script } = File::Spec->catdir( $self->{dir}, 'script' );
$self->{appprefix } = Catalyst::Utils::appprefix($name);
$self->{appenv } = Catalyst::Utils::class2env($name);
- $self->{startperl } = -r '/usr/bin/env'
- ? '#!/usr/bin/env perl'
+ $self->{startperl } = -r '/usr/bin/env'
+ ? '#!/usr/bin/env perl'
: "#!$Config{perlpath} -w";
$self->{scriptgen } = $Catalyst::Devel::CATALYST_SCRIPT_GEN || 4;
$self->{catalyst_version} = $Catalyst::VERSION;
Catalyst::Helper::View::
Catalyst::Helper::Controller::
-=head2 COMMON HELPERS
+=head2 COMMON HELPERS
=over
=head3 NOTE
-The helpers will read author name from /etc/passwd by default. + To override, please export the AUTHOR variable.
+The helpers will read author name from /etc/passwd by default. + To override, please export the AUTHOR variable.
=head1 METHODS
use strict;
use warnings;
-use Catalyst::Runtime '5.70';
+use Catalyst::Runtime 5.80;
# Set flags and add plugins for the application
#
1;
__makefile__
+[% startperl %]
# IMPORTANT: if you delete this file your app will not work as
-# expected. you have been warned
+# expected. You have been warned.
use inc::Module::Install;
name '[% dir %]';
auto_install;
WriteAll;
__config__
-# rename this file to [% name %].yml and put a : in front of "name" if
-# you want to use yaml like in old versions of Catalyst
+# rename this file to [% name %].yml and put a ':' in front of 'name' if
+# you want to use YAML like in old versions of Catalyst
name [% name %]
__readme__
Run script/[% appprefix %]_server.pl to test the application.
0.01 [% time %]
- initial revision, generated by Catalyst
__apptest__
+[% startperl %]
use strict;
use warnings;
use Test::More tests => 2;
ok( request('/')->is_success, 'Request should succeed' );
__podtest__
+[% startperl %]
use strict;
use warnings;
use Test::More;
all_pod_files_ok();
__podcoveragetest__
+[% startperl %]
use strict;
use warnings;
use Test::More;
pidfile => $pidfile,
manager => $manager,
detach => $detach,
- keep_stderr => $keep_stderr,
+ keep_stderr => $keep_stderr,
}
);
my $keepalive = 0;
my $restart = $ENV{[% appenv %]_RELOAD} || $ENV{CATALYST_RELOAD} || 0;
my $background = 0;
+my $pidfile = undef;
my $check_interval;
my $file_regex;
'fork|f' => \$fork,
'help|?' => \$help,
'host=s' => \$host,
- 'port=s' => \$port,
+ 'port|p=s' => \$port,
'keepalive|k' => \$keepalive,
'restart|r' => \$restart,
'restartdelay|rd=s' => \$check_interval,
'restartdirectory=s@' => \$watch_directory,
'followsymlinks' => \$follow_symlinks,
'background' => \$background,
+ 'pidfile=s' => \$pidfile,
);
pod2usage(1) if $help;
'fork' => $fork,
keepalive => $keepalive,
background => $background,
+ pidfile => $pidfile,
}
);
};
if ( $restart ) {
- require Catalyst::Restarter;
-
die "Cannot run in the background and also watch for changed files.\n"
if $background;
+ require Catalyst::Restarter;
+
+ my $subclass = Catalyst::Restarter->pick_subclass;
+
my %args;
$args{follow_symlinks} = 1
if $follow_symlinks;
$args{filter} = qr/$file_regex/
if defined $file_regex;
- my $restarter = Catalyst::Restarter->new(
+ my $restarter = $subclass->new(
%args,
- restart_sub => $runner,
+ start_sub => $runner,
+ argv => \@argv,
);
$restarter->run_and_watch;
-follow_symlinks follow symlinks in search directories
(defaults to false. this is a no-op on Win32)
-background run the process in the background
+ -pidfile specify filename for pid file
+
See also:
perldoc Catalyst::Manual
perldoc Catalyst::Manual::Intro