Improved PAR support
Sebastian Riedel [Wed, 23 Nov 2005 01:35:14 +0000 (01:35 +0000)]
Changes
lib/Module/Install/Catalyst.pm

diff --git a/Changes b/Changes
index c38e4b1..0502811 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 This file documents the revision history for Perl extension Catalyst.
 
 5.58
+        - Improved PAR support
         - Replaced -short with auto-detection
         - Fixed prereqs, added File::Copy::Recursive
 
index f814b79..22efcda 100644 (file)
@@ -169,15 +169,16 @@ sub _catalyst_par {
     my $version = $Catalyst::VERSION;
     my $class   = $self->name;
 
+    my $script_file    = IO::File->new("< $script");
+    my $script_content = do { local $/; <$script_file> };
+
     my $classes = '';
     $classes .= "    require $_;\n" for @Catalyst::Module::Install::CLASSES;
-    my $tmp_file = IO::File->new(" > $par_pl ");
+    my $tmp_file = IO::File->new("> $par_pl ");
     print $tmp_file <<"EOF";
 require lib;
 if (\$0 !~ /par.pl\.\\w+\$/) {
-    import lib '../lib';
-    require FindBin;
-    require "\$FindBin::Bin/script/$script";
+$script_content
 }
 else {
     import lib 'lib';