# New Ticket Created by  Colin Kuskie 
# Please include the string:  [perl #44231]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=44231 >


I first noticed this with the patch I posted for Test.pm.  The
first test description gets printed, and then all other test
descriptions are replaced with the first.

The attached file shows this in detail.  The variable always has
the right value inside the sub, but inside the conditional inside
the sub the value is sticky (only first is remembered).

Sample output:

1..4
outside conditional desc=desc
inside conditional true desc=desc
true desc
ok 1 - holler desc
outside conditional desc=desc2
inside conditional true desc=desc
true desc
not ok 2 - holler desc2

SVN rev 20308 on i386/linux (FC7)

Colin


use v6-alpha;

say "1..4";

sub holler($cond, $desc) {
    say "outside conditional desc="~$desc;
    if ($cond) {
        say "inside conditional true desc="~$desc;
        "true " ~ $desc;
    }
    else {
        say "inside conditional false desc="~$desc;
        "false " ~ $desc;
    }
}

my $holler1 = holler(1, "desc");
say $holler1;
if $holler1 eq "true desc" {
    say "ok 1 - holler desc"
}
else {
    say "not ok 1 - holler desc"
}
    
my $holler2 = holler(1, "desc2");
say $holler2;
if $holler2 eq "true desc2" {
    say "ok 2 - holler desc2";
}
else {
    say "not ok 2 - holler desc2";
}
    


Reply via email to