1Clone::Choose(3)      User Contributed Perl Documentation     Clone::Choose(3)
2
3
4

NAME

6       Clone::Choose - Choose appropriate clone utility
7

SYNOPSIS

9         use Clone::Choose;
10
11         my $data = {
12             value => 42,
13             href  => {
14                 set   => [ 'foo', 'bar' ],
15                 value => 'baz',
16             },
17         };
18
19         my $cloned_data = clone $data;
20
21         # it's also possible to use Clone::Choose and pass a clone preference
22         use Clone::Choose qw(:Storable);
23

DESCRIPTION

25       "Clone::Choose" checks several different modules which provides a
26       "clone()" function and selects an appropriate one. The default
27       preference is
28
29         Clone
30         Storable
31         Clone::PP
32
33       This list might evolve in future. Please see "EXPORTS" how to pick a
34       particular one.
35

EXPORTS

37       "Clone::Choose" exports "clone()" by default.
38
39       One can explicitly import "clone" by using
40
41         use Clone::Choose qw(clone);
42
43       or pick a particular "clone" implementation
44
45         use Clone::Choose qw(:Storable clone);
46
47       The exported implementation is resolved dynamically, which means that
48       any using module can either rely on the default backend preference or
49       choose a particular one.
50
51       It is also possible to select a particular "clone" backend by setting
52       the environment variable CLONE_CHOOSE_PREFERRED_BACKEND to your
53       preferred backend.
54
55       This also means, an already chosen import can't be modified like
56
57         use Clone::Choose qw(clone :Storable);
58
59       When one seriously needs different clone implementations, our
60       recommended way to use them would be:
61
62         use Clone::Choose (); # do not import
63         my ($xs_clone, $st_clone);
64         { local @Clone::Choose::BACKENDS = (Clone => "clone"); $xs_clone = Clone::Choose->can("clone"); }
65         { local @Clone::Choose::BACKENDS = (Storable => "dclone"); $st_clone = Clone::Choose->can("clone"); }
66
67       Don't misinterpret recommended - modifying @Clone::Choose::BACKENDS has
68       a lot of pitfalls and is unreliable beside such small examples. Do not
69       hesitate open a request with an appropriate proposal for choosing
70       implementations dynamically.
71
72       The use of @Clone::Choose::BACKENDS is discouraged and will be
73       deprecated as soon as anyone provides a better idea.
74

PACKAGE METHODS

76   backend
77       "backend" tells the caller about the dynamic chosen backend:
78
79         use Clone::Choose;
80         say Clone::Choose->backend; # Clone
81
82       This method currently exists for debug purposes only.
83
84   get_backends
85       "get_backends" returns a list of the currently supported backends.
86

AUTHOR

88         Jens Rehsack <rehsack at cpan dot org>
89         Stefan Hermes <hermes at cpan dot org>
90

BUGS

92       Please report any bugs or feature requests to "bug-Clone-Choose at
93       rt.cpan.org", or through the web interface at
94       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Clone-Choose>.  I will
95       be notified, and then you'll automatically be notified of progress on
96       your bug as I make changes.
97

SUPPORT

99       You can find documentation for this module with the perldoc command.
100
101         perldoc Clone::Choose
102
103       You can also look for information at:
104
105       •   RT: CPAN's request tracker
106
107           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Clone-Choose>
108
109       •   AnnoCPAN: Annotated CPAN documentation
110
111           <http://annocpan.org/dist/Clone-Choose>
112
113       •   CPAN Ratings
114
115           <http://cpanratings.perl.org/d/Clone-Choose>
116
117       •   Search CPAN
118
119           <http://search.cpan.org/dist/Clone-Choose/>
120
122         Copyright 2017 Jens Rehsack
123         Copyright 2017 Stefan Hermes
124
125       This program is free software; you can redistribute it and/or modify it
126       under the terms of either: the GNU General Public License as published
127       by the Free Software Foundation; or the Artistic License.
128
129       See http://dev.perl.org/licenses/ for more information.
130

SEE ALSO

132       Clone, Clone::PP, Storable
133
134
135
136perl v5.34.0                      2021-07-22                  Clone::Choose(3)
Impressum