Updated Catalyst.pm to preload more modules, needed for sane PAR support
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Helper.pm
index f99887b..f85a88c 100644 (file)
@@ -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;
@@ -989,15 +992,21 @@ use Getopt::Long;
 use Pod::Usage;
 use Catalyst::PAR;
 
+my $engine = 'CGI';
 my $help = 0;
+my $par = '[% appprefix %].par';
 
-GetOptions( 'help|?' => \$help );
+GetOptions(
+    'engine=s' => \$engine,
+    'help|?'   => \$help,
+    'par=s'    => \$par
+);
 
 pod2usage(1) if $help;
 
-my $par = Catalyst::PAR->new->package( {
-    par    => $ARGV[0] || '[% appprefix %].par',
-    engine => $ARGV[1],
+Catalyst::PAR->new->package( {
+    engine => $engine,
+    par    => $par,
     class  => '[% name %]'
 } );
 
@@ -1009,10 +1018,12 @@ my $par = Catalyst::PAR->new->package( {
 
 =head1 SYNOPSIS
 
-[% appprefix %]_package.pl [par] [engine]
+[% appprefix %]_package.pl
 
  Options:
+   -engine   engine to use for dependency detection
    -help     display this help and exits
+   -par      name for the par archive
 
  Examples:
    [% appprefix %]_package.pl [% appprefix %].par FastCGI