NAME

Pitonyak::DeepCopy - Copy an object with new copies, even if it contains references.


SYNOPSIS

use Pitonyak::DeepCopy;

my $new_hash_ref = Pitonyak::DeepCopy::deep_copy(\%original_hash);


DESCRIPTION

I ran into problems when I had a hash that contained another hash reference. I copied the elements from one hash to another and then changed the values in the referenced hash. Confused? Okay, here is what the code looked like.

my %old_hash = ('val' => 2, 'ref' => {'E' => 1}, );

I then made a new hash with all the same values in %hash_ref but this included a reference to the hash because my code included $new_hash{'ref'} = $old_hash.{'ref'};

I then created this method so now I can do:

my $hash_ref = Pitonyak::DeepCopy::deep_copy(\%pld_hash);


COPYRIGHT

Copyright 2002, Andrew Pitonyak (perlboy@pitonyak.org)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Modification History

September 01, 2002

Version 1.00 First release


COPYRIGHT

Copyright 1998-2002, Andrew Pitonyak (perlboy@pitonyak.org)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Modification History

March 13, 1998

Version 1.00 First release

September 10, 2002

Version 1.01 Changed internal documentation to POD documentation. Added parameter checking.