develooper Front page | perl.perl5.porters | Postings from November 2007

Readonly bug in 5.10.0

Thread Next
From:
Jerry D. Hedden
Date:
November 28, 2007 06:54
Subject:
Readonly bug in 5.10.0
Message ID:
1ff86f510711280654rb0f6680xe610142b8e90d8c5@mail.gmail.com
The following (attached):

    #!/usr/bin/perl

    use strict;
    use warnings;

    # Create a object from an anonymous scalar
    my $obj1 = \do{ my $scalar = 1; };   # Object ID = 1
    bless($obj1, 'Foo');

    # Put the object's ID into a hash
    my %ids;
    $ids{$$obj1} = undef;


    # Create a 2nd object
    my $obj2 = \do{ my $scalar; };

    # Set the 2nd object IDs from the hash
    ($$obj2) = keys(%ids);
    delete($ids{$$obj2});

    # Bless the 2nd object
    bless($obj2, 'Foo');  # Causes "Modification of a read-only value..." error

    # EOF

Produces:

    Modification of a read-only value attempted at ./readonly_bug.pl line 23.

Can this be fixed before 5.10.0 goes out?


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About