sub clone { my $self = shift; my $copy = bless { %$self }, ref $self; # copy most fields # elements that are references must be handled in a special way $copy->{'proxy'} = { %{$self->{'proxy'}} }; # here's where we die! $copy->{'no_proxy'} = [ @{$self->{'no_proxy'}} ]; # copy array # remove reference to objects for now delete $copy->{cookie_jar}; delete $copy->{conn_cache}; $copy; }