updated script templates to reflect new -Runtime scripts
Devin Austin [Thu, 25 Jun 2009 10:44:03 +0000 (10:44 +0000)]
share/script/myapp_cgi.pl.tt
share/script/myapp_fastcgi.pl.tt
share/script/myapp_server.pl.tt
share/script/myapp_test.pl.tt

index e68ffa4..a4bba44 100644 (file)
@@ -1,14 +1,7 @@
 [% startperl %]
 
-BEGIN { $ENV{CATALYST_ENGINE} ||= 'CGI' }
-
-use strict;
-use warnings;
-use FindBin;
-use lib "$FindBin::Bin/../lib";
-use [% name %];
-
-[% name %]->run;
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Catalyst','CGI');
 
 1;
 
index 7c2218f..a12f9ac 100644 (file)
@@ -1,39 +1,7 @@
 [% startperl %]
 
-BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' }
-
-use strict;
-use warnings;
-use Getopt::Long;
-use Pod::Usage;
-use FindBin;
-use lib "$FindBin::Bin/../lib";
-use [% name %];
-
-my $help = 0;
-my ( $listen, $nproc, $pidfile, $manager, $detach, $keep_stderr );
-
-GetOptions(
-    'help|?'      => \$help,
-    'listen|l=s'  => \$listen,
-    'nproc|n=i'   => \$nproc,
-    'pidfile|p=s' => \$pidfile,
-    'manager|M=s' => \$manager,
-    'daemon|d'    => \$detach,
-    'keeperr|e'   => \$keep_stderr,
-);
-
-pod2usage(1) if $help;
-
-[% name %]->run(
-    $listen,
-    {   nproc   => $nproc,
-        pidfile => $pidfile,
-        manager => $manager,
-        detach  => $detach,
-        keep_stderr => $keep_stderr,
-    }
-);
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Catalyst','FastCGI');
 
 1;
 
index e9e0b3f..f51d48d 100644 (file)
@@ -24,68 +24,11 @@ sub run {
     );
 }
 
-__PACKAGE__->new_with_options->run;
-
-
-pod2usage(1) if $help;
-
-if ( $debug ) {
-    $ENV{CATALYST_DEBUG} = 1;
-}
 
-# If we load this here, then in the case of a restarter, it does not
-# need to be reloaded for each restart.
-require Catalyst;
 
-# If this isn't done, then the Catalyst::Devel tests for the restarter
-# fail.
-$| = 1 if $ENV{HARNESS_ACTIVE};
-
-my $runner = sub {
-    # This is require instead of use so that the above environment
-    # variables can be set at runtime.
-    require [% name %];
-
-    [% name %]->run(
-        $port, $host,
-        {
-            argv       => \@argv,
-            'fork'     => $fork,
-            keepalive  => $keepalive,
-            background => $background,
-            pidfile    => $pidfile,
-        }
-    );
-};
-
-if ( $restart ) {
-    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{directories} = $watch_directory
-        if defined $watch_directory;
-    $args{sleep_interval} = $check_interval
-        if defined $check_interval;
-    $args{filter} = qr/$file_regex/
-        if defined $file_regex;
+__PACKAGE__->new_with_options->run;
 
-    my $restarter = $subclass->new(
-        %args,
-        start_sub => $runner,
-    );
 
-    $restarter->run_and_watch;
-}
-else {
-    $runner->();
-}
 
 1;
 
index e5cd5e0..8a26322 100644 (file)
@@ -1,23 +1,11 @@
 [% startperl %]
 
-use strict;
-use warnings;
-use Getopt::Long;
-use Pod::Usage;
-use FindBin;
-use lib "$FindBin::Bin/../lib";
-use Catalyst::Test '[% name %]';
-
-my $help = 0;
-
-GetOptions( 'help|?' => \$help );
-
-pod2usage(1) if ( $help || !$ARGV[0] );
-
-print request($ARGV[0])->content . "\n";
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Catalyst','Test');
 
 1;
 
+
 =head1 NAME
 
 [% appprefix %]_test.pl - Catalyst Test