[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Version.pm 0.69 overloading incomplete



Hi John,

first off, thanks a lot for the fixes in 0.69 -- they make pure perl
installs of version.pm
work very nicely under 5.8.x. Unfortunately, they fail tests under 5.6.2
quite heavily [1].
The XS version passes all tests under 5.6.2 though.

Another issue has crept up, which makes version objects break
Test::Builder in the
following situations (at least under pure perl -- XS not tested here):

    cmp_ok( qv(1), '>', 0, 'Positive version found' );

This is because Test::Builder uses the following bit of code internally at
around line 515:

    # This is a hack to detect a dualvar such as $!
    sub _is_dualvar {
        my($self, $val) = @_;

        local $^W = 0;
        my $numval = $val+0;
        return 1 if $numval != 0 and $numval ne $val;
    }

This can be reduced to the simple test case:

    $ perl -Mversion -le'qv(1)+0'
    Operation "+": no method found,
            left argument in overloaded package version,
            right argument has no overloaded magic at -e line 1.

Which shows that version.pm has incomplete overloading on numeric
operations, which is not ideal... I'm not 100% sure what qv(X) + Y should
do though.. my first instinct would be to interpret it as qv(X) + qv(Y), but
you might have other/better thoughts on this.

Either way, the quite fatal error this throws (mind you, not from user code)
is quite severe, so a fix would be in order I think...

Hopefully this is something easily solvable. If you need any assistance, feel
free to ask of course :)

Thanks,

Jos


[1] Test failure under 5.6.2, Mac OS X:
[kane@rimmer ~...build/version-0.69]$ perl5.6.2 Makefile.PL --perl_only
Checking if your kit is complete...
Looks good
Writing Makefile for version
[kane@rimmer ~...build/version-0.69]$ make test
cp lib/version.pm blib/lib/version.pm
cp lib/version.pod blib/lib/version.pod
cp vperl/vpp.pm blib/lib/version/vpp.pm
PERL_DL_NONLAZY=1 /usr/local/bin/perl5.6.2 "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01base.......Argument "version::vpp" isn't numeric in subroutine entry
at /opt/5.6.2/lib/perl5/5.6.2/darwin/POSIX.pm line 38.
t/01base.......NOK 120#     Failed test (t/coretests.pm at line 396)
#                   'www version 8.000 (v8.0.0) required--this is only
version 0.000004 (v0.0.4) at
/Users/kane/.cpanplus/5.6.2/build/version-0.69/blib/lib/version/vpp.pm
line 441.
# BEGIN failed--compilation aborted at (eval 40) line 1.
# '
#     doesn't match '(?-xism:^www version 0.000008 \(v0.0.8\) required)'
t/01base.......ok 129/0# Looks like you failed 1 tests of 132.
t/01base.......dubious
        Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 120
        Failed 1/132 tests, 99.24% okay (less 4 skipped tests: 127 okay,
96.21%)
t/02derived....Argument "version::vpp" isn't numeric in subroutine entry
at /opt/5.6.2/lib/perl5/5.6.2/darwin/POSIX.pm line 38.
t/02derived....ok 91/0#     Failed test (t/coretests.pm at line 396)
t/02derived....ok 92/0#                   'www version 8.000 (v8.0.0)
required--this is only version 0.000004 (v0.0.4) at
/Users/kane/.cpanplus/5.6.2/build/version-0.69/blib/lib/version/vpp.pm
line 441.
# BEGIN failed--compilation aborted at (eval 40) line 1.
# '
#     doesn't match '(?-xism:^www version 0.000008 \(v0.0.8\) required)'
t/02derived....ok 139/0# Looks like you failed 1 tests of 142.
t/02derived....dubious
        Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 126
        Failed 1/142 tests, 99.30% okay (less 4 skipped tests: 137 okay,
96.48%)
t/03require....Argument "version::vpp" isn't numeric in subroutine entry
at /opt/5.6.2/lib/perl5/5.6.2/darwin/POSIX.pm line 38.
                      #     Failed test (t/coretests.pm at line 396)
#                   'www version 8.000 (v8.0.0) required--this is only
version 0.000004 (v0.0.4) at
/Users/kane/.cpanplus/5.6.2/build/version-0.69/blib/lib/version/vpp.pm
line 441.
# BEGIN failed--compilation aborted at (eval 38) line 1.
# '
#     doesn't match '(?-xism:^www version 0.000008 \(v0.0.8\) required)'
t/03require....ok 15/0# Looks like you failed 1 tests of 132.
t/03require....dubious
        Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 121
        Failed 1/132 tests, 99.24% okay (less 7 skipped tests: 124 okay,
93.94%)
Failed Test   Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t/01base.t       1   256   132    1   0.76%  120
t/02derived.t    1   256   142    1   0.70%  126
t/03require.t    1   256   132    1   0.76%  121
15 subtests skipped.
Failed 3/3 test scripts, 0.00% okay. 3/406 subtests failed, 99.26% okay.
make: *** [test_dynamic] Error 2



Follow-Ups from:
John Peacock <jpeacock@rowman.com>
John Peacock <jpeacock@rowman.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]