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.
Authorize user. Abstract method, should be overloaded in ancestor class.
Unauthorize user. Abstract method, should be overloaded in ancestor class.
Checks if user is authorized. Abstract method, should be overloaded in ancestor class.
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).
Eidolon, Eidolon::Driver::User::Exceptions
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
To install Eidolon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Eidolon
CPAN shell
perl -MCPAN -e shell install Eidolon
For more information on module installation, please visit the detailed CPAN module installation guide.