From: Sebastian Riedel Date: Thu, 17 Nov 2005 04:36:00 +0000 (+0000) Subject: Updated Catalyst.pm to preload more modules, needed for sane PAR support X-Git-Tag: 5.7099_04~897 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=6f409682667c23a00552d0573c157ee3487c29bc;hp=255b19ac18c639bc8e5b79d711f6e68c4f77b116 Updated Catalyst.pm to preload more modules, needed for sane PAR support --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index d2235de..5a4ad73 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -18,6 +18,19 @@ use URI; use Scalar::Util qw/weaken/; use attributes; +# For PAR +require Catalyst::Helper; +require Catalyst::PAR; +require Catalyst::Build; + +require Catalyst::Engine::HTTP; +require Catalyst::Engine::CGI; +require Catalyst::Engine::FastCGI; + +require Catalyst::Controller; +require Catalyst::Model; +require Catalyst::View; + __PACKAGE__->mk_accessors( qw/counter request response state action stack namespace/ ); diff --git a/lib/Catalyst/Engine/FastCGI.pm b/lib/Catalyst/Engine/FastCGI.pm index 1697558..2eb34cd 100644 --- a/lib/Catalyst/Engine/FastCGI.pm +++ b/lib/Catalyst/Engine/FastCGI.pm @@ -2,7 +2,8 @@ package Catalyst::Engine::FastCGI; use strict; use base 'Catalyst::Engine::CGI'; -use FCGI; +eval "use FCGI"; +die "Please install FCGI\n" if $@; =head1 NAME @@ -62,7 +63,7 @@ sub run { } $options ||= {}; - + my %env; my $request = @@ -71,18 +72,18 @@ sub run { ); my $proc_manager; - - if ( $listen ) { + + if ($listen) { require FCGI::ProcManager; $options->{nproc} ||= 1; - - $proc_manager - = FCGI::ProcManager->new( { n_processes => $options->{nproc} } ); - + + $proc_manager = + FCGI::ProcManager->new( { n_processes => $options->{nproc} } ); + if ( $options->{pidfile} ) { $proc_manager->pm_write_pid_file( $options->{pidfile} ); } - + $proc_manager->pm_manage(); } diff --git a/lib/Catalyst/Helper.pm b/lib/Catalyst/Helper.pm index 51039ca..f85a88c 100644 --- a/lib/Catalyst/Helper.pm +++ b/lib/Catalyst/Helper.pm @@ -7,7 +7,6 @@ use File::Path; use IO::File; use FindBin; use Template; -use Catalyst; use Catalyst::Utils; use Catalyst::Exception; @@ -57,6 +56,10 @@ Create the main application skeleton. sub mk_app { my ( $self, $name ) = @_; + + # Needs to be here for PAR + require Catalyst; + return 0 if $name =~ /[^\w\:]/; $self->{name} = $name; $self->{dir} = $name;