Skip Menu |

This queue is for tickets about the perlconsole CPAN distribution.

Report information
The Basics
Id: 29140
Status: open
Priority: 0/
Queue: perlconsole

People
Owner: Nobody in particular
Requestors: rafl [...] debian.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.3
Fixed in: (no value)



Subject: Doesn't serialize coderefs
Currently there is no way to get a coderef serialized in a useful way. The default output format just stringifies the reference resulting in CODE(0xaddr). The dump and dumper output methods generate valid perl code, but when you run the generated code again it just doesn't do anything useful as this output methods don't dump the coderefs body resulting in: $VAR1 = sub { "DUMMY" }; or sub { "???" } Also yaml gets it wrong for the same reason: --- !!perl/code '{ "DUMMY" }' Please include a possibility to get coderefs dumped in a useful manner. For yaml setting $YAML::DumpCode to something true would do the job for yaml. I have no idea how to make this work for dump and dumper though. Maybe they have some hook that allows to plug in B::Deparse. Also note that Data::Dump::Streamer gets it right: perl -MData::Dump::Streamer -e'Dump(sub { print 1 })' $CODE1 = sub { print 1; };
From: sukria+perl [...] sukria.net
On Mon Sep 03 15:28:52 2007, FLORA wrote: Show quoted text
> Currently there is no way to get a coderef serialized in a useful way.
Well, in the SVN version, there is :) Indeed I've integrated the DDS output mode: Show quoted text
Perl> :set output = dds Perl> sub { 1 + 1 }
$CODE1 = sub { package PerlConsole::Console; use warnings; use strict 'refs'; 2; }; Show quoted text
Perl>
Subject: Re: [rt.cpan.org #29140] Doesn't serialize coderefs
Date: Tue, 4 Sep 2007 14:55:43 +0200
To: Alexis Sukrieh via RT <bug-perlconsole [...] rt.cpan.org>
From: Florian Ragwitz <rafl [...] debian.org>
On Tue, Sep 04, 2007 at 03:53:44AM -0400, Alexis Sukrieh via RT wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=29140 > > > On Mon Sep 03 15:28:52 2007, FLORA wrote:
> > Currently there is no way to get a coderef serialized in a useful way.
> > Well, in the SVN version, there is :) > Indeed I've integrated the DDS output mode:
Thank you very much! Would you mind to also alow the YAML output to do the same thing? That'd just be: local $YAML::DumpCode = 1; Unfortunately YAML currently has a bug when loading inline !!perl/code (see RT Ticket #29113). Therefor I also suggest to add local $YAML::UseBlock = 1; so the generated YAML is actually loadable with YAML.pm. TIA, Flo -- BOFH excuse #22: monitor resolution too high
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.