App-PerinciUtils
view release on metacpan or search on metacpan
script/peri-htserve view on Meta::CPAN
_
},
riap_access_log_histories => {
schema => ['int' => {}],
summary => 'Number of old Riap request access log files to keep',
description => <<'_',
Default is to use File::Write::Rotate's default (10).
_
},
server => {
schema => ['str*' => {
in => [qw/Starman Gepok/],
default => 'Gepok',
}],
summary => 'Choose PSGI server',
description => <<'_',
Currently only Starman or Gepok is supported. Default is Gepok.
_
},
starman_host => {
schema => ['str' => {}],
summary => 'Will be passed to Starman',
},
starman_port => {
schema => ['int' => {}],
summary => 'Will be passed to Starman',
},
gepok_http_ports => {
schema => ['str' => {}],
summary => 'Will be passed to Gepok',
},
gepok_https_ports => {
schema => ['str' => {}],
summary => 'Will be passed to Gepok',
},
gepok_unix_sockets => {
schema => ['str' => {}],
summary => 'Will be passed to Gepok',
},
gepok_ssl_key_file => {
schema => ['str' => {}],
summary => 'Will be passed to Gepok',
},
gepok_ssl_cert_file => {
schema => ['str' => {}],
summary => 'Will be passed to Gepok',
},
gepok_start_servers => {
schema => ['int' => {}],
summary => 'Will be passed to Gepok',
},
daemonize => {
schema => ['bool' => {
default => 0,
}],
summary => 'If true, will daemonize into background',
cmdline_aliases => {D=>{}},
},
library => {
schema => ['array' => {
of => 'str*',
}],
summary => 'Add directory to library search path, a la Perl\'s -I',
description => <<'_',
Note that some modules are already loaded before this option takes effect. To
make sure some directories are processed, you can use `PERL5OPT` or explicitly
use `perl` and use its `-I` option.
_
cmdline_aliases => {I=>{}},
cmdline_on_getopt => sub {
my %args = @_;
require lib;
lib->import($args{value});
},
},
use => {
schema => ['array' => of => 'str*'],
summary => 'Use a Perl module, a la Perl\'s -M',
cmdline_aliases => {M=>{}},
cmdline_on_getopt => sub {
my %args = @_;
my $val = $args{value};
if (my ($mod, $imp) = $val =~ /(.+?)=(.+)/) {
load $mod;
$mod->import(split /,/, $imp);
} else {
autoload $val;
}
},
},
require => {
schema => ['array' => of => 'str*'],
summary => 'Require a Perl module, a la Perl\'s -m',
cmdline_aliases => {m=>{}},
cmdline_on_getopt => sub {
my %args = @_;
load $args{val};
},
},
parse_form => {
schema => ['bool'],
summary => 'Passed to Plack::Middleware::PeriAHS::ParseRequest',
},
parse_reform => {
schema => ['bool'],
summary => 'Passed to Plack::Middleware::PeriAHS::ParseRequest',
},
parse_path_info => {
schema => ['bool'],
summary => 'Passed to Plack::Middleware::PeriAHS::ParseRequest',
},
user => {
schema => ['str*'],
script/peri-htserve view on Meta::CPAN
=pod
=encoding UTF-8
=head1 NAME
peri-htserve - Serve Perl modules over HTTP(S) using Riap::HTTP protocol
=head1 VERSION
This document describes version 0.112 of peri-htserve (from Perl distribution App-PerinciUtils), released on 2019-01-20.
=head1 SYNOPSIS
# serve modules over HTTP, using default options (HTTP port 5000)
$ peri-htserve Foo::Bar Baz::*
# you can now do
$ curl 'http://localhost:5000/api/Baz/SubMod/func1?arg1=1&arg2=2'
[200,"OK",{"The":"result","...":"..."}]
# or use the Perl client
$ perl -MPerinci::Access -e'
my $pa = Perinci::Access->new;
my $res = $pa->request(call=>"http://localhost:5000/api/Foo/Bar/func2");'
### some other peri-htserve options:
# change ports/etc (see http_ports, https_ports, and unix_sockets in Gepok doc)
$ peri-htserve --http-ports "localhost:5000,*:80" ...
# see all available options
$ peri-htserve --help
=head1 DESCRIPTION
For now, please see source code for more details (or --help).
=head1 QUICK TIPS
=head2 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.
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
=item B<--daemonize>, B<-D>
If true, will daemonize into background.
=item B<--disable-logging>
=item B<--gepok-http-ports>=I<s>
Will be passed to Gepok.
=item B<--gepok-https-ports>=I<s>
Will be passed to Gepok.
=item B<--gepok-ssl-cert-file>=I<s>
Will be passed to Gepok.
=item B<--gepok-ssl-key-file>=I<s>
Will be passed to Gepok.
=item B<--gepok-start-servers>=I<s>
Will be passed to Gepok.
=item B<--gepok-unix-sockets>=I<s>
Will be passed to Gepok.
=item B<--library-json>=I<s>, B<-I>
Add directory to library search path, a la Perl's -I (JSON-encoded).
See C<--library>.
=item B<--library>=I<s@>
Add directory to library search path, a la Perl's -I.
Note that some modules are already loaded before this option takes effect. To
make sure some directories are processed, you can use `PERL5OPT` or explicitly
use `perl` and use its `-I` option.
Can be specified multiple times.
=item B<--metadb>=I<s>
Path to SQLite Rinci metadata database.
This is an experimental option for testing serving metadata from database. If
set, will use `Perinci::Access::Schemeless::DBI` (with option
`fallback_on_completion`) instead of `Perinci::Access::Schemeless` for the Riap
client.
=item B<--module-or-package-json>=I<s>
List of modules to load (or package to allow and search) (JSON-encoded).
See C<--module-or-package>.
( run in 2.458 seconds using v1.01-cache-2.11-cpan-d8267643d1d )