NAME¶
Perinci::Object::function - Represent function metadata
VERSION¶
version 0.13
SYNOPSIS¶
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
DESCRIPTION¶
This class provides an object-oriented interface for function metadata.
METHODS¶
Create a new object from $meta. If $meta is undef, creates an empty metadata.
$risub->features => HASH¶
Return the "features" property.
$risub->feature(NAME[, VALUE])¶
Get or set named feature (
features property in metadata). If a feature
doesn't exist, undef will be returned.
$risub->can_dry_run => BOOL¶
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.)
$risub->arg(NAME[, VALUE])¶
Get or set argument (
args property in metadata). If an argument doesn't
exist, undef will be returned.
SEE ALSO¶
Perinci::Object
HOMEPAGE¶
Please visit the project's homepage at
<
https://metacpan.org/release/Perinci-Object>.
SOURCE¶
Source repository is at
<
https://github.com/sharyanto/perl-Perinci-Object>.
BUGS¶
Please report any bugs or feature requests on the bugtracker website
<
https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-Object>
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.
AUTHOR¶
Steven Haryanto <stevenharyanto@gmail.com>
COPYRIGHT AND LICENSE¶
This software is copyright (c) 2014 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same
terms as the Perl 5 programming language system itself.