On Mon, Sep 25, 2006 at 09:02:56PM -0500, Mark Stosberg wrote:
: Brad Bowman wrote:
: > Both Data::Dumper and Storable provide hooks to customize serialization
: > ($Data::Dumper::Freezer|Toaster, STORABLE_freeze|_thaw).
: > Other modules like YAML and Clone could also possibly reuse a
: > common state marshalling interface.
: > Is there some common element to this process which can be gathered
: > into a Serialize role with a default implementation?
: There is already ".yaml" to serialize to yaml and ".perl" to serialize
: to Perl (I'm not sure what the limits are round-tripping Perl this way).
One thing that makes an enormous practical difference is whether the
entire serialized string must be in memory or not. (I've been trying
to work with a 37M yaml file recently, sigh...)
: They can be returned to Perl in a consistent way, too:
: eval($yaml, :lang<yaml>);
: Still, these options may not substitute for the kind of role-based
: solution you have mind.
I'm not sure it's wise to overload eval this way. Seems like a
great way to defeat MMD. Plus I really want a file interface so I
don't have to slurp a 37M string, which in turn requires a 400M stack
allocation currently. Seems to want even more heap after that, and
then it really starts thrashing...