Acme-ReturnValue
view release on metacpan or search on metacpan
t/pms/MockTime.pm view on Meta::CPAN
set_relative_time
set_absolute_time
set_fixed_time
restore_time
);
our %EXPORT_TAGS = (
'all' => \@EXPORT_OK,
);
our ($VERSION) = '0.12';
our ($offset) = 0;
our ($fixed) = undef;
BEGIN {
*CORE::GLOBAL::time = \&Test::MockTime::time;
*CORE::GLOBAL::localtime = \&Test::MockTime::localtime;
*CORE::GLOBAL::gmtime = \&Test::MockTime::gmtime;
}
sub set_relative_time {
my ($relative) = @_;
if (($relative eq __PACKAGE__) || (UNIVERSAL::isa($relative, __PACKAGE__))) {
t/pms/MockTime.pm view on Meta::CPAN
sub gmtime (;$) {
my ($time) = @_;
unless (defined $time) {
$time = Test::MockTime::time();
}
return CORE::gmtime($time);;
}
sub restore {
$offset = 0;
$fixed = undef;
}
*restore_time = \&restore;
t/pms/RayApp.pm view on Meta::CPAN
$RayApp::errstr = $errstr;
}
}
if (ref $self) {
return $self->{errstr};
} else {
return $RayApp::errstr;
}
}
sub clear_errstr {
shift->errstr(undef);
1;
}
sub base {
shift->{base};
}
# Loading content by URI
sub load_uri {
my ($self, $uri, %options) = @_;
t/pms/RayApp.pm view on Meta::CPAN
return;
}
$self->{xml_parser}->line_numbers(1);
# $self->{xml_parser}->keep_blanks(0);
}
$self->{xml_parser};
}
sub execute_application_cgi {
my ($self, $application, @params) = @_;
$self->{errstr} = undef;
if (ref $application) {
$application = $application->application_name;
}
my $ret = eval {
if (not defined $application) {
die "Application name was not defined\n";
}
require $application;
return &handler(@params);
};
t/pms/RayApp.pm view on Meta::CPAN
my $errstr = $@;
$errstr =~ s/\n$//;
$self->{errstr} = $errstr;
return 500;
}
return $ret;
}
sub execute_application_handler {
my ($self, $application, @params) = @_;
$self->{errstr} = undef;
if (ref $application) {
$application = $application->application_name;
}
my $ret = eval {
if (not defined $application) {
die "Application name was not defined\n";
}
local *FILE;
open FILE, $application or die "Error reading `$application': $!\n";
local $/ = undef;
my $content = <FILE>;
close FILE or die "Error reading `$application' during close: $!\n";
if (${^TAINT}) {
$content =~ /^(.*)$/s and $content = $1;
}
my $max_num = $self->{max_handler_num};
if (not defined $max_num) {
$max_num = 0;
}
$self->{max_handler_num} = ++$max_num;
t/pms/RayApp.pm view on Meta::CPAN
};
if ($@) {
$self->errstr($@);
return 500;
}
return $ret;
}
sub execute_application_handler_reuse {
my ($self, $application, @params) = @_;
$self->{errstr} = undef;
if (ref $application) {
$application = $application->application_name;
}
my $ret = eval {
if (not defined $application) {
die "Application name was not defined\n";
}
my $handler;
my $mtime = (stat $application)[9];
if (defined $self->{handlers}{$application}
t/pms/RayApp.pm view on Meta::CPAN
$handler = $self->{handlers}{$application}{handler};
} else {
$handler = $application;
$handler =~ s!([^a-zA-Z0-9])! ($1 eq '/') ? '::' : sprintf("_%02x", ord $1) !ge;
my $package = 'RayApp::Root::pkn' . $handler;
$handler = $package . '::handler';
### print STDERR "Loading\n";
local *FILE;
open FILE, $application or die "Error reading `$application': $!\n";
local $/ = undef;
my $content = <FILE>;
close FILE or die "Error reading `$application' during close: $!\n";
if (${^TAINT}) {
$content =~ /^(.*)$/s and $content = $1;
}
my $max_num = $self->{max_handler_num};
if (not defined $max_num) {
$max_num = 0;
}
## $content =~ s/(.*)/$1/s;
( run in 1.208 second using v1.01-cache-2.11-cpan-d80b1682f3f )