CentOS 7.0 - man page for clone (centos section 3)

Linux & Unix Commands - Search Man Pages

Man Page or Keyword Search:   man
Select Man Page Set:       apropos Keyword Search (sections above)

Clone(3)		       User Contributed Perl Documentation			 Clone(3)

       Clone - recursively copy Perl datatypes

	 package Foo;
	 use parent 'Clone';

	 package main;
	 my $original = Foo->new;
	 $copy = $original->clone;

	 # or

	 use Clone qw(clone);

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

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

       This module provides a clone() method which makes recursive copies of nested hash, array,
       scalar and reference types, including tied variables and objects.

       clone() takes a scalar argument and duplicates it. To duplicate lists, arrays or hashes,
       pass them in by reference. e.g.

	   my $copy = clone (\@array);

	   # or

	   my %copy = %{ clone (\%hash) };

       Storable's dclone() is a flexible solution for cloning variables, albeit slower for
       average-sized data structures. Simple and naive benchmarks show that Clone is faster for
       data structures with 3 or less levels, while dclone() can be faster for structures 4 or
       more levels deep.

       Copyright 2001-2012 Ray Finch. All Rights Reserved.

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

       Ray Finch "<rdf@cpan.org>"

       Breno G. de Oliveira "<garu@cpan.org>" and Florian Ragwitz "<rafl@debian.org>" perform
       routine maintenance releases since 2012.

perl v5.16.3				    2012-12-09					 Clone(3)
Unix & Linux Commands & Man Pages : ©2000 - 2018 Unix and Linux Forums

All times are GMT -4. The time now is 02:03 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
Show Password

Not a Forum Member?
Forgot Password?