The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Perinci::Use - Use a Riap package as if it was a local Perl module

VERSION

This document describes version 0.05 of Perinci::Use (from Perl distribution Perinci-Use), released on 2015-08-18.

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().

FUNCTIONS

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

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

{en_US "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[str]

    {en_US Do not load all children, only load specified ones}.

  • into* => str

    {en_US Perl package name to put proxy functions into}.

    {en_US Example: 'Foo::Bar', 'Example::Module'. }

  • url* => str

    {en_US Location of Riap package entity}.

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

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.

Return value: (undef)

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/perlancar/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

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 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.