NAME

Clone::Any - Select an available recursive-copy function

SYNOPSIS

use Clone::Any qw(clone);

$a = { 'foo' => 'bar', 'move' => 'zig' };
$b = [ 'alpha', 'beta', 'gamma', 'vlissides' ];
$c = new Foo();

$d = clone($a);
$e = clone($b);
$f = clone($c);

DESCRIPTION

This module checks for several different modules which can provide a clone() method which makes recursive copies of nested hash, array, scalar and reference types, including tied variables and objects.

Depending on which modules are available, this will either use Clone, Clone::PP or Storable.

The clone() function takes a scalar argument to copy. To duplicate lists, arrays or hashes, pass them in by reference. e.g.

my $copy = clone (\@array);
# or
my %copy = %{ clone (\%hash) };  

SEE ALSO

For various implementations, see Clone, Clone::PP and <Storable>.

CREDITS AND COPYRIGHT

Developed by Matthew Simon Cavalletto, simonm@cavalletto.org. Mode modules from Evolution Softworks are available at www.evoscript.org. Copyright 2003 Matthew Simon Cavalletto.

Interface based on Clone by Ray Finch, rdf@cpan.org. Portions Copyright 2001 Ray Finch.

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