Project::Easy - project deployment made easy.
package Caramba; use Class::Easy; use Project::Easy; use base qw(Project::Easy); has 'id', default => 'caramba'; has 'conf_format', default => 'json'; my $class = __PACKAGE__; has 'entity_prefix', default => join '::', $class, 'Entity', ''; $class->init;
return class instance
project id
default config file format
interface for daemon creation
default => 'Project::Easy::Daemon'
interface for db connections creation
default => 'Project::Easy::DB'
configuration interface
default => 'Project::Easy::Config';
has 'etc', default => 'etc';
has 'bin', default => 'bin';
IO::Easy object for project root directory
string contains current project instance name
path (string) to configuration fixup root
path object to the global configuration file
path object to the local configuration file
return configuration object
database pool
Project::Easy create default entity classes on initialization. this entity based on default database connection. you can use this connection (not recommended) within modules by mantra:
my $core = <project_namespace>->singleton; my $dbh = $core->db;
method db return default $dbh. you can use non-default dbh named 'cache' by calling:
my $dbh_cache = $core->db ('cache');
or my $dbh_cache = $core->db_cache;
if DBI::Easy default API satisfy you, then you can use database entities by calling
my $account_record = $core->entity ('Account'); my $account_collection = $core->collection ('Account'); my $all_accounts = $account_collection->new->list;
in this case, virtual packages created for entity 'account'.
or you can create these packages by hand:
package <project_namespace>::Entity::Account; use Class::Easy; use base qw(<project_namespace>::Entity::Record); 1;
and for collection:
package <project_namespace>::Entity::Account::Collection; use Class::Easy; use base qw(<project_namespace>::Entity::Collection); 1;
in this case
my $account_record = $core->entity ('Account'); my $account_collection = $core->collection ('Account');
also works for you
TODO: creation by script
TODO: read database tables and create entity mappings, each entity subclass must contain converted database identifier:
default entity, table account_settings => entity AccountSettings 'cache' entity, table account_settings => entity CacheAccountSettings
Ivan Baktsheev, <apla at the-singlers.us>
<apla at the-singlers.us>
Please report any bugs or feature requests to my email address, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Project-Easy. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
Copyright 2007-2009 Ivan Baktsheev
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
4 POD Errors
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head2'
You forgot a '=back' before '=head1'
To install Project::Easy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Project::Easy
CPAN shell
perl -MCPAN -e shell install Project::Easy
For more information on module installation, please visit the detailed CPAN module installation guide.