[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [PATCH] Data::Dumper.pm



On Mon, Jan 10, 2000 at 09:11:06AM -0800, Gurusamy Sarathy wrote:
> On Mon, 10 Jan 2000 16:02:21 GMT, James Duncan wrote:
> >Below is a quick patch against Data::Dumper 2.101 to make it use the
> >latest version of B::Deparse to dump CODE references instead of creating
> >dummy subs.
> 
> Needs updates to the testsuite.  I think we still want to keep the
> warning, because it is impossible to create some kinds of subs correctly.
> (Try closures, for instance.)

The to-do list has some scary items in it. Here are some highlights:

# Todo:
# - finish tr/// changes
# - {} around variables in strings ("${var}letters")
#   base/lex.t 25-27
#   comp/term.t 11
# - left/right context
# - recognize `use utf8', `use integer', etc
# - interpret in high bit chars in string as utf8 \x{...} (when?)
# - associativity of &&=, ||=, ?:
# - ',' => '=>' (auto-unquote?)
# - handle `my $x if 0'?
# - include values of variables (e.g. set in BEGIN)
# - here-docs?
# - <DATA>?

I think it's important to err on the side of safety by default.
I'd rather that there was a Data::Dumper option that controlled how to
treat code refs. Values could be:

  0 - warn and generate a sub { die ... }
  1 - warn and generate a sub { }
  2 - warn and output via B::Deparse
  3 - output via B::Deparse with no warning (except any from via B::Deparse)

Personally, I'd rather the default was 0.

Of course ideally some of that functionality should live in B::Deparse.
It should be possible to ask B::Deparse to croak if it can't be reasonably
sure it's generated code will behave in the same way as the original.

The B::Deparse in .63 has _no_ croak or die associated with generating
bad code. There is no way to have any faith in the code it generates
for an arbitrary code ref.

Tim.


Follow-Ups from:
James Duncan <james@ebookers.com>
References to:
James Duncan <james@ebookers.com>
Gurusamy Sarathy <gsar@activestate.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]