Perinc...unction(3pm)
π Perinci::Object::Function π
okay bestie, welcome to the User Contributed Perl Documentation section 3pm β yes, that's the manual name, that's where we live now π and today we're unpacking Perinci::Object::Function, aka the literal icon that represents function metadata. slay.
β¨ NAME β¨
Perinci::Object::Function β she represents function metadata. main character energy fr fr π
πΈ VERSION πΈ
This doc is describing version 0.311 of Perinci::Object::Function (she comes from the Perl distribution called Perinci-Object), and she was released on 2020-01-02. a whole vintage queen π
π¦ SYNOPSIS π¦
here's the vibe in code form, no notes:
use Perinci::Object;
$SPEC{foo} = {
v => 1.1,
args => { b => {schema=>'int', req=>0} },
features => {idempotent=>1},
};
my $risub = risub $SPEC{foo};
print $risub->feature('idempotent'), # 1
$risub->arg('b')->{req}, # 0
$risub->arg('a'); # undef
like look at her go, all those prints hitting different π₯
π DESCRIPTION π
so basically this class is giving you an object-oriented interface for function metadata. that's it, that's the whole thing. a little wrapper, a little glow-up, so you don't have to rawdog a plain hash. lowkey iconic.
π METHODS π
new($meta) => OBJECT
make a brand new object out of $meta, bestie. and if $meta is undef? no worries, you get an empty metadata back. starting fresh, clean girl aesthetic β¨
$risub->type => str
she's gonna return "function". always. no cap. it's giving self-aware π«Ά
$risub->features => HASH
hands you back the "features" property. the whole hash of it π
$risub->feature(NAME[, VALUE])
get it or set it β the named feature, that is (which lives in the features property of the metadata). and if that feature simply does not exist? undef is what you get back. sorry bestie, she's honest π
$risub->can_dry_run => BOOL
okay this one checks whether the function can do a dry run. two ways she says yes:
- the
dry_runfeature, or - the
txfeature β because (and this is the spicy part, and no I'm not making it up) a transaction can be used to emulate dry run, by calling the function with-tx_action => 'check_state'only.
that's the lore. periodt π
$risub->default_dry_run => BOOL
starting from Rinci 1.1.83, the dry_run feature property can be a hash instead of a bool β glow-up era β and inside that hash she can carry this pair: default=>1. and what does that mean? it means dry-run mode should be the default operation (e.g. for safety). safety queen behavior, we love to see it π§
$risub->arg(NAME[, VALUE])
get or set an argument (yep, that's the args property in the metadata). and if an argument doesn't exist, undef gets returned. same energy as feature, same honesty π
π HOMEPAGE π
please visit the project's homepage, she'd love that for her:
π SOURCE π
the source repo lives here, go be nosy bestie:
π BUGS π
got bugs? feature requests? please report them on the bugtracker website:
and when you do submit a bug or a request, please include a test-file or a patch to an existing test-file that illustrates the bug or the desired feature. don't just show up with vibes, show up with evidence π
π SEE ALSO π
Perinci::Object
π AUTHOR π
perlancar <perlancar@cpan.org> β the legend, the blueprint, the moment β
πΈ COPYRIGHT AND LICENSE πΈ
This software is copyright (c) 2021, 2017, 2016, 2015, 2014, 2013, 2012, 2011 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. free as in do-what-you-want-with-the-right-terms, bestie π«Ά
okay and that's a wrap!! this page came from perl v5.36.0, dated 2022-10-13, and it was filed under Perinc...unction(3pm) because even the footer couldn't fit the whole name in β the archive said "we'll truncate it, it'll be fine π". anyway, go forth and object-orient your metadata, you absolute icon π
β¨π
π¦ where this page comes from
- ubuntu noble: libperinci-object-perl 0.311-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libperinci-object-perl 0.311-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libperinci-object-perl 0.311-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