App-plackbench
view release on metacpan or search on metacpan
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: App-plackbench
requires:
Getopt::Long: '0'
HTTP::Request: '0'
List::Util: '0'
Plack: '0'
Scalar::Util: '0'
Time::HiRes: '0'
perl: v5.10.1
resources:
homepage: https://github.com/pboyd/App-plackbench
repository: https://github.com/pboyd/App-plackbench.git
version: '0.7'
x_generated_by_perl: v5.40.0
Makefile.PL view on Meta::CPAN
},
"DISTNAME" => "App-plackbench",
"EXE_FILES" => [
"bin/plackbench"
],
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.010001",
"NAME" => "App::plackbench",
"PREREQ_PM" => {
"Getopt::Long" => 0,
"HTTP::Request" => 0,
"List::Util" => 0,
"Plack" => 0,
"Scalar::Util" => 0,
"Time::HiRes" => 0
},
"TEST_REQUIRES" => {
"Class::Load" => 0,
"FindBin" => 0,
"Test::Deep" => 0,
"Test::More" => 0
Makefile.PL view on Meta::CPAN
"test" => {
"TESTS" => "t/*.t"
}
);
my %FallbackPrereqs = (
"Class::Load" => 0,
"FindBin" => 0,
"Getopt::Long" => 0,
"HTTP::Request" => 0,
"List::Util" => 0,
"Plack" => 0,
"Scalar::Util" => 0,
"Test::Deep" => 0,
"Test::More" => 0,
"Time::HiRes" => 0
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
bin/plackbench view on Meta::CPAN
Make a POST request instead of a GET. Pass the path to a file with the raw
URL-encoded POST data. If the file contains multiple lines, each will be used a
separate POST request.
If the file is a '-', the POST body will be read from STDIN.
=item -e <code>
Pre-process the request using the Perl code passed. C<$_> will be set to a
L<HTTP::Request> object.
For example, to set the User-Agent:
plackbench -e '$_->header("User-Agent" => "Mozilla")' /path/to/app.psgi /
=item -f <file>
Like C<-e>, however the code is read from a file. Should return a code
reference, which will be passed a C<HTTP::Request> object.
A simple example:
sub {
my $request = shift;
$request->header( Cookie => 'session=mysid' );
return;
}
The file can contain any valid Perl code, but the last statement in the file
[PkgVersion]
[GithubMeta]
user = pboyd
[Prereqs]
perl = 5.10.1
[Prereqs / RuntimeRequires]
Getopt::Long = 0
HTTP::Request = 0
List::Util = 0
Plack = 0
Scalar::Util = 0
Time::HiRes = 0
[Prereqs / TestRequires]
Test::More = 0
Test::Deep = 0
FindBin = 0
Class::Load = 0
lib/App/plackbench.pm view on Meta::CPAN
package App::plackbench;
$App::plackbench::VERSION = '0.7';
use strict;
use warnings;
use autodie;
use v5.10;
use HTTP::Request qw();
use List::Util qw( reduce );
use Plack::Test qw();
use Plack::Util qw();
use Scalar::Util qw( reftype );
use Time::HiRes qw( gettimeofday tv_interval );
use App::plackbench::Stats;
my %attributes = (
app => \&_build_app,
lib/App/plackbench.pm view on Meta::CPAN
$self->_execute_request(@_);
return tv_interval( \@start );
}
sub _create_requests {
my $self = shift;
my @requests;
if ( $self->post_data() ) {
@requests = map {
my $req = HTTP::Request->new( POST => $self->uri() );
$req->content($_);
$req;
} @{ $self->post_data() };
}
else {
@requests = ( HTTP::Request->new( GET => $self->uri() ) );
}
$self->_fixup_requests(\@requests);
return \@requests;
}
sub _fixup_requests {
my $self = shift;
my $requests = shift;
lib/App/plackbench.pm view on Meta::CPAN
=head2 warm
If true, an initial request will be made which won't be included in the stats.
Defaults to false.
=head2 fixup
An arrayref of subroutine references to do any preprocessing of the request.
Each subroutine reference will be called in order (though you shouldn't rely on
that) and passed a reference to the L<HTTP::Request> object.
Each sub will be called once for every unique request. Under a normal GET
request, there will only be one unique request. However if L</post_data> is
being used there will be one unique request for request body.
The return value from the subs is ignored.
=head2 post_data
An arrayref of request bodies. If set, POST requests will be made instead of
( run in 0.405 second using v1.01-cache-2.11-cpan-de7293f3b23 )