NAME

servepm - Serve Perl modules over HTTP(S) using the Sub::Spec::HTTP protocol

VERSION

version 0.12

SYNOPSIS

# serve modules over HTTP, using default options (HTTP port 5000)
$ servepm Foo::Bar Baz::*

# you can now do
$ curl 'http://localhost:5000/api/Baz::Sub/func1?arg1=1&arg2=2'
[200,"OK",{"The":"result","...":"..."}]

# or use the Perl client
$ perl -MSub::Spec::URI -e'
    my $r = Sub::Spec::URI->new("http://localhost:5000/api/Foo::Bar/func2");
    $r->call(arg1 => 1, arg2 => 2);'


### some other servepm options:

# preload modules
$ servepm --preload Foo::Bar ...

# change ports/etc (see http_ports, https_ports, and unix_sockets in Gepok doc)
$ servepm --http-ports "localhost:5000,*:80" ...

# see all available options
$ servepm --help

DESCRIPTION

For now, please see source code for more details (or --help).

QUICK TIPS

Complex argument

In raw HTTP, you can send complex argument by encoding it in JSON, e.g.:

$ curl 'http://localhost:5000/api/Foo::Bar/func?array:j=[1,2,3]'

Notice the ":j" suffix after parameter name.

TODO

* Pass more plackup options.

* Pass more server options.

SEE ALSO

Gepok

Plack::Runner, plackup

Sub::Spec::Gen::ForModule

Sub::Spec::HTTP

Sub::Spec::HTTP::Server

Sub::Spec::URI, Sub::Spec::URI::http

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.