NAME
Sub::Spec::Use - Load a module specified using Sub::Spec URI
VERSION
version 0.02
SYNOPSIS
use Sub::Spec::Use "http://example.com/My::Math" => qw(pyth);
print pyth(3, 4); # 5
use Sub::Spec::Use "http://example.com/My::Math" => qw(:all);
DESCRIPTION
NOTICE: This module and the Sub::Spec standard is deprecated as of Jan 2012. Rinci is the new specification to replace Sub::Spec, it is about 95% compatible with Sub::Spec, but corrects a few issues and is more generic. Perinci::*
is the Perl implementation for Rinci and many of its modules can handle existing Sub::Spec sub specs.
This module provides load_ss_module(), usually used as shown in Synopsis, a la Perl's use().
This module uses Log::Any for logging.
FUNCTIONS
None are exported.
load_ss_module(%args) -> [STATUS_CODE, ERR_MSG, RESULT]
Load a module specified using Sub::Spec URI.
"Load" a module specified by using Sub::Spec::URI (e.g. pm://Foo::Bar or http://example.com/Foo::Bar). Actually, what is being done is query the remote URI for available functions, and for each function, create a proxy (and get its spec from the URI, if available). The proxy function will then call the remote function.
Returns a 3-element arrayref. STATUS_CODE is 200 on success, or an error code between 3xx-5xx (just like in HTTP). ERR_MSG is a string containing error message, RESULT is the actual result.
Arguments (*
denotes required arguments):
into => str
Package name to put proxy functions into.
Default is to be determined from URI. For example, if URI is pm://Foo::Bar, then 'into' will be set to 'Foo::Bar'.
uri* => str
Location of module.
TODO
* Can't work with other server URI's except pm://
SEE ALSO
AUTHOR
Steven Haryanto <stevenharyanto@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 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.