---
name: "Function::Fallback::CoreOrPP"
section: "3pm"
platform: "linux"
package: "libfunction-fallback-coreorpp-perl"
version: "0.090-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Function::Fallback::CoreOrPP"
---

# Function::Fallback::CoreOrPP(3pm)

Functions that use non-core XS module but provide pure-Perl/core fallback

## NAME

Function::Fallback::CoreOrPP - Functions that use non-core XS module but provide pure-Perl/core fallback

## VERSION

This document describes version 0.090 of Function::Fallback::CoreOrPP (from Perl distribution Function-Fallback-CoreOrPP), released on 2020-02-03.

## SYNOPSIS

```
 use Function::Fallback::CoreOrPP qw(clone unbless uniq);
 my $clone = clone({blah=>1});
 my $unblessed = unbless($blessed_ref);
 my @uniq  = uniq(1, 3, 2, 1, 4);  # -> (1, 3, 2, 4)
```

## DESCRIPTION

This module provides functions that use non-core XS modules (for best speed, reliability, feature, etc) but falls back to those that use core XS or pure-Perl modules when the non-core XS module is not available.

This module helps when you want to bootstrap your Perl application with a portable, dependency-free Perl script. In a vanilla Perl installation (having only core modules), you can use App::FatPacker to include non-core pure-Perl dependencies to your script.

## FUNCTIONS

### clone($data) =\> $cloned

Try to use Data::Clone's `"clone"`, but fall back to using Clone::PP's `"clone"`.

### clone\_list(@data) =\> @data

A shortcut for:

```
 return map {clone($_)} @data
```

### unbless($ref) =\> $unblessed\_ref

Try to use Acme::Damn's `"damn"` to unbless a reference but fall back to shallow copying.

NOTE: `"damn()"` **MODIFIES** the original reference. (XXX in the future an option to clone the reference first will be provided), while shallow copying will return a shallow copy.

NOTE: The shallow copy method currently only handles blessed {scalar,array,hash}ref as those are the most common.

### uniq(@ary) =\> @uniq\_ary

Try to use List::MoreUtils's `"uniq"`, but fall back to using slower, pure-Perl implementation.

## HOMEPAGE

Please visit the project's homepage at \<https://metacpan.org/release/Function-Fallback-CoreOrPP\>.

## SOURCE

Source repository is at \<https://github.com/perlancar/perl-Function-Fallback-CoreOrPP\>.

## BUGS

Please report any bugs or feature requests on the bugtracker website \<https://rt.cpan.org/Public/Dist/Display.html?Name=Function-Fallback-CoreOrPP\>

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

## SEE ALSO

Clone::Any can also use multiple backends. I used to avoid it because Storable's `"dclone"` (which is used as the backend) did not support Regexp objects out of the box until version 3.08. Plus must use deparse to handle coderefs.

## AUTHOR

perlancar \<perlancar@cpan.org\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2020, 2017, 2016, 2014 by perlancar@cpan.org.

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