develooper Front page | perl.perl5.porters | Postings from May 2010

[perl #8000] format defined inside of failed 'eval'

Thread Previous | Thread Next
From:
Alexandr Ciornii via RT
Date:
May 4, 2010 09:53
Subject:
[perl #8000] format defined inside of failed 'eval'
Message ID:
rt-3.6.HEAD-10623-1272992018-1602.8000-14-0@perl.org
Same result on 5.12.0.

On Thu Dec 06 07:39:42 2001, mjd@plover.com wrote:

> 
>         $var = "bloop";
> 
>         use strict vars;
>         eval q{
>         format STDOUT =
>         The value of 'var' is: @>>>>>>>>>>>
>         $var
>         .
>         };
>         print "Eval err? >> $@\n";
>         write;
> 
> ================================================================
> 
> The 'eval' fails because of the use of the global variable '$var' in
> the 'format' declaration.  Afterwards, $@ contains
> 
>         Global symbol "$var" requires explicit package name at (eval
>    1) line 4.
> 
> Nevertheless, the format is still defined as if nothing had gone
> wrong, as the 'write' shows; the output is
> 
>         The value of 'var' is:        bloop
> 
> If compilation of a format throws a fatal error, the format should not
> be defined afterwards.
> 

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