NAME
Eidolon::Driver::User - Eidolon generic user driver.
SYNOPSIS
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!");
}
DESCRIPTION
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.
METHODS
new()
Class constructor. Creates the driver object and calls object initialization function.
authorize($login)
Authorize user. Abstract method, should be overloaded in ancestor class.
unauthorize()
Unauthorize user. Abstract method, should be overloaded in ancestor class.
authorized()
Checks if user is authorized. Abstract method, should be overloaded in ancestor class.
ATTRIBUTES
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"}
agent
User's HTTP user agent string (User-Agent: field in HTTP request header).
ip
User's remote IP address (in string format).
language
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.
referer
User's HTTP referer (Referer: field in HTTP request header).
SEE ALSO
Eidolon, Eidolon::Driver::User::Exceptions
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Anton Belousov, <abel@cpan.org>
COPYRIGHT
Copyright (c) 2009, Atma 7, http://www.atma7.com