NAME
Helix::Driver::User - Helix Framework generic user driver.
SYNOPSIS
Example user driver:
package MyApp::Driver::User;
use base qw/Helix::Driver::User/;
sub authorized
{
my $self = shift;
throw HXError::Driver::User("This is just an example!");
}
DESCRIPTION
The Helix::Driver::User is a generic user driver for Helix Framework. 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
Private methods are prefixed with _ symbol and placed in the end of the list.
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.
_init()
Class initialization. Reads environment variables to determine user related information.
ATTRIBUTES
The Helix::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 = Helix::Core::Registry->get_instance;
$user = $r->loader->get_object("Helix::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
Helix, Helix::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