NAME
Net::Respite::CommandLine - Provide an easy way to get commandline abstraction of Net::Respite::Base
$Id: CommandLine.pod,v 1.4 2013/09/23 19:13:18 paul Exp $
SYNOPSIS
use Net::Respite::CommandLine;
# run under a local interface (on the server)
Net::Respite::CommandLine->run({
api_meta => 'Some::Class',
});
# Also on the server
Net::Respite::CommandLine->run({
api_meta => { # will use Net::Respite::Base
methods => {
foo => sub { return {FOO => 1} },
},
},
});
# run under a remote interface (on a client)
use Net::Respite::CommandLine;
Net::Respite::CommandLine->run({
api_meta => {
remote => 1, # will use Net::Respite::Client
service => 'foo',
host => 'localhost',
brand => 'test',
pass => '-',
port => 50000,
no_ssl => 1,
},
});
# it is also possible to use this as a reusable service in other utilities
my $cmdclient = Net::Respite::CommandLine->new({api_meta => {service => 'dist', port => 50905, host => 'example.com'}});
my $data = $cmdclient->run_method(hello => {foo => 1});
# will prompt for password
my $data = $cmdclient->run_method(hello => {test_auth => 1});
OPTIONS
- api_meta
-
May be a class name, or a hashref of information necessary for passing to Net::Respite::Base or Net::Respite::Client. If it is a classname, it should be capable of handling run_method (typically should be a subclass of Net::Respite::Base). Otherwise the hashref should conform to the standards for Net::Respite::Base. If a api_meta contains a true value for "remote", then Net::Respite::Client will be used instead.