Apache2-API
view release on metacpan or search on metacpan
lib/Apache2/API/Request.pm view on Meta::CPAN
my $upload_fields = {};
# To make it easy to check if it exists
if( scalar( @uploads ) )
{
@$upload_fields{ @uploads } = ( 1 ) x scalar( @uploads );
}
my $form = {};
#my $io = IO::File->new( ">/tmp/form_data.txt" );
#my $io2 = IO::File->new( ">/tmp/form_data_after_our_decoding.txt" );
#my $raw = IO::File->new( ">/tmp/raw_form_data.txt" );
#$io->binmode( ':utf8' );
#$io2->binmode( ':utf8' );
foreach my $k ( @params )
{
my( @values ) = $r->param( $k );
#$raw->print( "$k => " );
#$io->print( "$k => " );
my $name = utf8::is_utf8( $k ) ? $k : Encode::decode_utf8( $k );
#$io2->print( "$name => " );
$form->{ $name } = scalar( @values ) > 1 ? \@values : $values[0];
if( CORE::exists( $upload_fields->{ $name } ) )
{
t/lib/Test/Apache2/Common.pm view on Meta::CPAN
unless( $base_path = $class2log->{ ref( $obj ) } )
{
my @parts = split( /::/, ref( $obj ) );
my $parent_path = $config->{vars}->{t_logs} || die( "No 't_logs' variable in Apache::TestConfig->thaw->httpd_config" );
$parent_path = file( $parent_path );
$base_path = $parent_path->child( join( '/', map( lc( $_ ), split( /::/, ref( $obj ) ) ) ) );
$base_path->mkpath if( !$base_path->exists );
$class2log->{ ref( $obj ) } = $base_path;
}
my $log_file = $base_path->child( "${meth}.log" );
my $io = $log_file->open( '>', { autoflush => 1, binmode => 'utf8' } ) ||
die( "Unable to open test log file \"$log_file\" in write mode: $!" );
my $val = $args ? $code->( $obj, @$args ) : $code->( $obj );
my $rv;
if( ref( $expect ) eq 'CODE' )
{
$rv = $expect->( $val, { object => $self, log => sub{ $io->print( @_, "\n" ) } } );
}
elsif( $opts->{type} eq 'boolean' )
{
( run in 0.256 second using v1.01-cache-2.11-cpan-8d75d55dd25 )