ETLp

 view release on metacpan or  search on metacpan

lib/ETLp.pm  view on Meta::CPAN

package ETLp;

use MooseX::Declare;

=head1 NAME

ETLp - A framework for managing and auditing ETL processing

=head1 END-USER DOCUMENTATION

For end-user documentation on how to use ETLp refer to
L<http://trac.assembla.com/etlp/wiki> or:

    perldoc ETLp::Manual::Intro

=head1 VERSION

Version 0.04

=head1 SYNOPSIS

This module manages the processing of ETL tasks as a series of pipelines.
The tasks are defined ina one or more configuration files. ETLp is invoked
by providing the details of the pipeline top be executed.

    use ETLp;

    my $etlp = ETLp->new(
        config_directory => "$ENV{'HOME'}/conf",
        app_config_file  => 'sales',
        section          => 'monthly_sales',
        env_config_file  => 'env',
    );
    
    $etlp->run();
    ...
    
=head1 METHODS

=head2 new

=head3 parameters

    * app_config_file. The name of the application configuration file
    * env_config_file. The name of the environment configuration file
    * config_directrory. Optional. The name of the configuration file
        that contains the configuration files
    * section. The name of the section in the application configuration
        that defined the job being executed
    * localize. Optional. Whether to modify the configuration files to
        use the operating system eol markers. Deafults to 0.

=cut

class ETLp with ETLp::Role::Config {
    use FindBin qw($Bin);
    use Config::General qw(ParseConfig);
    use ETLp::Exception;
    use Try::Tiny;
    use Modern::Perl;
    use ETLp::Config;
    use ETLp::Schema;
    use ETLp::Audit::Job;
    use ETLp::ItemBuilder;
    use ETLp::Execute::Iteration;
    use ETLp::Execute::Serial;
    use Cwd 'abs_path';
    use DBI;
    use Log::Log4perl qw();
    use Data::Dumper;
    use UNIVERSAL::require;
    use File::LocalizeNewlines;
    use DBI::Const::GetInfoType;

    our $VERSION = '0.04';
    
    has 'app_config_file'  => (is => 'ro', isa => 'Str', required => 1);
    has 'env_config_file'  => (is => 'ro', isa => 'Str', required => 1);
    has 'section'          => (is => 'ro', isa => 'Str', required => 1);
    has 'config_directory' => (is => 'ro', isa => 'Str', required => 0);
    has 'localize' => (is => 'ro', isa => 'Bool', required => 0, default => 0);

    has 'registered_plugins' => (
        is       => 'rw',
        isa      => 'HashRef',
        required => 0,
        lazy     => 1,
        default  => sub { {} }
    );

    has 'env_conf' => (
        is       => 'rw',
        isa      => 'HashRef',
        required => 0,
        lazy     => 1,
        default  => sub { {} }
    );
    
    has 'config' => (
        is       => 'rw',
        isa      => 'HashRef',
        required => 0,
        lazy     => 1,
        default  => sub { {} }
    );
    
    has 'app_root' => (
        is => 'rw',
        isa => 'Str',
        required => 0,
        default => abs_path("$Bin/..")
    );
    has 'log_dir' => (
        is       => 'ro',
        isa      => 'Str',
        required => 0,
        default  => abs_path("$Bin/../log")
    );
    has 'config_directory' => (
        is       => 'ro',



( run in 1.972 second using v1.01-cache-2.11-cpan-6aa56a78535 )