| Eidolon documentation | view source | Contained in the Eidolon distribution. |
Eidolon::Driver::User - Eidolon generic user driver.
Example user driver:
package MyApp::Driver::User;
use base qw/Eidolon::Driver::User/;
sub authorized
{
my $self = shift;
throw DriverError::User("This is just an example!");
}
The Eidolon::Driver::User is a generic user driver for Eidolon. It declares some functions that are common for all driver types and some abstract methods, that must be overloaded in ancestor classes. All user drivers should subclass this package.
Class constructor. Creates the driver object and calls object initialization function.
The Eidolon::Driver::User package has got several useful class attributes that filled in during object initialization. These variables could be accessed through driver object using hashref or subroutine syntax:
my ($r, $user, $ip, $referer);
$r = Eidolon::Core::Registry->get_instance;
$user = $r->loader->get_object("Eidolon::Driver::User");
$ip = $user->ip; # or $user->{"ip"}
$referer = $user->referer; # or $user->{"referer"}
User's HTTP user agent string (User-Agent: field in HTTP request header).
User's remote IP address (in string format).
User's preferred language string, that is transferred in HTTP request header in Accept-Languages: field. If this field contains more than one language, first is used.
User's HTTP referer (Referer: field in HTTP request header).
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Anton Belousov, <abel@cpan.org>
Copyright (c) 2009, Atma 7, http://www.atma7.com
| Eidolon documentation | view source | Contained in the Eidolon distribution. |