NAME
    Sub::Spec::URI - Refer to module/sub/spec/sub call via URI string

VERSION
    version 0.04

SYNOPSIS
     use Sub::Spec::URI;

     # refer to local subroutine
     my $lsub = Sub::Spec::URI->new("pm://Mod::SubMod::func");

     # refer to remote subroutine
     my $rsub = Sub::Spec::URI->new("http://HOST/api/MOD/SUBMOD/FUNC");

     # get URI components
     print $lsub->module; # Mod::SubMod
     print $rsub->sub;    # FUNC

     # get subroutine's spec
     my $spec = $lsub->spec;

     # call subroutine
     my $res = $rsub->call(arg1=>'foo', arg2=>'bar');


     # refer to a module
     my $mod = Sub::Spec::URI->new("http://HOST/api/MOD/");

     # list subroutines
     my $subs = $mod->list_subs;

DESCRIPTION
    This module lets you create an object that can represent a remote or
    local module/subroutine/spec/subroutine call. This module is basically a
    convenience so that we can represent those things using a string (URI),
    e.g. from a command-line or inside another URI/URL.

    Each scheme is handled by Sub::Spec::URI::<SCHEME>, e.g.
    Sub::Spec::URI::pm for local Perl modules/subroutines,
    Sub::Spec::URI::http for remote subroutines over HTTP.

METHODS
  new(STR) => OBJ
    Create a new object from URI string. Will die if URI can't be parsed
    (e.g. unknown scheme or bad syntax).

  $s->module() => STR
    Get the module name, or undef if not specified in URI.

  $s->sub() => STR
    Get the subroutine name, or undef if not specified in URI.

  $s->args() => HASHREF
    Get the arguments, or empty hash if none are specified in URI.

  $s->list_subs() => ARRAYREF
    Try to list subroutines in a module. URI must specify module. Will die
    if fail to retrieve, e.g. can't require module (for local modules) or
    connection failure (for remote modules).

  $s->spec() => HASHREF
    Try to get spec for subroutine. URI must specify module and subroutine
    name.

  $s->call(%args) => RESULT
    Try to call subroutine. URI must specify module and subroutine name.
    Will die if failure happens.

SEE ALSO
    Sub::Spec

    Sub::Spec::HTTP

AUTHOR
    Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2011 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.

