view release on metacpan or search on metacpan
Perinci::Result::Format. There are now Perinci-CmdLine and
Perinci-CmdLine-Lite distributions.
- Refactoring: run() and run_*() now returns enveloped response instead
of int. All output is now returned as string by run_*() instead of
printed directly (except for streaming output).
- Refactoring: No long uses internal attributes like
$self->{_subcommand}. Instead, now a per-request (per-run())
stash/hash $r is passed around. This is not unlike the technique used
in Apache handlers and Data::Sah. It's cleaner because the
display_result() (should not be a problem because it's not yet
documented).
[ENHANCEMENTS]
- Support streaming output (function needs to set result metadata
is_stream => 1 and result needs to be glob/IO::Handle/array/tied
array, format needs to be text).
- Observe 'x.perinci.cmdline.default_format' metadata attribute.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Perinci/CmdLine/Inline.pm view on Meta::CPAN
my @modules_for_all_args;
my @req_stmts;
for my $arg (sort keys %$args_prop) {
my $arg_spec = $args_prop->{$arg};
# we don't validate streaming input for now
next if $arg_spec->{stream};
my $arg_schema = $arg_spec->{schema};
my $arg_term = '$args->{"'.$arg.'"}';
if (defined $arg_spec->{default}) {
lib/Perinci/CmdLine/Inline.pm view on Meta::CPAN
$shebang_line = $args{shebang} // $^X;
$shebang_line = "#!$shebang_line" unless $shebang_line =~ /\A#!/;
$shebang_line .= "\n" unless $shebang_line =~ /\R\z/;
}
# this will be removed if we don't use streaming input or read from
# stdin
$cd->{sub_srcs}{_pci_gen_iter} = <<'_';
require Data::Sah::Util::Type;
my ($fh, $type, $argname) = @_;
if (Data::Sah::Util::Type::is_simple($type)) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Perinci/CmdLine/Base.pm view on Meta::CPAN
#log_trace("TMP: handle cmdline_src for arg=%s", $an);
my $as = $args_p->{$an};
my $src = $as->{cmdline_src};
my $type = $as->{schema}[0]
or die "BUG: No schema is defined for arg '$an'";
# Riap::HTTP currently does not support streaming input
my $do_stream = $as->{stream} && $url !~ /^https?:/;
if ($src) {
die [531,
"Invalid 'cmdline_src' value for argument '$an': $src"]
unless $src =~ /\A(stdin|file|stdin_or_files?|stdin_or_args|stdin_line)\z/;
lib/Perinci/CmdLine/Base.pm view on Meta::CPAN
All direct subclasses of PC:Base do the formatting here.
=head2 $cmd->hook_display_result($r)
The hook is supposed to display the formatted result (stored in C<$r->{fres}>)
to STDOUT. But in the case of streaming output, this hook can also set it up.
All direct subclasses of PC:Base do the formatting here.
=head2 $cmd->hook_after_run($r)
lib/Perinci/CmdLine/Base.pm view on Meta::CPAN
and then skip saving output.
Data that is not representable as JSON will be cleansed using
L<Data::Clean::ForJSON>.
Streaming output will not be saved appropriately, because streaming output
contains coderef that will be called repeatedly during the normal displaying of
result.
=head2 PERINCI_CMDLINE_PLUGINS
view all matches for this distribution
view release on metacpan or search on metacpan
1.811.0 2018-03-17 Released-By: PERLANCAR
- Synchronize version with latest Perinci::CmdLine::Lite.
- [doc] Add FAQ section "Progress Indicator", add example for streaming
a file in output, add list of tutorial pages to fill in later.
1.77 2017-07-31 Released-By: PERLANCAR
view all matches for this distribution
view release on metacpan or search on metacpan
script/peri-eg-read-file view on Meta::CPAN
[--format-options=s] [--format=name] [--json] [--(no)naked-res]
[--no-config] [--no-env] <path>
=head1 DESCRIPTION
This function demonstrate output streaming of bytes.
To do output streaming, on the function side, you just return a coderef which
can be called by caller (e.g. CLI framework L<Perinci::CmdLine>) to read data
from. Code must return data or undef to signify exhaustion.
This works over remote (HTTP) too, because output streaming is supported by
L<Riap::HTTP> (version 1.2) and L<Perinci::Access::HTTP::Client>. Streams
are translated into HTTP chunks.
=head1 OPTIONS
view all matches for this distribution
view release on metacpan or search on metacpan
script/peri-eg-read-file-lite view on Meta::CPAN
[--(no)naked-res] [--no-config | -C] [--no-env]
[--page-result[=program]] <path>
=head1 DESCRIPTION
This function demonstrate output streaming of bytes.
To do output streaming, on the function side, you just return a coderef which
can be called by caller (e.g. CLI framework L<Perinci::CmdLine>) to read data
from. Code must return data or undef to signify exhaustion.
This works over remote (HTTP) too, because output streaming is supported by
L<Riap::HTTP> (version 1.2) and L<Perinci::Access::HTTP::Client>. Streams
are translated into HTTP chunks.
=head1 OPTIONS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Perinci/Examples/FilePartial.pm view on Meta::CPAN
The functions are separated into this module because these functions read/write
files on the filesystem and might potentially be dangerous if
`Perinci::Examples` is exposed to the network by accident.
See also `Perinci::Examples::FileStream` which uses streaming instead of
partial.
_
};
lib/Perinci/Examples/FilePartial.pm view on Meta::CPAN
The functions are separated into this module because these functions read/write
files on the filesystem and might potentially be dangerous if
C<Perinci::Examples> is exposed to the network by accident.
See also C<Perinci::Examples::FileStream> which uses streaming instead of
partial.
=head1 FUNCTIONS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Perinci/Sub/Wrapper.pm view on Meta::CPAN
"my \$err_$dn;",
"$cd->{result};",
);
if ($argspec->{stream}) {
$self->push_lines(
'if ('."\$err_$dn".') { die "Record #$i of streaming argument '."'$prefix$argname'".' ($rec) fails validation: '."\$err_$dn".'" }',
'$rec;',
);
} else {
$self->_errif(
400, qq["Argument '$prefix$argname' fails validation: \$err_$dn"],
view all matches for this distribution
view release on metacpan or search on metacpan
t/corpus-stack/HTTP-Handy/lib/HTTP/Handy.pm view on Meta::CPAN
psgi.version (PSGI requires [1,1]; not set)
psgi.multithread (not set; effectively false)
psgi.multiprocess (not set; effectively false)
psgi.run_once (not set; effectively false)
psgi.nonblocking (not set; always blocking)
psgi.streaming (not set; not supported)
Applications that check for these keys must treat their absence as false.
For full PSGI/1.1 compliance use L<Plack> (requires Perl 5.8+).
=head1 SECURITY
t/corpus-stack/HTTP-Handy/lib/HTTP/Handy.pm view on Meta::CPAN
=item * No HTTPS (see above)
=item * No chunked transfer encoding
=item * No streaming -- POST body and response body are fully buffered in memory
=item * Maximum POST body size: 10 MB by default (configurable via C<max_post_size>)
=item * No cookie or session management (implement in the application layer)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/PerlPoint/Generator.pm view on Meta::CPAN
[
"acceptedFormat=s@", # more accepted formats (embedded or included);
"activeContents", # evaluation of active contents;
"cache", # control the cache;
"cacheCleanup", # cache cleanup;
"dstreaming|docstreaming=s", # document stream handling (allow "docstreaming" for backwards compatibility);
"help", # online help, usage;
"imagedir|image_dir=s", # target image directory (allow "image_dir" for backwards compatibility with pp2html);
"imageref|image_ref=s", # target image directory reference (allow "image_ref" for backwards compatibility with pp2html);
"includelib=s@", # library pathes;
"nocopyright", # suppress copyright message;
lib/PerlPoint/Generator.pm view on Meta::CPAN
Cleans up the cache. Mostly invoked automatically. See docs for details.
EOO
dstreaming => <<EOO,
Document stream handling (for backwards compatibility, C<-docstreaming> can still be used).
Takes a numerical flag value as argument.
Example: -dstreaming 2
By default (or when 0 is passed as value), document streams are evaluated as streams. A value
of 1 ignores all docstreams, while a value of 2 treats docstream entry points as headlines.
For details about document streams please see the parser documentation and the tutorial.
lib/PerlPoint/Generator.pm view on Meta::CPAN
Example: -skipstream details
Note: you cannot skip the "main" stream.
Note: to skip document streams I<in general>, use C<-dstreaming 1>.
EOO
streamBuffer => <<EOO,
lib/PerlPoint/Generator.pm view on Meta::CPAN
skipcomments => exists $me->{options}{skipcomments},
docstreams2skip => exists $me->{options}{skipstream} ? $me->{options}{skipstream} : [],
docstreaming => (exists $me->{options}{dstreaming} and ($me->{options}{dstreaming}==DSTREAM_HEADLINES or $me->{options}{dstreaming}==DSTREAM_IGNORE)) ? $me->{options}{dstreaming} : DSTREAM_DEFAULT,
nestedTables => $me->{build}{nestedTables},
vispro => 1,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Perlbal/Plugin/PSGI.pm view on Meta::CPAN
'psgi.url_scheme' => 'http',
'psgi.nonblocking' => Plack::Util::TRUE,
'psgi.run_once' => Plack::Util::FALSE,
'psgi.multithread' => Plack::Util::FALSE,
'psgi.multiprocess' => Plack::Util::FALSE,
'psgi.streaming' => Plack::Util::TRUE,
REMOTE_ADDR => $pb->{peer_ip},
SERVER_NAME => $server_name,
SERVER_PORT => $server_port,
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Perlbal/Plugin/FlvStreaming.pm view on Meta::CPAN
=head1 NAME
Perlbal::Plugin::FlvStreaming - Enable FLV streaming with reverse proxy
=head1 DESCRIPTION
This plugin enable FLV streaming by modifying headers and prepending
FLV header to the body.
=head1 SYNOPSIS
LOAD FlvStreaming
lib/Perlbal/Plugin/FlvStreaming.pm view on Meta::CPAN
sub load { }
sub register {
my ($class, $svc) = @_;
unless ($svc && $svc->{role} eq "reverse_proxy") {
die "You can't load the flvstreaming plugin on a service not of role reverse_proxy.\n";
}
$svc->register_hook('FlvStreaming', 'start_proxy_request', \&start_proxy_request);
$svc->register_hook('FlvStreaming', 'modify_response_headers', \&modify_response_headers);
$svc->register_hook('FlvStreaming', 'prepend_body', \&prepend_body);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Perlito5X/Test2/API.pm view on Meta::CPAN
$hub->format(undef) if $hide;
}
}
elsif (! $parent->format) {
# If our parent has no format that means we're in a buffered subtest
# and now we're trying to run a streaming subtest. There's really no
# way for that to work, so we need to force the use of a buffered
# subtest here as
# well. https://github.com/Test-More/test-more/issues/721
$buffered = 1;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-basics.t view on Meta::CPAN
ok( my $oid = $o->pgblobs_create_blob() , "Blob is created");
ok( $oid = $o->pgblobs_store_blob('BINARYCONTENT') , "Something is stored in blob");
ok( my $rc = $o->pgblobs_fetch_blob($oid) , "Fetched content");
ok( $rc eq 'BINARYCONTENT' , "Same content was retrieved");
{
## A bit of cake streaming now
my $nslices = 1000;
my $cake;
my $read = sub{
unless( $nslices-- ){ return undef ;}
my $slice = int(rand(1000)) + 1 ;
view all matches for this distribution
view release on metacpan or search on metacpan
It handles normal indexes and C<PRIMARY KEY>, C<FOREIGN KEY> and C<UNIQUE>
constraints.
=head2 Streaming replication and throttling
Before creating the next index, the streaming replication lag is checked to
be below a certain limit. If so, nothing special happens and the index is
built.
Otherwise, C<rebuild> waits for the replicas to catch up. When the lag
drops under a second limit, the C<rebuild> does not immediately continue.
don't modify the database but print the essential SQL statements.
=item --high-txn-lag
the upper limit streaming replicas may lag behind in bytes.
Default is 10,000,000.
=item --low-txn-lag
view all matches for this distribution