Steven Haryanto

NAME

Perinci::Use - Use a Riap package like a local Perl module

VERSION

This document describes version 0.04 of Perinci::Use (from Perl distribution Perinci-Use), released on 2014-05-26.

SYNOPSIS

 # import pyth()
 use Perinci::Use "http://example.com/My/Math", 'pyth';
 print pyth(3, 4); # 5

 # import all
 use Perinci::Use "http://example.com/My/Math";

DESCRIPTION

This module provides use_riap_package(), usually used as shown in Synopsis, a la Perl's use().

This module uses Log::Any for logging.

FUNCTIONS

None are exported.

use_riap_package(%args) -> [status, msg, result, meta]

Use a Riap package as if it was a local Perl module.

"Use" a remote code package over Riap protocol as if it was a local Perl module. Actually, what is being done is query the remote URL for available functions, and for each remote function, create a proxy function. The proxy function will then call the remote function.

Currently only functions are imported. Variables and other entities are ignored.

Arguments ('*' denotes required arguments):

  • include => array

    Do not load all children, only load specified ones.

  • into* => str

    Perl package name to put proxy functions into.

    Example: 'Foo::Bar', 'Example::Module'.

  • url* => str

    Location of Riap package entity.

    Example: '/Foo/Bar/' (local Perl module), 'http://example.com/api/Module/'.

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.

SEE ALSO

Perinci::Access

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Perinci-Use.

SOURCE

Source repository is at https://github.com/sharyanto/perl-Perinci-Use.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-Use

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.




Hosting generously
sponsored by Bytemark