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.
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?
Update, yep, this works.
use Storable qw(store retrieve freeze thaw dclone);
use Test::More qw(no_plan);
my $user_agent = LWP::UserAgent->new;
store($user_agent, 'myuseragent') or die "Can't store useragent!\n";
my $user_agent2 = retrieve('myuseragent');