Apache-iNcom
view release on metacpan or search on metacpan
lib/Apache/iNcom/Request.pm view on Meta::CPAN
}
=pod
=head1 APACHE::INCOM PAGE GLOBALS
Here is a list of the global variables that are defined in the page when
it is executing.
=over
=item $Request
An Apache::iNcom::Request object which can used to query information about
the current request.
=item $DB
A DBIx::SearchProfiles object initialized with as requested by the
Apache::iNcom configuration.
=item $Cart
An Apache::iNcom::CartManager object initialized with the configured
pricing profile.
=item $Order
An Apache::iNcom::OrderManager object initialized with the configured
order profiles.
=item %Session
A hash which associated with the current client. Values in that hash
will persist across request until the user close its browser or
C<INCOM_SESSION_EXPIRES> time has elapsed.
=item %UserSession
A hash which associated with the user currently logged. Values in that
hash will persist across request as long as the client is logged in
and will be cleared once the user logs out.
=item $UserDB
A DBIx::UserDB object which should be used for user management.
=item $Validator
An HTML::Validator object initialized with the configured input
profiles.
=item $Localizer
An Apache::iNcom::Localizer object initialized with the user requested
language.
=item $Locale
A Locale::Maketext object initialized with the proper locale. The
Locale::Maketext subclass used is specified in the C<INCOM_LOCALE>
configuration directives.
=back
=cut
sub setup_aliases {
my ( $self ) = shift;
$package = $self->{package};
$DB = $self->{database};
$Cart = $self->{cart};
$Order = $self->{order};
$Request = $self;
*Session = $self->{session};
*UserSession = $self->{session}{_incom_user_session};
$UserDB = $self->{userdb};
$Validator = $self->{validator};
$Localizer = $self->{req_rec}->pnotes( "INCOM_LOCALIZER" );
if ( $self->{req_rec}->dir_config( "INCOM_LOCALE" ) ) {
$Locale =
$Localizer->get_handle( $self->{req_rec}->dir_config( "INCOM_LOCALE" ) );
}
# Play magic in the namespace of the page
{
no strict 'refs';
*{"$package\:\:DB"} = \$DB if $DB;
*{"$package\:\:UserDB"} = \$UserDB if $UserDB;
*{"$package\:\:Cart"} = \$Cart if $Cart;
*{"$package\:\:Order"} = \$Order if $Cart;
*{"$package\:\:Validator"} = \$Validator if $Validator;
*{"$package\:\:Locale"} = \$Locale if $Locale;
*{"$package\:\:Localizer"} = \$Localizer if $Localizer;
*{"$package\:\:Session"} = \%Session;
*{"$package\:\:UserSession"} = \%UserSession;
*{"$package\:\:Request"} = \$Request;
*{"$package\:\:Localize"} = \&Localize if $Locale;
*{"$package\:\:Currency"} = \&Currency if $Locale;
*{"$package\:\:Include"} = \&Include;
*{"$package\:\:TextInclude"} = \&TextInclude;
*{"$package\:\:QueryArgs"} = \&QueryArgs;
};
}
sub cleanup_aliases {
my ( $self ) = shift;
$package = undef;
$DB = undef;
$Cart = undef;
$Order = undef;
$Request = undef;
*Session = undef; # Undef the symbol, do not destroy the hash
*UserSession = undef;
$UserDB = undef;
$Validator = undef;
$Localizer = undef;
$Locale = undef;
( run in 1.043 second using v1.01-cache-2.11-cpan-ceb78f64989 )