BioX-Workflow-Command

 view release on metacpan or  search on metacpan

lib/BioX/Workflow/Command/run/Rules/Directives.pm  view on Meta::CPAN

package BioX::Workflow::Command::run::Rules::Directives;

use Moose;
use namespace::autoclean;

use Moose::Util qw/apply_all_roles/;

with 'BioX::Workflow::Command::run::Rules::Directives::Types::HPC';
with 'BioX::Workflow::Command::run::Rules::Directives::Types::Path';
#with 'BioX::Workflow::Command::run::Rules::Directives::Types::List';
with 'BioX::Workflow::Command::run::Rules::Directives::Types::Stash';
with 'BioX::Workflow::Command::run::Rules::Directives::Types::Hash';
with 'BioX::Workflow::Command::run::Rules::Directives::Types::Array';
with 'BioX::Workflow::Command::run::Rules::Directives::Types::CSV';
with 'BioX::Workflow::Command::run::Rules::Directives::Types::Glob';
with 'BioX::Workflow::Command::run::Rules::Directives::Types::Config';
with 'BioX::Workflow::Command::run::Rules::Directives::Types::Mustache';
with 'BioX::Workflow::Command::run::Rules::Directives::Interpolate';
with 'BioX::Workflow::Command::run::Rules::Directives::Functions';
with 'BioX::Workflow::Command::run::Rules::Directives::Sample';
with 'BioX::Workflow::Command::run::Rules::Directives::Walk';
with 'BioX::Workflow::Command::Utils::Log';

use Try::Tiny;

=head2 Other Directives

=cut

has '_ERROR' => (
    is      => 'rw',
    default => 0,
);

has 'register_types' => (
    traits  => [ 'Hash' ],
    is      => 'rw',
    isa     => 'HashRef',
    default => sub {return {}},
    handles => {
        'get_register_types' => 'get',
        'set_register_types' => 'set',
    },
);

has 'register_process_directives' => (
    traits  => [ 'Hash' ],
    is      => 'rw',
    isa     => 'HashRef',
    default => sub {return {}},
    handles => {
#        'get_register_process_directives' => 'get',
        'set_register_process_directives' => 'set',
    },
);

=head3 register_namespace

A user can define their own custom types and processes.

=cut

has 'register_namespace' => (
    traits  => [ 'Array' ],
    is      => 'rw',
    isa     => 'ArrayRef',
    default => sub {[]},
    handles => {
        'all_register_namespace'    => 'elements',
        'count_register_namespace'  => 'count',
        'has_register_namespace'    => 'count',
        'has_no_register_namespace' => 'is_empty',
    },
    trigger => sub {
        my $self = shift;
        foreach my $role ($self->all_register_namespace) {
            try {
                apply_all_roles($self, $role);
            }
            catch {
                $self->app_log->warn(
                    'There was an error registering role ' . $role);
                $self->app_log->warn($@ . "\n");
            };



( run in 0.887 second using v1.01-cache-2.11-cpan-39bf76dae61 )