README
1NAME
2 Function::Fallback::CoreOrPP - Functions that use non-core XS module but
3 provide pure-Perl/core fallback
4
5VERSION
6 This document describes version 0.090 of Function::Fallback::CoreOrPP
7 (from Perl distribution Function-Fallback-CoreOrPP), released on
8 2020-02-03.
9
10SYNOPSIS
11 use Function::Fallback::CoreOrPP qw(clone unbless uniq);
12
13 my $clone = clone({blah=>1});
14 my $unblessed = unbless($blessed_ref);
15 my @uniq = uniq(1, 3, 2, 1, 4); # -> (1, 3, 2, 4)
16
17DESCRIPTION
18 This module provides functions that use non-core XS modules (for best
19 speed, reliability, feature, etc) but falls back to those that use core
20 XS or pure-Perl modules when the non-core XS module is not available.
21
22 This module helps when you want to bootstrap your Perl application with
23 a portable, dependency-free Perl script. In a vanilla Perl installation
24 (having only core modules), you can use App::FatPacker to include
25 non-core pure-Perl dependencies to your script.
26
27FUNCTIONS
28 clone($data) => $cloned
29 Try to use Data::Clone's "clone", but fall back to using Clone::PP's
30 "clone".
31
32 clone_list(@data) => @data
33 A shortcut for:
34
35 return map {clone($_)} @data
36
37 unbless($ref) => $unblessed_ref
38 Try to use Acme::Damn's "damn" to unbless a reference but fall back to
39 shallow copying.
40
41 NOTE: "damn()" MODIFIES the original reference. (XXX in the future an
42 option to clone the reference first will be provided), while shallow
43 copying will return a shallow copy.
44
45 NOTE: The shallow copy method currently only handles blessed
46 {scalar,array,hash}ref as those are the most common.
47
48 uniq(@ary) => @uniq_ary
49 Try to use List::MoreUtils's "uniq", but fall back to using slower,
50 pure-Perl implementation.
51
52HOMEPAGE
53 Please visit the project's homepage at
54 <https://metacpan.org/release/Function-Fallback-CoreOrPP>.
55
56SOURCE
57 Source repository is at
58 <https://github.com/perlancar/perl-Function-Fallback-CoreOrPP>.
59
60BUGS
61 Please report any bugs or feature requests on the bugtracker website
62 <https://rt.cpan.org/Public/Dist/Display.html?Name=Function-Fallback-Cor
63 eOrPP>
64
65 When submitting a bug or request, please include a test-file or a patch
66 to an existing test-file that illustrates the bug or desired feature.
67
68SEE ALSO
69 Clone::Any can also use multiple backends. I used to avoid it because
70 Storable's "dclone" (which is used as the backend) did not support
71 Regexp objects out of the box until version 3.08. Plus must use deparse
72 to handle coderefs.
73
74AUTHOR
75 perlancar <perlancar@cpan.org>
76
77COPYRIGHT AND LICENSE
78 This software is copyright (c) 2020, 2017, 2016, 2014 by
79 perlancar@cpan.org.
80
81 This is free software; you can redistribute it and/or modify it under
82 the same terms as the Perl 5 programming language system itself.
83
84