Apache2-API
view release on metacpan or search on metacpan
lib/Apache2/API/Request.pm view on Meta::CPAN
This is similar to the C<param> method. The main difference is that modifications to the scalar C<< $req->body() >> table affect the underlying C<apr_table_t> attribute in C<apreq_request_t>, so their impact will be noticed by all C<libapreq2> applic...
Contrary to perl hash, this uses L<APR::Table> and the order in the hash is preserved, so you could do:
my @body_names = $req->body;
my @body_names = %$body;
would yield the same thing.
This will throw an L<APR::Request::Error> object whenever L</body_status> returns a non-zero value.
Check L<Apache2::Request> and L<APR::Table> for more information.
=head2 body_status
my $int = $req->body_status; # should return 0
Returns the final status code of the body parser.
=head2 brigade_limit
lib/Apache2/API/Request/Params.pm view on Meta::CPAN
return;
}
return( $ERROR );
}
# Borrowed from Apache2::Upload so we can better trap exception and implement more methods
sub upload
{
# $self is a APR::Request::Apache2 object itself inheriting from APR::Request
my $self = shift( @_ );
# As per APR::Request: "upload() will throw an APR::Request::Error object whenever body_status() is non-zero"
my $body;
my $return = 0;
# try-catch
local $@;
eval
{
if( $self->body_status != 0 )
{
$ERROR = "APR::Request::body_status returned non-zero (" . $self->body_status . ")";
$return++;
lib/Apache2/API/Request/Params.pm view on Meta::CPAN
Other possible parameters are: L</brigade_limit>, L</disable_uploads>, L</read_limit>, L</temp_dir>, L</upload_hook>.
They can also be accessed as methods as documented below.
=head2 args
With no arguments, this method returns a tied L<APR::Request::Param::Table> object (or undef if the query string is absent) in scalar context, or the names (in order, with repetitions) of all the parsed query-string arguments.
With the $key argument, in scalar context this method fetches the first matching query-string arg. In list context it returns all matching args.
args() will throw an L<APR::Request::Error> object whenever args_status() is non-zero and the return value is potentially invalid (eg C<< scalar $req->args($key) >> will not die if the desired query argument was successfully parsed).
$args = $req->args;
@arg_names = $req->args;
if( $args->isa('APR::Request::Param::Table') )
{
# ok then
}
ok shift( @arg_names ) eq $_ for( keys( %$args ) );
$foo = $req->args( 'foo' );
lib/Apache2/API/Request/Params.pm view on Meta::CPAN
=head2 args_status
Returns the final status code of the L<Apache2::RequestRec> handle's query-string parser.
=head2 body
With no arguments, this method returns a tied L<APR::Request::Param::Table> object (or undef if the request body is absent) in scalar context, or the names (in order, with repetitions) of all the parsed cookies.
With the $key argument, in scalar context this method fetches the first matching body param. In list context it returns all matching body params.
L</body> will throw an L<APR::Request::Error> object whenever body_status() is non-zero and the return value is potentially invalid (eg C<< scalar $req->body($key) >> will not die if the desired body param was successfully parsed).
my $body = $req->body;
my @body_names = $req->body;
if( $body->isa('APR::Request::Param::Table') )
{
# ok then
}
ok shift( @body_names ) eq $_ for( keys( %$body ) );
my $alpha = $req->body( 'alpha' );
lib/Apache2/API/Request/Params.pm view on Meta::CPAN
=head2 jar_status
Returns the final status code of the L<Apache2::RequestRec> handle's cookie header parser.
=head2 param
With no arguments, this method returns a tied L<APR::Request::Param::Table> object (or undef, if the query string and request body are absent) in scalar context, or the names (in order, with repetitions) of all the incoming (args + body) params.
With the $key argument, in scalar context this method fetches the first matching param. In list context it returns all matching params.
L</param> will throw an L<APR::Request::Error> object whenever param_status() is non-zero and the return value is potentially invalid (eg C<scalar $req->param($key)> will not die if the desired param was successfully parsed).
my $param = $req->param;
my @param_names = $req->param;
if( $param->isa(' APR::Request::Param::Table' ) )
{
# ok then
}
ok shift( @param_names ) eq $_ for( keys( %$param ) );
my $foo = $req->param( 'foo' );
( run in 0.293 second using v1.01-cache-2.11-cpan-496ff517765 )