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


Clone-Any documentation  | view source Contained in the Clone-Any distribution.

Index


NAME

Top

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

SYNOPSIS

Top

  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

Top

This module checks for several different modules which can provide a clone() function to make deep copies of Perl data structures.

Clone Interface

The clone function makes recursive copies of nested hash, array, scalar and reference types, including tied variables and objects.

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);    my @copy = @{ clone(\@array) };
  my $copy = clone(\%hash);     my %copy = %{ clone(\%hash) };

Multiple Implementations

Depending on which modules are available, this may load Clone, Clone::PP, Util, Storable, or Class::MakeMethods::Utility::Ref. If none of those modules are available, it will croak.

SEE ALSO

Top

For the various implementations, see Clone, Clone::PP, Storable, Util, and Class::MakeMethods::Utility::Ref.

See Devel::UseAnyFunc for the underlying module loader and exporter functionality.

CREDITS AND COPYRIGHT

Top


Clone-Any documentation  | view source Contained in the Clone-Any distribution.