Perinci::Object::Function(3pm) | User Contributed Perl Documentation | Perinci::Object::Function(3pm) |
Perinci::Object::Function - Represent function metadata
This document describes version 0.311 of Perinci::Object::Function (from Perl distribution Perinci-Object), released on 2020-01-02.
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
This class provides an object-oriented interface for function metadata.
Create a new object from $meta. If $meta is undef, creates an empty metadata.
Will return "function".
Return the "features" property.
Get or set named feature (features property in metadata). If a feature doesn't exist, undef will be returned.
Check whether function can do dry run, either from the "dry_run" feature, or from the "tx" feature. (Transaction can be used to emulate dry run, by calling the function with "-tx_action => 'check_state'" only.)
Starting from Rinci 1.1.83, the "dry_run" feature property can be a hash instead of a bool, and can contain this pair "default=>1" to specify that dry-run mode should be the default operation (e.g. for safety).
Get or set argument (args property in metadata). If an argument doesn't exist, undef will be returned.
Please visit the project's homepage at <https://metacpan.org/release/Perinci-Object>.
Source repository is at <https://github.com/perlancar/perl-Perinci-Object>.
Please report any bugs or feature requests on the bugtracker website <https://github.com/perlancar/perl-Perinci-Object/issues>
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.
Perinci::Object
perlancar <perlancar@cpan.org>
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.
2022-10-13 | perl v5.34.0 |