Perinci::Examples - Example modules containing metadata and various example functions
version 0.18
use Perinci::Examples qw(delay); delay();
This module and its submodules contain an odd mix of various functions, variables, and other code entities, along with their Rinci metadata. Mostly used for testing Rinci specification and the various Perinci modules.
Example scripts are put in a separate distribution (see Perinci::Examples::Bin) to make dependencies for this distribution minimal (e.g. not depending on Perinci::CmdLine) since this example module(s) are usually used in the tests of other modules.
{en_US A sample description
verbatim line2
Another paragraph with bold, italic text. }
{en_US Demonstrate argument default value from default and/or schema}.
Arguments ('*' denotes required arguments):
a => int
b => int (default: 2)
c => int (default: 3)
d => int (default: 4)
Return value:
Returns an enveloped result (an array). First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
{en_US Call gen_array()}.
{en_US This is to test nested call (e.g. Log::Any::For::Package). }
len* => int (default: 10)
{en_US Call randlog()}.
max_level => int (default: 6)
min_level => int (default: 1)
n => int (default: 10)
{id_ID Tidur, defaultnya 10 detik}.
{idID Dapat dipakai untuk menguji properti *timelimit*. }
per_second => bool (default: 0)
{en_US Dies tragically}.
{en_US Can be used to test exception handling. }
No arguments.
{en_US Return error response}.
{en_US }
code => int (default: 500)
{en_US Generate an array of specified length}.
{en_US Also tests result schema. }
{en_US Generate a hash with specified number of pairs}.
pairs => int
{en_US Merge two hashes}.
{en_US This function can be used to test passing nonscalar (hash) arguments. }
h1* => hash
h2* => hash
{en_US Do nothing, return original argument}.
This function is pure (produce no side effects).
arg => any
{en_US Produce some random Log::Any log messages}.
{en_US Sum numbers in array}.
Examples:
sum(array => [1, 2, 3]); # -> 6 sum(array => [1.1, 2.1, 3.1], round => 1); # -> 6 sum(array => ["a"]); # ERROR 400 sum(); sum();
{en_US This function can be used to test passing nonscalar (array) arguments. }
array* => array
round => bool (default: 0)
{en_US Do nothing, return nothing}.
{en_US This function is used to test argument completion. }
f1 => float
i1 => int
i2 => int
s1 => str
s2 => str
s3 => str
{en_US Does nothing, only here to test # VALIDATE_ARGS}.
b => str
h1 => hash
{en_US This function has several undescribed args}.
{en_US Originally added to see how peri-func-usage or Perinci::To::Text will display the usage or documentation for this function. }
arg1 => any
arg2 => any
arg3 => any
arg4 => any
Perinci
Perinci::Examples::Bin
Please visit the project's homepage at https://metacpan.org/release/Perinci-Examples.
Source repository is at https://github.com/sharyanto/perl-Perinci-Examples.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-Examples
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.
Steven Haryanto <stevenharyanto@gmail.com>
This software is copyright (c) 2013 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.
To install Perinci::Examples, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perinci::Examples
CPAN shell
perl -MCPAN -e shell install Perinci::Examples
For more information on module installation, please visit the detailed CPAN module installation guide.