hi folks.

I went to makemaker.org looking for some simple example uses
of MM usage, and found this:

If you have a question you'd like to see added to the FAQ (whether or not you have the answer) please send it to [EMAIL PROTECTED]

so I hope the newsgroup is the same grp; Ill start with a couple Qs that are probably answered by a couple 1 liners:

These are guesses - as im sure will be obvious

Q: HOW DO YOU SUPPRESS MANPAGE INSTALL ?

    # at mod-config time
    perl Makefile.PL INSTALLMANDIR=
    # or at mod-install time
    make install INSTALLMANDIR=

Q: HOW DO YOU SUPPRESS POD INSTALL ?

# why ? cuz youve got multiple perls, and dont need all the pod.

perl Makefile.PL MAN3PODS='{}'


So, now the real question:


Q. How do I load an uninstalled (ie patched, and testing) XS
module for use in testing another uninstalled (also patched) XS module ?


Background: Ive worked up 2 patches to B::Generate and optimizer, and am trying to test them. Ive got a regression script that untars the CPAN tarball, applies the patch, then runs make.

for the B::Generate patch, Im provisionally satisfied - it passes its test on 5.6.2 580 581 582 590. But Id like to test optimizer against my version without installing it everywhere (not a big deal, but Im hoping to learn something along the way)

patches and regression attached. Please indulge me and try them, reply off-list if you prefer. youll have to pull the modules yourself from CPAN.

Only in B-Generate-1.06-mod/: Build
diff -ru B-Generate-1.06/Build.PL B-Generate-1.06-mod/Build.PL
--- B-Generate-1.06/Build.PL    Tue Jun 18 21:14:58 2002
+++ B-Generate-1.06-mod/Build.PL        Fri Nov  7 21:25:24 2003
@@ -16,12 +16,18 @@
      }
      );
      
+my %newTweaks;
+if ($] >= 5.008) {
+    %newTweaks = (extra_compiler_flags => '-DPERL_CUSTOM_OPS');
+}
 
 my $build = $class->new
     (
+     %newTweaks,
      module_name => 'B::Generate',
      license => 'unknown',
      dynamic_config => 0,
+     requires => { perl => '5.5.62' },
      );
 $build->create_build_script;
 
Only in B-Generate-1.06-mod/: Build.PL.orig
Only in B-Generate-1.06-mod/: Build.PL.rej
Only in B-Generate-1.06-mod/: Build.PL~
Only in B-Generate-1.06-mod/: _build
Only in B-Generate-1.06-mod/: blib
Only in B-Generate-1.06-mod/lib/B: Generate.bs
Only in B-Generate-1.06-mod/lib/B: Generate.c
Only in B-Generate-1.06-mod/lib/B: Generate.o
diff -ru B-Generate-1.06/lib/B/Generate.pm B-Generate-1.06-mod/lib/B/Generate.pm
--- B-Generate-1.06/lib/B/Generate.pm   Tue Jul  2 06:39:09 2002
+++ B-Generate-1.06-mod/lib/B/Generate.pm       Fri Nov  7 21:18:56 2003
@@ -9,11 +9,16 @@
 
 our @ISA = qw(DynaLoader);
 
-our $VERSION = '1.06';
+our $VERSION = '1.07_01';
 
 {
-no warnings;
-bootstrap B::Generate $VERSION;
+    # no warnings; # doesnt work.
+    # this does: L<perlfunc/Alphabetical Listing of Perl Functions/warn>
+    local $SIG{__WARN__} = sub {
+       return if $_[0] =~ /Subroutine B(::\w+)+ redefined/;
+       warn $_[0];
+    };
+    bootstrap B::Generate $VERSION;
 }
 
 use constant OP_LIST => 141; # MUST FIX CONSTANTS.
Only in B-Generate-1.06-mod/lib/B: Generate.pm~
diff -ru B-Generate-1.06/lib/B/Generate.xs B-Generate-1.06-mod/lib/B/Generate.xs
--- B-Generate-1.06/lib/B/Generate.xs   Sun Jul 28 10:45:48 2002
+++ B-Generate-1.06-mod/lib/B/Generate.xs       Fri Nov  7 21:18:56 2003
@@ -193,7 +193,11 @@
     sv_setiv(newSVrv(arg, type), iv);
     return arg;
 }
-#define PERL_CUSTOM_OPS
+
+/* 
+   #define PERL_CUSTOM_OPS
+   now defined by Build.PL, if building for 5.8.x
+ */
 static I32
 op_name_to_num(SV * name)
 {
@@ -460,7 +464,7 @@
 OP_find_cv(o)
        B::OP   o
     CODE:
-       RETVAL = SvRV(find_cv_by_root((OP*)o));
+       RETVAL = (CV*) SvRV(find_cv_by_root((OP*)o));
     OUTPUT:
        RETVAL
 
@@ -641,8 +645,8 @@
 
         o = CALL_FPTR(PL_check[type])(aTHX_ (OP*)o);
 
-        if (o->op_type == type)
-            o = fold_constants(o);
+       if (o->op_type == type)
+            o = (OP*) Perl_fold_constants(aTHX_ o);
 
     OUTPUT:
         o
Only in B-Generate-1.06-mod/lib/B: Generate.xs~
diff -ru B-Generate-1.06/test.pl B-Generate-1.06-mod/test.pl
--- B-Generate-1.06/test.pl     Sun Jul 28 10:49:27 2002
+++ B-Generate-1.06-mod/test.pl Fri Nov  7 21:18:56 2003
@@ -26,7 +26,7 @@
     my $i = 0;
     for(
         $x = B::main_start;
-        B::opnumber("const") != $x->type || $x->sv->sv != 30;
+        B::opnumber("const") ne $x->type || $x->sv->sv ne 30;
         $x=$x->next){}
     $x->sv(13);
 
@@ -34,7 +34,7 @@
        $x = svref_2object($foo)->START;
        ref($x) ne 'B::NULL';
        $x = $x->next) {
-       next unless($x->can(sv));
+       next unless($x->can('sv'));
        if($x->sv->PV eq "not ok 5\n") {
            $x->sv("ok 5\n");
            last;
@@ -45,7 +45,7 @@
        $x = svref_2object(\&foo::baz)->START;
        ref($x) ne 'B::NULL';
        $x = $x->next) {
-       next unless($x->can(sv));
+       next unless($x->can('sv'));
        if($x->sv->PV eq "not ok 6\n") {
            $x->sv("ok 6\n");
            last;
@@ -59,7 +59,7 @@
 $a = 17; $b = 15; print "ok ", $a + $b, "\n";
 $c = 30; $d = 10; print "ok ", $c - $d, "\n";
 
-my $newop = B::BINOP->new("add", 0, undef, undef); # This used to segv
+my $newop = B::BINOP->new("add", 0, 0, 0); # undef, undef); # This used to segv
 print "ok 4\n";
 BEGIN {
 $foo = sub {
diff -ru optimizer-0.05/Makefile.PL optimizer-0.05-mod/Makefile.PL
--- optimizer-0.05/Makefile.PL  Mon Dec 30 01:59:51 2002
+++ optimizer-0.05-mod/Makefile.PL      Thu Jul 17 17:06:44 2003
@@ -5,7 +5,7 @@
 WriteMakefile(
     'NAME'             => 'optimizer',
     'VERSION_FROM'     => 'optimizer.pm', # finds $VERSION
-    'PREREQ_PM'                => {}, # e.g., Module::Name => 1.1
+    'PREREQ_PM'                => { B::Generate => 0 }, # e.g., Module::Name => 1.1
     ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
       (ABSTRACT_FROM => 'optimizer.pm', # retrieve abstract from module
        AUTHOR     => 'Arthur Bergman <[EMAIL PROTECTED]>') : ()),
Only in optimizer-0.05-mod/: Makefile.old
diff -ru optimizer-0.05/optimizer.xs optimizer-0.05-mod/optimizer.xs
--- optimizer-0.05/optimizer.xs Mon Dec 30 01:44:45 2002
+++ optimizer-0.05-mod/optimizer.xs     Thu Jul 17 17:29:45 2003
@@ -10,6 +10,11 @@
 #define PL_opargs (get_opargs())
 #endif
 
+#undef save_op
+#define save_op() Perl_save_op(aTHX)
+#undef pad_alloc
+#define pad_alloc(o,s) Perl_pad_alloc(aTHX_ o,s)
+
 typedef enum { OPc_NULL, OPc_BASEOP, OPc_UNOP, OPc_BINOP, OPc_LOGOP, OPc_LISTOP, 
     OPc_PMOP, OPc_SVOP, OPc_PADOP, OPc_PVOP, OPc_CVOP, OPc_LOOP, OPc_COP } opclass;
 
@@ -162,7 +167,8 @@
 STATIC void
 no_bareword_allowed(pTHX_ OP *o)
 {
-    qerror(Perl_mess(aTHX_
+    Perl_qerror(aTHX_ 
+               Perl_mess(aTHX_
                     "Bareword \"%s\" not allowed while \"strict subs\" in use",
                     SvPV_nolen(cSVOPo_sv)));
 }
@@ -446,8 +452,13 @@
            sv = newSViv(ind);
            if (SvREADONLY(*svp))
                SvREADONLY_on(sv);
+#      if PERL_VERSION > 8
+           SvFLAGS(sv) |= (SvFLAGS(*svp)
+                           & (SVs_PADSTALE|SVs_PADTMP|SVs_PADMY));
+#      else
            SvFLAGS(sv) |= (SvFLAGS(*svp)
                            & (SVs_PADBUSY|SVs_PADTMP|SVs_PADMY));
+#      endif
            SvREFCNT_dec(*svp);
            *svp = sv;
            break;
@@ -509,8 +520,13 @@
                sv = newSViv(ind);
                if (SvREADONLY(*svp))
                    SvREADONLY_on(sv);
+#      if PERL_VERSION > 8
+               SvFLAGS(sv) |= (SvFLAGS(*svp)
+                               & (SVs_PADSTALE|SVs_PADTMP|SVs_PADMY));
+#      else
                SvFLAGS(sv) |= (SvFLAGS(*svp)
                                & (SVs_PADBUSY|SVs_PADTMP|SVs_PADMY));
+#      endif
                SvREFCNT_dec(*svp);
                *svp = sv;
            }
@@ -535,7 +551,7 @@
      by the fact that doing stuff while optimization is highly dangerous
   */
     
-  peep(o);
+  Perl_peep(aTHX_ o);
     
   /* Since we get the start here, we should try and find the
      leave by following next until we find it
@@ -576,6 +592,8 @@
 
 MODULE = optimizer             PACKAGE = optimizer             PREFIX = PEEP_
 
+PROTOTYPES: DISABLE
+
 U32
 PEEP_op_seqmax()
 
Only in optimizer-0.05-mod/: optimizer.xs~
# -*- perl -*-

use Getopt::Std;
getopts('aln:') or die;

@tars = (
         'B-Generate-1.06.tar.gz',
         'optimizer-0.05.tar.gz',
         #'Hook-Scope-0.04.tar.gz',
         #'optimize-0.03.tar.gz'
         );

%patch = (
           'B-Generate-1.06.tar.gz'     => 'patch-b-gen',
           'optimizer-0.05.tar.gz'      => 'patch-optimizer',
           'Hook-Scope-0.04.tar.gz'     => 'patch-hook',
           'optimize-0.03.tar.gz'       => 'patch-opt',
          );


if ($opt_a) {
    $opt_l = "-l" if $opt_l;
    $opt_n = "-n $opt_n" if $opt_n;
    foreach my $vers (qw( 5.6.2 5.8.0 5.8.1 '' 5.8.2 5.9.0 )) {

        print `which perl$vers`;
        next if $?;

        print "perl$vers regress $opt_l $opt_n\n";
        print `perl$vers regress $opt_l $opt_n`;
    }
}
else {
    run_regression($^X)
}

sub run_regression {
    my $perl = shift;
    print "$^X\n";
    # this often says 'UNKNOWN'.  Why ?
    print `$^X -MConfig -V:useitheads`;

    #use lib qw( ./B-Generate-1.06/lib );

    foreach my $tar (@tars) {
        
        next if $opt_n and $tar !~ /$opt_n/;
        
        print `tar xvfz $tar`;
        my $dir = $tar;
        $dir =~ s/\.tar\.gz//;
        
        if (!$opt_l) {
            #print `$^X -V`, "\n";
            print `cd $dir && patch -p1 < ../$patch{$tar}`, "\n" if -f $patch{$tar};
        } else {
            print "skipping patch of $patch{$tar}\n";
        }
        my $lib = '-I B-Generate-1.06/blib/lib -I B-Generate-1.06/lib/arch/auto';
        
        if (-f "$dir/Build.PL") {
            #my $lib = 'PERL5LIB=B-Generate-1.06/blib:B-Generate-1.06/arch';
            print "building ",
            `cd $dir && $^X Build.PL && $^X $lib Build test`, "\n";
        } else {
            print "making ",
            `cd $dir && $^X $lib Makefile.PL && make && make test`, "\n";
        }
        print "return status: $?\n\n";
    }
}

Reply via email to