Skip Menu |

This queue is for tickets about the Array-AsHash CPAN distribution.

Report information
The Basics
Id: 20765
Status: resolved
Priority: 0/
Queue: Array-AsHash

People
Owner: Nobody in particular
Requestors: venky [...] berkeley.edu
Cc:
AdminCc:

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



Subject: Request: Class::Std::Storable
Date: Sun, 30 Jul 2006 15:14:48 -0700
To: bug-Array-AsHash [...] rt.cpan.org
From: "Venky Iyer" <venky [...] berkeley.edu>
Could you please modify the :ATTRs in Array::AsHash so as to support Class::Std::Storable? I could go in and change Class::Std to Class::Std::Storable, but if you changed the order of those attributes at some point in the future, thaw() would break. Venky -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: OVID [...] cpan.org
On Sun Jul 30 20:54:27 2006, venky@berkeley.edu wrote: Show quoted text
> Could you please modify the :ATTRs in Array::AsHash so as to support > Class::Std::Storable? I could go in and change Class::Std to > Class::Std::Storable, but if you changed the order of those attributes
at Show quoted text
> some point in the future, thaw() would break. > > Venky
Hmm, I can look into this, but I am a bit concerned that this exposes some of the internals in a way I don't feel entirely comfortable with. Specifically, the docs to that class state: However, in order to let Storable save attributes and construct the object, it is necessary to expose the attributes of the class to the world. Thus, any code could use the same interface that Storable does to get a copy of object attributes and create new objects with arbitrary attributes without going through the constructor. While the interface CAN'T be used to replace the existing attributes of an object, it COULD be used to create an arbitrarily mutated clone of an object without going through its methods. Also, if attributes are themselves references, then the objects to which they refer can be obtained and modified. Could you use the get_array() method and serialize the underlying array? Later you could simply restore it by passing it new() and creating a new instance. Would that be enough? Another option would be for me to entirely remove Class::Std and use a traditional object. That would be trivial to serialize and frankly, so long as I document the "don't muck with the internals" bit, I think I'd be OK with that. Cheers, Ovid