.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Clone::Choose 3pm" .TH Clone::Choose 3pm "2018-04-14" "perl v5.26.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Clone::Choose \- Choose appropriate clone utility .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Clone::Choose; \& \& my $data = { \& value => 42, \& href => { \& set => [ \*(Aqfoo\*(Aq, \*(Aqbar\*(Aq ], \& value => \*(Aqbaz\*(Aq, \& }, \& }; \& \& my $cloned_data = clone $data; \& \& # it\*(Aqs also possible to use Clone::Choose and pass a clone preference \& use Clone::Choose qw(:Storable); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`Clone::Choose\*(C'\fR checks several different modules which provides a \&\f(CW\*(C`clone()\*(C'\fR function and selects an appropriate one. The default preference is .PP .Vb 3 \& Clone \& Storable \& Clone::PP .Ve .PP This list might evolve in future. Please see \*(L"\s-1EXPORTS\*(R"\s0 how to pick a particular one. .SH "EXPORTS" .IX Header "EXPORTS" \&\f(CW\*(C`Clone::Choose\*(C'\fR exports \f(CW\*(C`clone()\*(C'\fR by default. .PP One can explicitly import \f(CW\*(C`clone\*(C'\fR by using .PP .Vb 1 \& use Clone::Choose qw(clone); .Ve .PP or pick a particular \f(CW\*(C`clone\*(C'\fR implementation .PP .Vb 1 \& use Clone::Choose qw(:Storable clone); .Ve .PP The exported implementation is resolved dynamically, which means that any using module can either rely on the default backend preference or choose a particular one. .PP It is also possible to select a particular \f(CW\*(C`clone\*(C'\fR backend by setting the environment variable \s-1CLONE_CHOOSE_PREFERRED_BACKEND\s0 to your preferred backend. .PP This also means, an already chosen import can't be modified like .PP .Vb 1 \& use Clone::Choose qw(clone :Storable); .Ve .PP When one seriously needs different clone implementations, our \fIrecommended\fR way to use them would be: .PP .Vb 4 \& use Clone::Choose (); # do not import \& my ($xs_clone, $st_clone); \& { local @Clone::Choose::BACKENDS = (Clone => "clone"); $xs_clone = Clone::Choose\->can("clone"); } \& { local @Clone::Choose::BACKENDS = (Storable => "dclone"); $st_clone = Clone::Choose\->can("clone"); } .Ve .PP Don't misinterpret \fIrecommended\fR \- modifying \f(CW@Clone::Choose::BACKENDS\fR has a lot of pitfalls and is unreliable beside such small examples. Do not hesitate open a request with an appropriate proposal for choosing implementations dynamically. .PP The use of \f(CW@Clone::Choose::BACKENDS\fR is discouraged and will be deprecated as soon as anyone provides a better idea. .SH "PACKAGE METHODS" .IX Header "PACKAGE METHODS" .SS "backend" .IX Subsection "backend" \&\f(CW\*(C`backend\*(C'\fR tells the caller about the dynamic chosen backend: .PP .Vb 2 \& use Clone::Choose; \& say Clone::Choose\->backend; # Clone .Ve .PP This method currently exists for debug purposes only. .SS "get_backends" .IX Subsection "get_backends" \&\f(CW\*(C`get_backends\*(C'\fR returns a list of the currently supported backends. .SH "AUTHOR" .IX Header "AUTHOR" .Vb 2 \& Jens Rehsack \& Stefan Hermes .Ve .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \&\f(CW\*(C`bug\-Clone\-Choose at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "SUPPORT" .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc Clone::Choose .Ve .PP You can also look for information at: .IP "\(bu" 4 \&\s-1RT: CPAN\s0's request tracker .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 Search \s-1CPAN\s0 .Sp .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" .Vb 2 \& Copyright 2017 Jens Rehsack \& Copyright 2017 Stefan Hermes .Ve .PP This program is free software; you can redistribute it and/or modify it under the terms of either: the \s-1GNU\s0 General Public License as published by the Free Software Foundation; or the Artistic License. .PP See http://dev.perl.org/licenses/ for more information. .SH "SEE ALSO" .IX Header "SEE ALSO" Clone, Clone::PP, Storable