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

[BUG] syntax incompatibility (5.8.8 vs 5.10)



All,

When forward porting modules from 5.8.8 to 5.10.0, I found the following (in
Readonly-XS). It looks like warnings is loading Carp by default in 5.8.8  -
hence working on 5.8.8 but breaking on 5.10.0.

Arguably adding Carp to warnings is wrong, but it might break quite a few
existing modules in going forward.

Ed

<trace below>

String found where operator expected at
/GAAL/pesced_release/install/lib/perl5/site_perl/5.10.0/sun4-solaris-64int/Readonly/XS.pm
line 36, near "Carp::croak "Readonly::XS is not a standalone module. You
should not use it directly.""
        (Do you need to predeclare Carp::croak?)


---


#!perl

# Test suite for Readonly::XS.

use strict;
use warnings;
package Readonly;
use Test::More tests => 10;

use vars qw/$x $y/;

# Find the module (2 tests)
BEGIN
{
    $DB::single = 1;
    eval 'use Readonly::XS';
    $@ =~ s/ at .*// if $@;
    is substr($@,0,71) => "Readonly::XS is not a standalone module. You
should not use it directly", 'Unauthorized use';

    $Readonly::XS::MAGIC_COOKIE = "Do NOT use or require Readonly::XS unless
you're me.";
    delete $INC{'Readonly/XS.pm'};
    eval 'use Readonly::XS';
    is $@ => '', 'Authorized use';
}

# Functions loaded?  (2 tests)
ok defined &is_sv_readonly,   'is_sv_readonly loaded';
ok defined &make_sv_readonly, 'make_sv_readonly loaded';

# is_sv_readonly (4 tests)
ok is_sv_readonly("hello"), 'constant string is readonly';
ok is_sv_readonly(7),       'constant number is readonly';
*x = \42;
ok is_sv_readonly($x),      'constant typeglob thingy is readonly';
$y = 'r/w';
ok !is_sv_readonly($y),     'inconstant variable is not readonly';

# make_sv_readonly (2 tests)
make_sv_readonly($y);
ok is_sv_readonly($y),      'status changed to readonly';
eval {$y = 75};
$@ =~ s/ at .*// if $@;
is $@ => "Modification of a read-only value attempted\n", 'verify
readonly-ness';

Follow-Ups from:
Elliot Shank <perl@galumph.com>
Michael G Schwern <schwern@pobox.com>

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