NAME
Eidolon::Core::Loader - Eidolon driver loader.
SYNOPSIS
This code must be placed in one of your application controllers. For example, in lib/Example/Controller/Default.pm
:
sub default : Default
{
my ($r, $tpl);
$r = Eidolon::Core::Registry->get_instance;
$tpl = $r->loader->get_object("Eidolon::Driver::Template");
if ($tpl)
{
$tpl->parse("index.tpl");
$tpl->render;
}
}
DESCRIPTION
The Eidolon::Core::Loader package is the central part of Eidolon abstraction layer. It provides the unified interface for manipulations with vital application objects (drivers). You can load a new driver and gain access to loaded drivers with this package.
The driver being loaded must be inherited from Eidolon::Driver class to pass driver validation procedure.
The object of Eidolon::Core::Loader is mounted in application registry as $r->loader
, so it can be used later by any application component.
METHODS
new()
Class constructor.
load($class, @params)
Loads a $class
driver and initializes it with given @params
(if any).
get_object($class)
Returns an object of the loaded driver. If driver with given $class
isn't loaded undef
will be returned.
SEE ALSO
Eidolon, Eidolon::Application, Eidolon::Driver, Eidolon::Core::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