NAME

Project::Easy - project deployment made easy.

SYNOPSIS

        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;

ACCESSORS

singleton

singleton

return class instance

configurable options

id

project id

conf_format

default config file format

daemon_package

interface for daemon creation

default => 'Project::Easy::Daemon'

db_package

interface for db connections creation

default => 'Project::Easy::DB'

conf_package

configuration interface

default => 'Project::Easy::Config';

default configuration directory

has 'etc', default => 'etc';

default binary directory

has 'bin', default => 'bin';

autodetect options

root

IO::Easy object for project root directory

instance

string contains current project instance name

fixup_core

path (string) to configuration fixup root

conf_path

path object to the global configuration file

fixup_path

path object to the local configuration file

METHODS

config

return configuration object

db

database pool

ENTITIES

intro

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

creation another database entity class

TODO: creation by script

using entities from multiple databases

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
 

AUTHOR

Ivan Baktsheev, <apla at the-singlers.us>

BUGS

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.

SUPPORT

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

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:

Around line 441:

You forgot a '=back' before '=head2'

Around line 481:

You forgot a '=back' before '=head2'

Around line 507:

You forgot a '=back' before '=head1'

Around line 596:

You forgot a '=back' before '=head1'