[Catalyst-commits] r10515 - Catalyst-Devel/1.00/branches/par_options/lib/Module/Install

kmx at dev.catalyst.perl.org kmx at dev.catalyst.perl.org
Fri Jun 12 06:30:10 GMT 2009


Author: kmx
Date: 2009-06-12 06:30:09 +0000 (Fri, 12 Jun 2009)
New Revision: 10515

Modified:
   Catalyst-Devel/1.00/branches/par_options/lib/Module/Install/Catalyst.pm
Log:
C::Devel - branche catalyst_par_options (changed default behaviour)

Modified: Catalyst-Devel/1.00/branches/par_options/lib/Module/Install/Catalyst.pm
===================================================================
--- Catalyst-Devel/1.00/branches/par_options/lib/Module/Install/Catalyst.pm	2009-06-12 00:58:04 UTC (rev 10514)
+++ Catalyst-Devel/1.00/branches/par_options/lib/Module/Install/Catalyst.pm	2009-06-12 06:30:09 UTC (rev 10515)
@@ -10,7 +10,7 @@
 use FindBin;
 use File::Copy::Recursive 'rcopy';
 use File::Spec ();
-use Getopt::Long;
+use Getopt::Long qw(GetOptionsFromString :config no_ignore_case);
 use Data::Dumper;
 
 my $SAFETY = 0;
@@ -172,19 +172,21 @@
 
     # part of your Makefile.PL
     
-    catalyst_par_options("-v -f Bleach -z 9");
+    catalyst_par_options("--verbose=2 -f Bleach -z 9");
     # verbose mode; use filter 'Bleach'; zip with compression level 9
     catalyst;
 
 Note1: There is no reason to use catalyst_par_options() command multiple times
 as you can spacify in "$optstring" as many options as you want. Still, it
-is supported to call catalyst_par_options(...) more than once - in that case the
-specified options are merged (however it does merge arrays with values specified
-by parameters -a -A -X -f -F -I -l -M).
+is supported to call catalyst_par_options() more than once. In that case the
+specified options are merged (collisions are handled on principle "later wins"). 
+BEWARE: you are discouraged from using parameters -a -A -X -f -F -I -l -M in
+multiple catalyst_par_options() as they are not merged but replaced as you would 
+expected.
 
-Note2: By default the options "-x=1 -p=1 -n=0 -o=<appname>.par" are set. You can
-override them by catalyst_par_options(); however B<don't change them> unless you 
-exactly know what you are doing.
+Note2: By default the options "-x -p -o=<appname>.par" are set and option "-n" 
+is unset. This default always overrides whatever you specify by
+catalyst_par_options().
 
 =cut
 
@@ -196,8 +198,7 @@
         warn "WARNING: catalyst_par_options ignored - you need PAR::Packer\n"
     }
     else {
-        Getopt::Long::Configure ("no_ignore_case");
-        Getopt::Long::GetOptionsFromString($optstring, \%o, PAR::Packer->options);
+        GetOptionsFromString($optstring, \%o, PAR::Packer->options);
         %PAROPTS = ( %PAROPTS, %o);
     }	 
 }
@@ -340,12 +341,12 @@
     open my $olderr, '>&STDERR';
     open STDERR, '>', File::Spec->devnull;
     my %opt = (
+        %{$PAROPTS},
+        # take user defined options first and override them with harcoded defaults
         'x' => 1,
         'n' => 0,
         'o' => $par,
         'p' => 1,
-        %{$PAROPTS},
-        # user defined options override the harcoded defaults
     );
     # do not replace the whole $opt{'a'} array; just push required default value
     push @{$opt{'a'}}, grep( !/par.pl/, glob '.' );  




More information about the Catalyst-commits mailing list