Regarding what to do about broken old base.pms ...

Piers Cawley ([EMAIL PROTECTED]) wrote:
> Adam Spiers <[EMAIL PROTECTED]> writes:
> > Nasty, isn't it?  Possible workarounds:
> > 
> >  1. Document it
> >  2. Get `make install' to check for the brokenness and warn
> >  3. Add `use Foo;' before every `use base qw(Foo);'
> >  4. Provide a patch
> > 
> > 3. is the easiest but somehow I don't like it.

Nor me.

> 5. Don't use base at all, do:
> 
>     use vars qw/@ISA/;
>     use Foo ();
>     @ISA = 'Foo';
> 
> After all, it's worked for ages. Ugly though.

Yeah, really ugly :-(

> Or, in Makefile.PL:
> 
>     use ExtUtils::MakeMaker;
> 
>     # See lib/ExtUtils/MakeMaker.pm for details of how to influence
>     # the contents of the Makefile that is written.
> 
>     my $PREREQ_PM;
>     unless (eval "require 5.6.0") {
>         $PREREQ_PM = {Class::Fields => 0};
>     }
>     else {
>         $PREREQ_PM = {base => 0};
>     }
>      
>     WriteMakefile(
>         'NAME'         => 'Test::Unit',
>         'VERSION_FROM' => 'lib/Test/Unit.pm', # finds $VERSION
>         'PREREQ_PM'    => $PREREQ_PM,
>     );
> 
> Admittedly, this assumes that the 'base' in Class::Fields on CPAN has
> the bugfix, which someone (without perl 5.6.0) needs to check.

I like this approach.  It's the least intrusive, allows us to use nice
syntax, and is mostly transparent to users.

Christian Lemburg ([EMAIL PROTECTED]) wasn't convinced though:
> Why rely on that? Where will it break next?

Nowhere.  I've been using the fixed version for ages, and it's fine.
The new syntax is much nicer, and I wouldn't like to fight the natural
course of progress just because of a mistake made in the past.

Matthew Astley ([EMAIL PROTECTED]) suggested:
> Another solution, can the makefile figure out from the version number
> of base.pm whether you're running on a broken system or not, and apply
> 
>   find blib -name '*.pm' | \
>   xargs perl -i -pe 's{^\s*use\s+base\s+(.+)} \
>   {use $1 use vars (\@ISA); \@ISA = $1} .. 0'
> 
> to fix the problem? (I, um, changed it after I tested it...)

Self-modifying code!  I'd really rather avoid that if at all possible,
we're not in the Dark Ages any more ;-)

_______________________________________________
Perlunit-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/perlunit-devel

Reply via email to