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.
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');