in reply to Persistent Class data
Whichever fits the bill for you.
update: I hope this clears things up.
As you see, your little bless trick won't work quite so well. Most of the time, Data::Dumper/Storable can handle such things properly, but not always.
You'd be better off storing a simple hash, from which you create a new object, like
When you bless something directly, you avoid all the stuff b::new does. By properly serializing your variables with one of the modules I mentioned above, you avoid this issue (there are other issues of course, but the docs for the modules above discuss them).#persistB.obj $VAR1 = { foo => 'bar' }; my $object = do "persistB.obj"; $object = b->new($object);
You'll also be wanting to reconsider the implications of
See Re: perl oo for discussion about that.my $self = bless {}, ref($class)||$class;
____________________________________________________
** The Third rule of perl club is a statement of fact: pod is sexy.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Persistent Class data
by webby (Acolyte) on Oct 13, 2002 at 09:24 UTC | |
|
Re: Re: Persistent Class data
by webby (Acolyte) on Oct 13, 2002 at 09:59 UTC |