develooper Front page | perl.perl5.porters | Postings from January 2013

[perl #101508] Using flags causes Data::Dumper to die instead of warn

From:
James E Keenan via RT
Date:
January 27, 2013 03:02
Subject:
[perl #101508] Using flags causes Data::Dumper to die instead of warn
Message ID:
rt-3.6.HEAD-27190-1359255743-619.101508-15-0@perl.org
On Mon Oct 17 01:17:15 2011, hmbrand wrote:
> 
> This is a bug report for perl from h.m.brand@xs4all.nl,
> generated with the help of perlbug 1.39 running under perl 5.12.2.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> --8<---
> use strict;
> use Data::Dumper;
> 
> $Data::Dumper::Deparse = 1;
> $Data::Dumper::Useqq   = 1;
> 
> print Dumper {
>     SV  => 1,
>     GLB => *STDERR,
>     IO  => *{$::{STDERR}}{IO},
>     FMT => *{$::{STDOUT}}{FORMAT},
>     };
> -->8---
> 
> Without either of these two flags, Dumper will warn with:
> 
> cannot handle ref type 15 at /pro/lib/perl5/5.14.1/x86_64-linux-
>    ld/Data/Dumper.pm line 190.
> $VAR1 = {
>           'IO' => bless( , 'IO::File' ),
>           'GLB' => *::STDERR,
>           'FMT' => undef,
>           'SV' => 1
>         };
> 
> With either of these two flags, it will die:
> 
> Can't handle IO type. at ../bisect-test.pl line 14
> 

Data::Dumper's performance here is sub-optimal, but I don't think it can
be described as a bug per se.

You are getting two different results because the use of
$Data::Dumper::Deparse or $Data::Dumper::Useqq triggers the pure-Perl
implementation of the library.  It is indeed the case that Data::Dumper
does not handle the 'IO' type, so the "Can't handle IO type" is the
expected failure message.  (In Data::Dumper v2.135_06, which is what
shipped with Perl 5.16.0, you can find this "croak" at line 484 of
Dumper.pm.)

With neither of the two flags, you are using the XS-implementation of
Data::Dumper.  I have no expertise with the XS side, but I concede that
I would not know what to make of a fatal error saying "cannot handle ref
type 15."

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=101508



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