> > > One could make dump "work" by having it dump out not a core or
> > > a.out, but rather the byte codes representing the current state of
> > > the perl machine. This seems anywhere from somewhat to seriously
> > > useful, and follows in the spirit of what dump was always meant to do.
> >
> > I was contemplating suggesting that Data::Dumper be rolled
> > into the core and take over C<dump>. But I think I like this idea
> > even more.
>
> It would be nice if a human readable dump were possible. So please don't
> completely dump the idea of Data::Dumper functionality in the core.
How about this then:
In a void context, C<dump> dumps the program's current opcode representation
to its filehandle argument (or STDOUT, by default).
In a scalar or list context, C<dump> dumps nothing, but rather returns the
I<source code> of its arguments (or of the current state of the entire
program, by default).
Thus:
dump FILE; # dump program state as opcodes
print FILE dump; # dump program state as source code
print dump \%data; # dump contents of hash as source code
print dump \@data; # dump contents of array as source code
print dump \&data; # dump subroutine as source code
# etc.
If people like this, would someone please RFC it.
Damian