Ambrosia
view release on metacpan or search on metacpan
lib/Ambrosia/Context.pm view on Meta::CPAN
}
sub full_script_path
{
my $self = shift;
if ( $ENV{HTTP_HOST} )
{
return 'http://' . $ENV{HTTP_HOST} . $ENV{SCRIPT_NAME};
}
else
{
return script_path();
}
}
sub data
{
my $self = shift;
my %r;
tie %r, 'Ambrosia::Utils::Container', $self->repository;
return {
script => $self->proxy || $self->full_script_path,
repository => \%r,
};
}
sub error
{
my $self = shift;
$self->__error = join( '; ', @_ ) if @_;
return $self->__error;
}
sub backup_uri
{
my $self = shift;
$self->host_path . '?action=' . $self->action . '&' . join '&', map {$_ . '=' . $self->param($_) } grep {defined $_} @{$self->param()};
}
1;
__END__
=head1 NAME
Ambrosia::Context - a context of application.
=head1 VERSION
version 0.010
=head1 SYNOPSIS
use Ambrosia::Context;
instance Ambrosia::Context( proxy => $URI )
->on_start( sub {
instance Ambrosia::Plugin::Session(storage => new Ambrosia::Plugin::Session::Cookie())
} )
->on_abort( sub {session->destroy} )
->on_finish( sub {session->destroy} );
=head1 DESCRIPTION
C<Ambrosia::Context> is a context of application.
=head1 CONSTRUCTOR
=head2 instance
Creates an object of type of C<Ambrosia::Context>.
=head1 METHODS
=head2 destroy
Destroys a context. You must call this method when session finished.
=head2 Context
Returns global an object of type of C<Ambrosia::Context>.
=head1 THREADS
Not tested.
=head1 BUGS
Please report bugs relevant to C<Ambrosia> to <knm[at]cpan.org>.
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2010-2012 Nickolay Kuritsyn. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 AUTHOR
Nikolay Kuritsyn (knm[at]cpan.org)
=cut
( run in 1.229 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )