[ic] perl5.6.1 and eval hell?

Mike Heins interchange-users@lists.akopia.com
Tue Jun 12 20:26:01 2001


Quoting cfm@maine.com (cfm@maine.com):
> 
> We upgraded some dev machines to debian 5.6.1 perl
> from 5.6.0 over the weekend.  There are some changes 
> in perl that I've not really figured out but thought
> a heads up might be in order.  Lots of our embedded 
> perl refuses to run.
> 
> For example, my dumper script dies now.  It returns nothing.
> If I run this I get HELLO WORLD but if I uncomment
> #    push @OUT,$@ if($@);  Go figure.
> I get nothing at all.  No error, a 1 byte return.
> <(3861/1) Read error: cgi_headers: Success>
> 
> 
> This page:
> # dump.html
> # rev 2000-12-21, cfm
> [tag op=header]
> Content-Type: text/plain
> [/tag]
> [raw]
> {
>     no strict 'refs';
>     my(@OUT,$type);
> 
>     eval {
>         for(keys %{*::}) {
>             for $type (qw(CODE ARRAY HASH IO SCALAR)) {
>                 my($a);
>                # $a = *$_{$type}; # 5.6.1 no go
>                 next unless $a;
>                 # push @OUT,"$_ \t${*::}{$_} $a\n"; # 5.6.1 no go
>             }
>         }
>     };
>     push @OUT,'HELLO WORLD';
> #    push @OUT,$@ if($@);
> 
>     return join '<BR>',@OUT;
> }
> [/raw]

Is whitespace in short supply in Maine? 8-) And why all of this
manipulation of the symbol tables? That really should not be
necessary in this day and age.....

   push (@OUT, $@) if $@;

would be ever so much clearer in my opinion.

My understanding is that the symbol table has undergone some
changes that affect typeglobs. From the 5.6.1 Changes doc:

   Semantics of bareword prototype `(*)' have changed
       The semantics of the bareword prototype `*' have
       changed.  Perl 5.005 always coerced simple scalar
       arguments to a typeglob, which wasn't useful in
       situations where the subroutine must distinguish
       between a simple scalar and a typeglob.  The new
       behavior is to not coerce bareword arguments to a
       typeglob.  The value will always be visible as either
       a simple scalar or as a reference to a typeglob.

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Fast, reliable, cheap.  Pick two and we'll talk.  -- unknown