Functi...reOrPP(3pm)
π Function::Fallback::CoreOrPP π
okay bestie, gather round, because this one is Function::Fallback::CoreOrPP(3pm) β a lil Perl module that's literally the "if you don't got the fancy stuff, I got you" friend of the CPAN world. π«Ά
β¨ VERSION β¨
This doc describes version 0.090 of Function::Fallback::CoreOrPP (it comes from the Perl distribution Function-Fallback-CoreOrPP), and it dropped 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 β¨
So here's the vibe: this module hands you functions that prefer the non-core XS modules β because speed, reliability, features, all that good good β¨ β but if that non-core XS module isn't installed, it gracefully falls back to versions built on core XS or plain pure-Perl modules. No drama, no crash, it just adapts. π
And why do you care? Because this is the move when you wanna bootstrap your Perl app as a portable, dependency-free Perl script. In a vanilla Perl installation (aka the one that only has core modules), you can use App::FatPacker to pack non-core pure-Perl dependencies straight into your script. Iconic behavior, honestly. π₯
β¨ FUNCTIONS β¨
πΈ clone($data) => $cloned
It tries to use Data::Clone's "clone" first, and if that's not around, it falls back to Clone::PP's "clone". Either way, you get a clone. Slay. π
πΈ clone_list(@data) => @data
Just a lil shortcut, and it's exactly this:
return map {clone($_)} @data
πΈ unbless($ref) => $unblessed_ref
It tries to use Acme::Damn's "damn" to unbless a reference, but falls back to shallow copying.
NOTE: "damn()" MODIFIES the original reference. (XXX β in the future an option to clone the reference first will be provided.) Meanwhile, the shallow copying route returns a shallow copy. π
NOTE: The shallow copy method currently only handles blessed {scalar,array,hash}ref, because honestly those are the most common ones. π«Ά
πΈ uniq(@ary) => @uniq_ary
It tries to use List::MoreUtils's "uniq", but falls back to a slower, pure-Perl implementation when it has to. Not the fastest, but it shows up. π
β¨ HOMEPAGE β¨
Come visit the project's homepage, it's cute, I promise: <https://metacpan.org/release/Function-Fallback-CoreOrPP> π¦
β¨ SOURCE β¨
The source repo lives right here: <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> π
And when you submit a bug or a request, pleaaase include a test-file or a patch to an existing test-file that shows off the bug or the feature you want. That's the whole assignment, bestie. π
β¨ SEE ALSO β¨
Clone::Any can also use multiple backends, no cap. The author used to avoid it because Storable's "dclone" (which is the backend it uses) didn't support Regexp objects out of the box until version 3.08. Plus, it has to use deparse to handle coderefs. So, y'know. β¨
β¨ 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.
okay that's the whole page, you ate it, periodt π this was perl v5.36.0, dated 2022-11-19, and yes the manual name got a lil chopped in the header as Functi...reOrPP(3pm) β that's just the man page being extra, not you. bye bestie, go clone something πΈπ
π¦ where this page comes from
- debian bookworm: libfunction-fallback-coreorpp-perl 0.090-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libfunction-fallback-coreorpp-perl 0.090-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libfunction-fallback-coreorpp-perl 0.090-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libfunction-fallback-coreorpp-perl 0.090-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libfunction-fallback-coreorpp-perl 0.090-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms