Eve::Registry - a service provider class.
my $registry = Eve::Registry->new( # some literals declarations); my $service = $registry->get_service();
Eve::Registry is the class that provides all services that are required by the application and manages their dependencies.
working_dir_string
base_uri_string
alias_base_uri_string_list
an optional base URI alias string list
email_from_string
pgsql_database
pgsql_host
pgsql_port
pgsql_user
pgsql_password
pgsql_schema
session_expiration_interval
an interval of idling from the last access when the session is considered actual (0 cancels expiration), 30 days is set by default,
template_path
template_compile_path
template_expiration_interval
template_var_hash
a hash of variables that will be made available for the templates.
the pgsql_* literals except pgsql_schema are undef by default so an attempt will be made to use standard PostgreSQL environment variables. For the pgsql_schema the default 'public' value will be used.
pgsql_*
undef
The registry's purpose is to provide different services, which can be simple literals as well as lists, hashes and objects. For objects there are two types of services: lazy loader and prototype:
A lazy loader service is a service that creates the object it provides upon first request. All subsequent requests of this service will return the same object that was created the first time.
use Eve::Registry; sub first_sub { my $registry = Eve::Registry->new(); my $lazy_service = $registry->get_lazy_service(); $lazy_service->set_state(true); } sub second_sub { my $registry = Eve::Registry->new(); my $lazy_service = $registry->get_lazy_service(); # Returns state set in previous sub print $lazy_service->get_state(); }
A prototype service is a service that creates the provided object each time it is requested.
use Eve::Registry; sub third_sub { my $registry = Eve::Registry->new(); my $first_service = $registry->get_proto_service(); my $second_service = $registry->get_proto_service(); if ($first_service eq $second_service) { die("This will never get executed"); } }
Creates a service object if it hasn't been created and returns it. Otherwise returns a stored copy of a previously service object.
name
A unique name for a service,
code
A code reference that must create and return the service object.
A URI prototype service.
string
a URI string that will be used to create a new URI object.
A base URI prototype service.
A list of alias base URIs prototype service.
An HTTP request lazy loader service.
An HTTP response lazy loader service.
An event map lazy loader service.
A mailer lazy loader service.
An HTTP resource dispatcher lazy loader service.
An HTTP output lazy service.
A Template lazy loader service.
A lazy template hash getter service.
A persistent session prototype service.
id
a session identifier md5 string
A PostgreSQL registry lazy loader service.
A JSON converter adapter class lazy loader service.
A shorthand method for binding resources to specific URI patterns. Accepts arguments as a simple list, which are resource binding name, pattern and constructor code reference. The fourth argument is a hash reference that is added to the bind method call.
bind
Binds HTTP event handlers for standard request/response functionality.
Copyright 2012 Igor Zinovyev.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Eve, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Eve
CPAN shell
perl -MCPAN -e shell install Eve
For more information on module installation, please visit the detailed CPAN module installation guide.