Reformatted documentation
[catagits/Catalyst-Runtime.git] / lib / Catalyst / PAR.pm
index f4f9e97..6d7164b 100644 (file)
@@ -22,16 +22,14 @@ Package Catalyst Applications.
 
 =head1 METHODS
 
-=over 4
-
-=item $self->package( $par, $engine )
+=head2 $self->package(\%options)
 
 =cut
 
 sub package {
     my ( $self, $options ) = @_;
 
-    my $par    = $options->{par}    || 'application.par';
+    my $par    = $options->{output} || 'application.par';
     my $engine = $options->{engine} || 'CGI';
 
     # Check for PAR
@@ -64,6 +62,10 @@ sub package {
     my $par_test = File::Spec->catfile( $FindBin::Bin, '..', 'par_test.pl' );
     unlink $par_test;
 
+    my $classes = '';
+    for my $req ( split ',', $options->{classes} ) {
+        $classes .= "require $req;\n";
+    }
     my $version  = $Catalyst::VERSION;
     my $class    = $options->{class};
     my $tmp_file = IO::File->new("> $par_test");
@@ -73,6 +75,7 @@ BEGIN { \$ENV{CATALYST_ENGINE} = '$engine' };
 use lib 'lib';
 require $class;
 import $class;
+$classes
 EOF
     $tmp_file->close;
 
@@ -80,7 +83,15 @@ EOF
     local $SIG{__WARN__} = sub { };
     open my $olderr, '>&STDERR';
     open STDERR, '>', File::Spec->devnull;
-    my %opt = ( 'x' => 1, 'n' => 0, 'o' => $par, 'a' => [@files], 'B' => 1 );
+    my %opt = (
+        'x' => 1,
+        'n' => 0,
+        'o' => $par,
+        'a' => [@files],
+        'p' => 1,
+        'B' => $options->{core},
+        'm' => $options->{multiarch}
+    );
     App::Packer::PAR->new(
         frontend  => 'Module::ScanDeps',
         backend   => 'PAR::Packer',
@@ -93,8 +104,6 @@ EOF
     unlink $par_test;
 }
 
-=back
-
 =head1 AUTHOR
 
 Sebastian Riedel, C<sri@oook.de>