view release on metacpan or search on metacpan
[New Features]
- $Session->is_read_only(1) is new. Setting it to a true value (eg: 1) will prevent
the default behavior of calling $Session->save() at the end of each successful request.
2011-04-08 v1.043
- Documentation overhaul.
2011-03-23 v1.042
- Fixed sporadic error in master pages that looks like this:
Can't call method "Write" on an undefined value at /tmp/PAGE_CACHE/BStat/_masters_global_asp.pm line 1.
- Apparently $s->init_asp_objects($context) was not getting called before the
master page's run() method was called, resulting in a call to $Response->Write(...)
before $Response had been initialized.
2010-11-11 v1.041
- ASP4::UserAgent calls all cleanup handlers registered via $Server->RegisterCleanup(sub { }, @args)
at the end of each request, not when the ASP4::Mock::Pool object's DESTROY method is called.
This fixes a condition which caused conflict when a Class::DBI::Lite ORM is
used and the ASP4 application is executed via the `asp4` helper script.
README.markdown view on Meta::CPAN
<%
# Get our $user:
use App::db::user;
my $user = App::db::user->retrieve( $Session->{user_id} );
%>
<div style="float: left; width: 40%; border-right: solid 1px #000;">
<h3>Incoming Messages</h3>
<%
foreach my $msg ( $user->messages_in(undef, { order_by => "created_on ASC"} ) ) {
%>
<div class="msg">
<span class="from"><%= $msg->sender->email %></span> says:<br/>
<div class="body"><%= $Server->HTMLEncode( $msg->body ) %></div>
<span class="date"><%= $msg->created_on %></span>
</div>
<%
}# end foreach()
%>
</div>
inc/Module/Install.pm view on Meta::CPAN
}
# Cloned from Params::Util::_CLASS
sub _CLASS ($) {
(
defined $_[0]
and
! ref $_[0]
and
$_[0] =~ m/^[^\W\d]\w*(?:::\w+)*$/s
) ? $_[0] : undef;
}
1;
# Copyright 2008 - 2009 Adam Kennedy.
lib/ASP4.pm view on Meta::CPAN
<%
# Get our $user:
use App::db::user;
my $user = App::db::user->retrieve( $Session->{user_id} );
%>
<div style="float: left; width: 40%; border-right: solid 1px #000;">
<h3>Incoming Messages</h3>
<%
foreach my $msg ( $user->messages_in(undef, { order_by => "created_on ASC"} ) ) {
%>
<div class="msg">
<span class="from"><%= $msg->sender->email %></span> says:<br/>
<div class="body"><%= $Server->HTMLEncode( $msg->body ) %></div>
<span class="date"><%= $msg->created_on %></span>
</div>
<%
}# end foreach()
%>
</div>
lib/ASP4/API.pm view on Meta::CPAN
sub properties { shift->{properties} }
sub ua { shift->{ua} }
sub context { ASP4::HTTPContext->current }
sub config { shift->{config} }
sub data { shift->test_fixtures } # XXX: Deprecated! - for Apache2::ASP compat only.
sub test_data { shift->test_fixtures } # XXX: Deprecated!
sub DESTROY
{
my $s = shift;
undef(%$s);
}# end DESTROY()
1;# return true:
=pod
=head1 NAME
ASP4::API - Public Programmatic API to an ASP4 Application
lib/ASP4/Config.pm view on Meta::CPAN
(my $file = "$class.pm") =~ s/::/\//g;
eval { require $file; }
or confess "Cannot load $class: $@";
}# end load_class()
sub DESTROY
{
my $s = shift;
undef(%$s);
}
1;# return true:
=pod
=head1 NAME
ASP4::Config - Central configuration for ASP4
lib/ASP4/ConfigNode.pm view on Meta::CPAN
confess "Unknown method or property '$name'" unless exists($s->{$name});
# Read-only:
$s->{$name};
}# end AUTOLOAD()
sub DESTROY
{
my $s = shift;
undef(%$s);
}# end DESTROY()
1;# return true:
lib/ASP4/ConfigNode/Web.pm view on Meta::CPAN
sub new
{
my $class = shift;
my $s = $class->SUPER::new( @_ );
$s->{handler_resolver} ||= 'ASP4::HTTPContext::HandlerResolver';
$s->{handler_runner} ||= 'ASP4::HTTPContext::HandlerRunner';
$s->{filter_resolver} ||= 'ASP4::HTTPContext::FilterResolver';
map {
$_->{uri_match} = undef unless defined($_->{uri_match});
$_->{uri_equals} = undef unless defined($_->{uri_equals});
$_ = $class->SUPER::new( $_ );
} $s->request_filters;
map {
$_->{uri_match} = undef unless defined($_->{uri_match});
$_->{uri_equals} = undef unless defined($_->{uri_equals});
$_->{disable_session} ||= 0;
$_->{disable_application} ||= 0;
$_ = $class->SUPER::new( $_ );
} $s->disable_persistence;
# Do we have "routes"?:
eval { require Router::Generic };
$s->{__has_router} = ! $@;
return $s;
lib/ASP4/FileUpload.pm view on Meta::CPAN
return 1;
}# end SaveAs()
sub DESTROY
{
my $s = shift;
my $ifh = $s->FileHandle;
close($ifh);
undef(%$s);
}# end DESTROY()
1;# return true:
=pod
=head1 NAME
ASP4::FileUpload - Simple interface for handling File Uploads
lib/ASP4/HTTPContext.pm view on Meta::CPAN
return $res;
}
else
{
return;
}# end if()
}
else
{
return if (! defined($res)) || $res == -1;
return $s->response->Status =~ m/^200/ ? undef : $s->response->Status;
}# end if()
}# end handle_phase()
sub handle_error
{
my $s = shift;
$s->response->Status( 500 );
$s->response->Clear();
lib/ASP4/HTTPContext.pm view on Meta::CPAN
return $yes;
}# end do_disable_session_state()
sub DESTROY
{
my $s = shift;
$s->session->save if $s->session && ! $s->session->is_read_only;
$s = { };
undef(%$s);
}# end DESTROY()
1;# return true:
=pod
=head1 NAME
ASP4::HTTPContext - Provides access to the intrinsic objects for an HTTP request.
lib/ASP4/HTTPHandler.pm view on Meta::CPAN
@{"$class\::ISA"};
${"$class\::__PARENTS_TIME"} = time();
return @{"$class\::__PARENTS"} = @classes;
}# end _parents()
sub DESTROY
{
my $s = shift;
undef(%$s);
}# end DESTROY()
1;# return true:
lib/ASP4/HandlerResolver.pm view on Meta::CPAN
sub _forget_package
{
my ($s, $inc, $package) = @_;
# Forcibly forget all about the handler we are going to reload:
no strict 'refs';
delete( $INC{ $inc } );
if( *{"$package\::run"} )
{
no warnings;
*{"$package\::run"} = undef;
*{"$package\::before_run"} = undef;
*{"$package\::after_run"} = undef;
}# end if()
}# end _forget_package()
1;# return true:
lib/ASP4/Mock/Pool.pm view on Meta::CPAN
}
sub cleanup_register {
my ($s, $handler, $args) = @_;
push @{ $s->{cleanup_handlers} }, sub { $handler->( $args ) };
}
sub DESTROY
{
my $s = shift;
undef(%$s);
}# end DESTROY()
1;# return true:
=pod
=head1 NAME
ASP4::Mock::Pool - Mimics the $r->pool APR::Pool object
lib/ASP4/OutBuffer.pm view on Meta::CPAN
return;
}# end add()
sub data { shift->{data} }
sub clear { shift->{data} = '' }
sub DESTROY
{
my $s = shift;
delete($s->{data});
undef(%$s);
}# end DESTROY()
1;# return true:
lib/ASP4/Page.pm view on Meta::CPAN
use Carp 'confess';
use ASP4::HTTPContext;
use ASP4::PageParser;
sub new
{
my ($class, %args) = @_;
my $s = bless {
masterpage => undef,
package => undef,
filename => undef,
compiled_as => undef,
script_name => $args{script_name} || undef,
%args
}, $class;
$s->_init();
return $s;
}# end new()
sub _init;
lib/ASP4/PageParser.pm view on Meta::CPAN
use ASP4::Page;
use ASP4::MasterPage;
sub new
{
my ($class, %args) = @_;
my $s = bless {
script_name => $args{script_name},
filename => undef,
package => undef,
compiled_as => undef,
base_class => undef,
source_code => \"",
}, $class;
$s->_init();
return $s;
}# end new()
sub source_code { shift->{source_code} }
lib/ASP4/PageParser.pm view on Meta::CPAN
}# end if()
}# end while()
return $attr;
}# end _parse_tag_attrs()
sub DESTROY
{
my $s = shift;
undef(%$s);
}# end DESTROY()
1;# return true:
lib/ASP4/Request.pm view on Meta::CPAN
{
my ($s, $name) = @_;
$s->context->r->headers_in->{$name};
}# end Header()
sub DESTROY
{
my $s = shift;
undef(%$s);
}# end DESTROY()
1;# return true:
=pod
=head1 NAME
ASP4::Request - Interface to the incoming request
lib/ASP4/Response.pm view on Meta::CPAN
# my $buffer = $s->context->purge_buffer();
# $s->context->{r} = $original_r;
# $s->context->did_end( 0 );
# return $r->buffer;
#}# end _subrequest()
sub DESTROY
{
my $s = shift;
undef(%$s);
}# end DESTROY()
1;# return true:
=pod
=head1 NAME
ASP4::Response - Interface to the outgoing HTTP response
lib/ASP4/SessionStateManager.pm view on Meta::CPAN
delete($s->{$_}) for grep { $_ ne 'SessionID' } keys %$s;
$s->save;
return;
}# end reset()
sub DESTROY
{
my $s = shift;
return undef(%$s) unless $s->{SessionID};
unless( $s->is_read_only )
{
$s->save;# if $s->is_changed;
}# end unless()
undef(%$s);
}# end DESTROY()
1;# return true:
=pod
=head1 NAME
ASP4::SessionStateManager - Per-user state persistence
lib/ASP4/SimpleCGI.pm view on Meta::CPAN
%args
}, $s;
}# end new()
sub upload
{
my ($s, $key) = @_;
no warnings 'uninitialized';
return exists( $s->{uploads}->{$key} ) ? $s->{uploads}->{$key}->{filehandle} : undef;
}# end upload()
sub param
{
my ($s, $key) = @_;
if( defined($key) )
{
if( ref($s->{params}->{$key}) )
lib/ASP4/SimpleCGI.pm view on Meta::CPAN
sub DESTROY
{
my $s = shift;
map {
close($s->{uploads}->{$_}->{filehandle});
unlink($s->{uploads}->{$_}->{tempname});
} keys(%{$s->{uploads}});
undef(%$s);
}# end DESTROY()
1;# return true:
=pod
=head1 NAME
ASP4::SimpleCGI - Basic CGI functionality
lib/ASP4/UserAgent.pm view on Meta::CPAN
{
# Simple 'GET' request:
return ASP4::SimpleCGI->new( querystring => $ENV{QUERY_STRING} );
}# end if()
}# end _setup_cgi()
sub DESTROY
{
my $s = shift;
undef(%$s);
}# end DESTROY()
1;# return true:
=pod
=head1 NAME
ASP4::UserAgent - Execute ASP4 requests without a web server.
t/010-basic/000-setup.t view on Meta::CPAN
{
$temp_root = $ENV{TEMP} || $ENV{TMP};
}# end if()
my $dbfile = "$temp_root/db_asp4";
open my $ofh, '>', $dbfile
or die "Cannot open '$dbfile' for writing: $!";
binmode($ofh);
SCOPE: {
no warnings 'uninitialized';
print $ofh undef;
};
close($ofh);
my $dbh = DBI->connect("DBI:SQLite:dbname=$dbfile", "", "", {
RaiseError => 1,
});
$dbh->do(<<"SQL");
drop table if exists asp_sessions
SQL