develooper Front page | perl.perl5.porters | Postings from April 2003

More elegant perl core detection [Was: Re: Encode-1.92 was not marged right]

Thread Next
From:
Dan Kogai
Date:
April 22, 2003 07:49
Subject:
More elegant perl core detection [Was: Re: Encode-1.92 was not marged right]
Message ID:
24F65BC4-74D0-11D7-BA98-000393AE4244@dan.co.jp
On Tuesday, April 22, 2003, at 08:57  PM, Jarkko Hietaniemi wrote:
> The 1.92 still has the miniperl trick:
>
> -    $ENV{PERL_CORE} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV;
> +    $ENV{PERL_CORE} = 1 if ($^X =~ m{\bminiperl[^/\\\]>:]*$}o);

Thanks.  I will use slightly more elaborate version instead, however.  
See the first chunk.  This works all cases for PERL_CORE=1, PERL_CORE 
(no =), and PERL_CORE=0.

Dan the Encode Maintainer

===================================================================
RCS file: Makefile.PL,v
retrieving revision 1.29
diff -u -r1.29 Makefile.PL
--- Makefile.PL 2002/05/28 18:33:15     1.29
+++ Makefile.PL 2003/04/22 14:34:19
@@ -2,9 +2,9 @@
  use ExtUtils::MakeMaker;

  # Just for sure :)
-unless($ENV{PERL_CORE}) {
-    $ENV{PERL_CORE} = 1 if ($^X =~ m{\bminiperl[^/\\\]>:]*$}o);
-}
+my %ARGV = map { split /=/; defined $_[1] or $_[1]=1; @_ } @ARGV;
+$ARGV{DEBUG} and warn "$_ => $ARGV{$_}\n" for keys  %ARGV;
+$ENV{PERL_CORE} ||= $ARGV{PERL_CORE};

  my %tables =
      (
@@ -22,14 +22,9 @@
                         unidump
                         );
  my @pmlibdirs = qw(lib Encode);
-for my $arg (@ARGV){
-    if ($arg eq "MORE_SCRIPTS"){
-       push @exe_files, @more_exe_files;
-    }
-    if ($arg eq "INSTALL_UCM"){
-       push @pmlibdirs, "ucm";
-    }
-}
+
+$ARGV{MORE_SCRIOPTS} and push @exe_files, @more_exe_files;
+$ARGV{INSTALL_UCM}   and push @pmlibdirs, "ucm";

  WriteMakefile(
               NAME              => "Encode",


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About