Perinc...unction(3pm)

πŸ“¦
version 0.311 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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_run feature, or
  • the tx feature β€” 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 ⭐

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