in reply to Re: Can I serialize an object and have it remember it's type?
in thread Can I serialize an object and have it remember it's type?
Evaling didn't work in this case, but thanks for your comment. I didn't realize that was how serialization was supposed to work, but now this all makes more sense. I'm going to try serializing and evaling with Storable now.
**********
Update, yep, this works.
**********
Update, yep, this works.
use strict; use warnings; use Storable qw(store retrieve freeze thaw dclone); use LWP::UserAgent; use Test::More qw(no_plan); my $user_agent = LWP::UserAgent->new; isa_ok($user_agent, 'LWP::UserAgent'); store($user_agent, 'myuseragent') or die "Can't store useragent!\n"; my $user_agent2 = retrieve('myuseragent'); isa_ok($user_agent2, 'LWP::UserAgent');
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Can I serialize an object and have it remember it's type?
by Tanktalus (Canon) on Jul 21, 2005 at 14:14 UTC | |
by cowboy (Friar) on Jul 21, 2005 at 17:28 UTC | |
Re^3: Can I serialize an object and have it remember it's type?
by tlm (Prior) on Jul 21, 2005 at 13:39 UTC | |
by tphyahoo (Vicar) on Jul 21, 2005 at 13:52 UTC |
In Section
Seekers of Perl Wisdom