[svk-devel] svk v2.0.99_991: inappropriate mutation in SVK::Logger $warn

Mark Eichin eichin at metacarta.com
Tue Feb 12 20:50:10 EST 2008


lib/SVK/Logger.pm:

my $warn = sub {
    $_[1] .= "\n" unless substr( $_[1], -1, 1 ) eq "\n";
    print $_[1];
};

inappropriately mutates $_[1].  This causes 80+ failures of the form:

t/01help.........................ok 1/89
#   Failed test 'help add'
#   in t/01help.t at line 29.
#                   'NAME
# Modification of a read-only value attempted at /home/eichin/tmp/ubu.gutsy/svk-2.0.1/blib/lib/SVK/Logger.pm line 126.
# '
#     doesn't match '(?-xism:SYNOPSIS)'

Trivial fix:

my $warn = sub {
    print $_[1];
    print "\n" unless substr( $_[1], -1, 1 ) eq "\n";
};

(I assume you're using substr because you don't want to interfere with
global regexp context and such, so I preserved that...)


More information about the svk-devel mailing list