From 4910d7f3f95421a5a2bd147a9cf38929967474a7 Mon Sep 17 00:00:00 2001 From: dakkar Date: Mon, 23 Jan 2006 14:35:57 +0000 Subject: nuovi script per Catalyst 5.63 --- script/bookmarks_create.pl | 20 ++++++++------------ script/bookmarks_fastcgi.pl | 29 +++++++++++++++++++++++------ script/bookmarks_server.pl | 14 ++++++++++---- script/bookmarks_test.pl | 6 ++---- 4 files changed, 43 insertions(+), 26 deletions(-) diff --git a/script/bookmarks_create.pl b/script/bookmarks_create.pl index 17cba1c..1dd7716 100755 --- a/script/bookmarks_create.pl +++ b/script/bookmarks_create.pl @@ -5,20 +5,17 @@ use Getopt::Long; use Pod::Usage; use Catalyst::Helper; -my $help = 0; -my $nonew = 0; -my $short = 0; +my $force = 0; +my $help = 0; GetOptions( - 'help|?' => \$help, - 'nonew' => \$nonew, - 'short' => \$short + 'nonew|force' => \$force, + 'help|?' => \$help ); pod2usage(1) if ( $help || !$ARGV[0] ); -my $helper = - Catalyst::Helper->new( { '.newfiles' => !$nonew, short => $short } ); +my $helper = Catalyst::Helper->new( { '.newfiles' => !$force } ); pod2usage(1) unless $helper->mk_component( 'Bookmarks', @ARGV ); @@ -33,9 +30,8 @@ bookmarks_create.pl - Create a new Catalyst Component bookmarks_create.pl [options] model|view|controller name [helper] [options] Options: + -force don't create a .new file where a file to be created exists -help display this help and exits - -nonew don't create a .new file where a file to be created exists - -short use short types, like C instead of Controller... Examples: bookmarks_create.pl controller My::Controller @@ -56,11 +52,11 @@ Create a new Catalyst Component. Existing component files are not overwritten. If any of the component files to be created already exist the file will be written with a '.new' suffix. -This behavior can be suppressed with the C<-nonew> option. +This behavior can be suppressed with the C<-force> option. =head1 AUTHOR -Sebastian Riedel, C +Sebastian Riedel, C =head1 COPYRIGHT diff --git a/script/bookmarks_fastcgi.pl b/script/bookmarks_fastcgi.pl index 546d552..77748fd 100755 --- a/script/bookmarks_fastcgi.pl +++ b/script/bookmarks_fastcgi.pl @@ -10,17 +10,27 @@ use lib "$FindBin::Bin/../lib"; use Bookmarks; my $help = 0; -my ( $listen, $nproc ); +my ( $listen, $nproc, $pidfile, $manager, $detach ); GetOptions( - 'help|?' => \$help, - 'listen|l=s' => \$listen, - 'nproc|n=i' => \$nproc, + 'help|?' => \$help, + 'listen|l=s' => \$listen, + 'nproc|n=i' => \$nproc, + 'pidfile|p=s' => \$pidfile, + 'manager|M=s' => \$manager, + 'daemon|d' => \$detach, ); pod2usage(1) if $help; -Bookmarks->run( $listen, { nproc => $nproc } ); +Bookmarks->run( + $listen, + { nproc => $nproc, + pidfile => $pidfile, + manager => $manager, + detach => $detach, + } +); 1; @@ -39,7 +49,14 @@ bookmarks_fastcgi.pl [options] can be HOST:PORT, :PORT or a filesystem path -n -nproc specify number of processes to keep - to serve requests (defaults to 1) + to serve requests (defaults to 1, + requires -listen) + -p -pidfile specify filename for pid file + (requires -listen) + -d -daemon daemonize (requires -listen) + -M -manager specify alternate process manager + (FCGI::ProcManager sub-class) + or empty string to disable =head1 DESCRIPTION diff --git a/script/bookmarks_server.pl b/script/bookmarks_server.pl index 1cc1e3c..adf777a 100755 --- a/script/bookmarks_server.pl +++ b/script/bookmarks_server.pl @@ -2,7 +2,7 @@ BEGIN { $ENV{CATALYST_ENGINE} ||= 'HTTP'; - $ENV{CATALYST_SCRIPT_GEN} = 11; + $ENV{CATALYST_SCRIPT_GEN} = 25; } use strict; @@ -16,6 +16,7 @@ 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$'; @@ -28,6 +29,7 @@ GetOptions( 'help|?' => \$help, 'host=s' => \$host, 'port=s' => \$port, + 'keepalive|k' => \$keepalive, 'restart|r' => \$restart, 'restartdelay|rd=s' => \$restart_delay, 'restartregex|rr=s' => \$restart_regex @@ -42,12 +44,15 @@ if ( $debug ) { $ENV{CATALYST_DEBUG} = 1; } +# This is require instead of use so that the above environment +# variables can be set at runtime. require Bookmarks; Bookmarks->run( $port, $host, { - argv => \@argv, - 'fork' => $fork, - restart => $restart, + argv => \@argv, + 'fork' => $fork, + keepalive => $keepalive, + restart => $restart, restart_delay => $restart_delay, restart_regex => qr/$restart_regex/ } ); @@ -69,6 +74,7 @@ bookmarks_server.pl [options] -? -help display this help and exits -host host (defaults to all) -p -port port (defaults to 3000) + -k -keepalive enable keep-alive connections -r -restart restart when files got modified (defaults to false) -rd -restartdelay delay between file checks diff --git a/script/bookmarks_test.pl b/script/bookmarks_test.pl index d692744..20305c4 100755 --- a/script/bookmarks_test.pl +++ b/script/bookmarks_test.pl @@ -1,13 +1,11 @@ #!/usr/bin/perl -w -BEGIN { $ENV{CATALYST_ENGINE} ||= 'Test' } - use strict; use Getopt::Long; use Pod::Usage; use FindBin; use lib "$FindBin::Bin/../lib"; -use Bookmarks; +use Catalyst::Test 'Bookmarks'; my $help = 0; @@ -15,7 +13,7 @@ GetOptions( 'help|?' => \$help ); pod2usage(1) if ( $help || !$ARGV[0] ); -print Bookmarks->run($ARGV[0])->content . "\n"; +print request($ARGV[0])->content . "\n"; 1; -- cgit v1.2.3