App-CELL

 view release on metacpan or  search on metacpan

WISHLIST  view on Meta::CPAN

20140529 Status.pm: 'ok' and 'not_ok' methods are almost identical - use a
         "subroutine factory" to generate them
20140529 Guide.pm: write verbiage about how statuses are for handling
         expected errors. It's still OK to croak if something unexpected
         happens.
20140609 If sitedir is passed to load routine by argument or environment
         variable, return an error status if sitedir not loaded
20140610 Clarify that messages cannot be overwritten
20140610 Implement Status.pm->dump (currently just a stub)
20140610 Change debug_mode to log_level (for finer granularity of control)
20140613 Log.pm: add a check for (caller)[0] -- if being called from
         App::CELL itself, check a flag that toggles _all_ App::CELL log 
         messages so the application developer can suppress them if needed


WILL PROBABLY NEVER IMPLEMENT
20140516 put meta, core, and site params directly in the module's symbol
         table like RT does it
20140516 get App::CELL to build on Perl 5.10.0 (SLE_11_SP3)
20140524 add 'testing' mode to Load->init (prefix all paths, e.g., with 
         '/tmp')

lib/App/CELL.pm  view on Meta::CPAN


sub load {
    my $class = shift;
    my ( %ARGS ) = validate( @_, {
        enviro => { type => SCALAR, optional => 1 },
        sitedir => { type => SCALAR, optional => 1 },
        verbose => { type => SCALAR, default => 0 },
    } );
    my $status; 

    $log->info( "CELL version $VERSION called from " . (caller)[0] . 
                " with arguments " . stringify_args( \%ARGS ),
                cell => 1, suppress_caller => 1 );

    # we only get past this next call if at least the sharedir loads
    # successfully (sitedir is optional)
    $status = App::CELL::Load::init( %ARGS );
    return $status unless $status->ok;
    $log->info( "App::CELL has finished loading messages and site conf params", 
        cell => 1 ) if $meta->CELL_META_LOAD_VERBOSE;

lib/App/CELL/Config.pm  view on Meta::CPAN

            %ARGS = (   
                        %ARGS,
                        code => 'CELL_OVERWRITE_META_PARAM',
                        args => [ $param, ( defined( $value ) ? $value : 'undef' ) ],
                    );
            #$log->debug( "Overwriting \$meta->$param with ->$value<-", cell => 1 );
        } else {
            #$log->debug( "Setting new \$meta->$param to ->$value<-", cell => 1 );
        }
        $meta->{$param} = {
                               'File' => (caller)[1],
                               'Line' => (caller)[2],
                               'Value' => $value,
                          };
    } elsif ( $self->{'CELL_CONFTYPE'} eq 'core' ) {
        if ( exists $core->{$param} ) {
            %ARGS = (
                        %ARGS,
                        level => 'ERR',
                        code => 'CELL_PARAM_EXISTS_IMMUTABLE',
                        args => [ 'Core', $param ],
                    );
        } else {
            $core->{$param} = {
                                   'File' => (caller)[1],
                                   'Line' => (caller)[2],
                                   'Value' => $value,
                              };
        }
    } elsif ( $self->{'CELL_CONFTYPE'} eq 'site' ) {
        if ( exists $site->{$param} ) {
            %ARGS = (
                        %ARGS,
                        level => 'ERR',
                        code => 'CELL_PARAM_EXISTS_IMMUTABLE',
                        args => [ 'Site', $param ],
                    );
        } else {
            $site->{$param} = {
                                   'File' => (caller)[1],
                                   'Line' => (caller)[2],
                                   'Value' => $value,
                              };
        }
    }
    return App::CELL::Status->new( %ARGS );
}

# END OF App::CELL::Config MODULE
1;

lib/App/CELL/Load.pm  view on Meta::CPAN

    # determine verbosity level
    my $args_string;
    if ( %ARGS ) {
        $args_string = "with arguments: " . stringify_args( \%ARGS );
    } else {
        $args_string = "without arguments";
    }
    $meta->set('CELL_META_LOAD_VERBOSE', $ARGS{'verbose'} || 0);

    $log->info(
        "Entering App::CELL::Load::init from " . (caller)[0] . " $args_string",
        cell => 1
    ) if $meta->CELL_META_LOAD_VERBOSE;

    # check for taint mode
    if ( ${^TAINT} != 0 ) {
        return App::CELL::Status->new( level => "FATAL",
            code => "Attempt to load while in taint mode (-T)" );
    }

    # look up sharedir

lib/App/CELL/Message.pm  view on Meta::CPAN


=cut

sub new {

    my ( $class, %ARGS ) = @_; 
    my $stringified_args = stringify_args( \%ARGS );
    my $my_caller;
    my $msgobj = {};

    #$log->debug( "Entering Message->new called from " . (caller)[1] . " line " . (caller)[2]);
    if ( $ARGS{called_from_status} ) {
        $my_caller = $ARGS{caller};
    } else {
        $my_caller = [ CORE::caller() ];
    }
   
    if ( not exists( $ARGS{'code'} ) ) {
        return App::CELL::Status->new( level => 'ERR', 
            code => 'CELL_MESSAGE_NO_CODE', 
            caller => $my_caller,



( run in 1.482 second using v1.01-cache-2.11-cpan-1e74a51a04c )