[Bug 846330] New: Lexical subroutines make some variables unavailable

bugzilla at redhat.com bugzilla at redhat.com
Tue Aug 7 13:25:34 UTC 2012


https://bugzilla.redhat.com/show_bug.cgi?id=846330

            Bug ID: 846330
        QA Contact: extras-qa at fedoraproject.org
          Severity: unspecified
               URL: https://rt.perl.org/rt3//Public/Bug/Display.html?id=11
                    3930
           Version: 17
          Priority: unspecified
                CC: cweyl at alumni.drew.edu, iarnell at gmail.com,
                    jplesnik at redhat.com, kasal at ucw.cz, lkundrak at v3.sk,
                    mmaslano at redhat.com,
                    perl-devel at lists.fedoraproject.org, ppisar at redhat.com,
                    psabata at redhat.com, rc040203 at freenet.de,
                    tcallawa at redhat.com
          Assignee: mmaslano at redhat.com
           Summary: Lexical subroutines make some variables unavailable
        Regression: ---
      Story Points: ---
    Classification: Fedora
                OS: Unspecified
          Reporter: ppisar at redhat.com
              Type: Bug
     Documentation: ---
          Hardware: Unspecified
        Mount Type: ---
            Status: ASSIGNED
         Component: perl
           Product: Fedora

This code:

sub foo {
    my $x if @_;
    return if @_;

    $x = 17;
    print $x, "\n";
    print sub { $x }->(), "\n";
    return;

}
foo(1); # make $x stale in all perl versions
foo;

produces errors and wrong output because it stales the $x:

17
Variable "$x" is not available at ./lexical_sub line 11.
Use of uninitialized value in print at ./lexical_sub line 11.


All perls since 5.10.1 are affected.

All Fedoras are affected.

Fixed in upstream by commit:

commit cae5dbbe30ba4a96ff5e570be0d90779f06fee71
Author: Father Chrysostomos <sprout at cpan.org>
Date:   Sat Aug 4 14:42:47 2012 -0700

    Close over stale vars in active subs

-- 
You are receiving this mail because:
You are on the CC list for the bug.



More information about the perl-devel mailing list