Apache-LogFormat-Compiler
view release on metacpan or search on metacpan
"runtime" : {
"requires" : {
"POSIX" : "0",
"POSIX::strftime::Compiler" : "0.30",
"Time::Local" : "0",
"perl" : "5.008001"
}
},
"test" : {
"requires" : {
"HTTP::Request::Common" : "0",
"Test::MockTime" : "0",
"Test::More" : "0.98",
"Test::Requires" : "0",
"Try::Tiny" : "0.12",
"URI::Escape" : "1.60"
}
}
},
"provides" : {
"Apache::LogFormat::Compiler" : {
---
abstract: 'Compile a log format string to perl-code '
author:
- 'Masahiro Nagano <kazeburo@gmail.com>'
build_requires:
HTTP::Request::Common: '0'
Test::MockTime: '0'
Test::More: '0.98'
Test::Requires: '0'
Try::Tiny: '0.12'
URI::Escape: '1.60'
configure_requires:
Module::Build::Tiny: '0.035'
dynamic_config: 0
generated_by: 'Minilla/v3.1.7, CPAN::Meta::Converter version 2.150010'
license: perl
requires 'POSIX';
requires 'Time::Local';
requires 'perl', '5.008001';
requires 'POSIX::strftime::Compiler', '0.30';
on test => sub {
requires 'HTTP::Request::Common';
requires 'Test::More', '0.98';
requires 'Test::Requires';
requires 'Try::Tiny', '0.12';
requires 'URI::Escape', '1.60';
requires 'Test::MockTime';
};
eg/logbench.pl view on Meta::CPAN
use strict;
use Benchmark qw/ :all /;
use File::Temp qw/ tempfile /;
use Storable qw/ nstore retrieve /;
use HTTP::Request::Common;
my $result = {};
for my $name (qw! extlib-1.0022/lib/perl5 lib !) {
my ($fh, $fn) = tempfile();
my $pid = fork;
if ($pid) {
close $fh;
wait;
}
t/01_basic.t view on Meta::CPAN
use strict;
use warnings;
use HTTP::Request::Common;
require "./t/Req2PSGI.pm";
t::Req2PSGI->import();
use Test::More;
use Apache::LogFormat::Compiler;
{
my $log_handler = Apache::LogFormat::Compiler->new();
ok($log_handler);
my $log = $log_handler->log_line(
t::Req2PSGI::req_to_psgi(GET "/"),
t/02_custom.t view on Meta::CPAN
use strict;
use warnings;
use HTTP::Request::Common;
require "./t/Req2PSGI.pm";
t::Req2PSGI->import();
use Test::More;
use Apache::LogFormat::Compiler;
{
my $log_handler = Apache::LogFormat::Compiler->new(q!%{%S}t %{x-res-test}o %{x-req-test}i!);
ok($log_handler);
my $log = $log_handler->log_line(
t::Req2PSGI::req_to_psgi(GET "/", 'X-Req-Test'=>'foo'),
t/03_extra.t view on Meta::CPAN
use strict;
use warnings;
use HTTP::Request::Common;
require "./t/Req2PSGI.pm";
t::Req2PSGI->import();
use Test::More;
use Apache::LogFormat::Compiler;
{
my $log_handler = Apache::LogFormat::Compiler->new(
q!%z %{HTTP_X_FORWARDED_FOR|REMOTE_ADDR}Z!,
char_handlers => +{
'z' => sub {
use strict;
use warnings;
use Test::More;
use POSIX;
use Time::Local;
use Test::MockTime qw/set_fixed_time restore_time/;
require "./t/Req2PSGI.pm";
t::Req2PSGI->import();
use Apache::LogFormat::Compiler;
use HTTP::Request::Common;
sub time_difference {
my $now = time();
timegm(localtime($now)) - $now;
}
eval {
POSIX::tzset;
die q!tzset is implemented on this Cygwin. But Windows can't change tz inside script! if $^O eq 'cygwin';
die q!tzset is implemented on this Windows. But Windows can't change tz inside script! if $^O eq 'MSWin32';
t/Req2PSGI.pm view on Meta::CPAN
use Try::Tiny;
my $TRUE = (1 == 1);
my $FALSE = !$TRUE;
## copy from HTTP::Message::PSGI
## for remove Plack dependency fro ALFC
sub req_to_psgi {
my $req = shift;
unless (try { $req->isa('HTTP::Request') }) {
Carp::croak("Request is not HTTP::Request: $req");
}
# from HTTP::Request::AsCGI
my $host = $req->header('Host');
my $uri = $req->uri->clone;
$uri->scheme('http') unless $uri->scheme;
$uri->host('localhost') unless $uri->host;
$uri->port(80) unless $uri->port;
$uri->host_port($host) unless !$host || ( $host eq $uri->host_port );
my $input;
my $content = $req->content;
open $input, "<", \$content;
( run in 0.512 second using v1.01-cache-2.11-cpan-de7293f3b23 )