develooper Front page | perl.perl5.porters | Postings from February 2011

Re: [ #65284] Module broken with 5.13.x development perl versions

Thread Previous | Thread Next
Joshua ben Jore
February 1, 2011 10:13
Re: [ #65284] Module broken with 5.13.x development perl versions
Message ID:
On Mon, Jan 31, 2011 at 7:24 PM, Joshua ben Jore <> wrote:
> On Mon, Jan 31, 2011 at 12:11 PM, David Golden <> wrote:
>> It's a bug in base.  It shouldn't set the $VERSION to something that
>> doesn't pass a "lax" version number test.
>> If it *has* to set VERSION for some reason, (and I'm not convinced it
>> should) it should just set it to '0'.
>'s documented version number has been '-1, set by'. Are
> you intending to change that?
> from `perldoc base`:
>    If $VERSION is not detected even after loading it, <base> will
> define $VERSION
>    in the base package, setting it to the string C<-1, set by>.
> Josh

I'd like to share this relevant snippet I've pulled from the DarkPAN
because it's relevant for things that would break if's API
changed. Further, apropos of just how much pain went into this
paragraph, for reasons I don't quite understand, DynaLoader or Inline
completely fail to signal any error at all if dlload() fails because
there's a version mismatch.

        # Loathe It has a "feature" where it'll set $VERSION to
        # '-1, set by' if the variable isn't already present. Inline
        # is going to expect the version to be '0.00' in this case so I'm
        # changing this so DynaLoader can load the XS portion. The
version number
        # in the generated .so and $VERSION must match.
        # Further... since Inline is just going to use 0.00, I'm going
to make sure that I'm storing that value
        # anyway. Or rather... I think it'll go with whatever version
I tell it as long as I give it a version.
        no strict 'refs';
        no warnings;
        if ( ${"${class}::VERSION"} !~ /^\d+\.\d+\z/ ) {
            ${"${class}::VERSION"} = '0.00';


    # Run the Inline->bind in the package that's getting the code.
There's no other way
    # to change my current package than an eval() so that's why I'm doing eval
    # with "package $class".
    my $compilation_ok = eval <<"Inline";
        package $class;

        # During initial coding I noticed that if \@foo::ISA = qw(
Exporter DynaLoader )
        # and \@boo::ISA = qw( foo Exporter DynaLoader ) that the method call
        # boo::->bootstrap would do zilch. If I just nix this temporarily
        # Inline will fill in the Exporter and DynaLoader for me.
        local \@${class}::ISA;

        # This is the equivalent of "eval_xs(...)".
            C => \$c_src,
            NAME => \$class,
            XSMODE => 1,
            DIRECTORY => '${compilation_dir}',
            CLEAN_AFTER_BUILD => 0,
        return 1;
    my $compilation_error = $@;


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About