develooper Front page | perl.perl5.porters | Postings from June 2011

[perl #8611] Something very wrong with gotoLABEL

Thread Previous | Thread Next
From:
Alexandr Ciornii via RT
Date:
June 11, 2011 08:26
Subject:
[perl #8611] Something very wrong with gotoLABEL
Message ID:
rt-3.6.HEAD-16080-1307805991-379.8611-14-0@perl.org
Same error on 5.14.0.

http://rt.perl.org/rt3/Ticket/Display.html?id=8611

On Wed Feb 20 01:11:05 2002, mjtg@cam.ac.uk wrote:
> A colleague reports that goto LABEL out of a Tie method is broken:
> 
> -------------------------------------------------------------------
> The following transcript distils the cause of the bus
> errors I mentioned last night.
> 
> All we have here is wrong output - how did we get back to
> point A? If I step through it with the debugger, a different
> route is taken, ending in a segmentation violation.
> 
> Session transcript follows:
> 
> cj10@curlew$ cat v
> #!/bin/perl -w
> 
> { package MyTie;
> 
>   sub TIEHANDLE { bless [] }
> 
>   sub PRINT {
>     print "point C\n";
>     goto BANG
>   }
> }
> 
> open NULL, "/dev/null" or die "open";
> tie *NULL, "MyTie";
> print NULL "Hello";
> print "Point A\n";
> BANG:
> print "Point B\n";
> 
> cj10@curlew$ ./v
> point C
> Point B
> Point A
> Point B
> cj10@curlew$
> -------------------------------------------------------------------
> 
> I confirm that this still happens with bleadperl.
> 
> As an additional data point, a tied scalar gives a different error:
> 
> perl -w
> { package MyTie;
> 
>   sub TIESCALAR { bless [] }
>   sub FETCH {
>       print "point C\n";
>       goto BANG;
>   };
> };
> 
> tie my ($x), 'MyTie';
> print $x;
> print "Point A\n";
> BANG:
> print "Point B\n";
> __END__
> point C
> Can't find label BANG at - line 5.
> 
> 
> Mike Guy

-- 
Alexandr Ciornii, http://chorny.net


Thread Previous | 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