Ambrosia

 view release on metacpan or  search on metacpan

lib/Ambrosia/Config.pm  view on Meta::CPAN


=head2 instance

This method instantiates the named object of type C<Ambrosia::Config> in the pool.
This method not exported. Use as constructor: C<instance Ambrosia::Config(.....)>
C<instance(name =&gt; path)> - where the "name" is a keyname for config and the "path" is a path to config file.
C<instance(name =&gt; hash)> - where the "name" is a keyname for config and the "hash" is a config data.

=head2 config

Returns the global object of type C<Ambrosia::Config>.
C<config(name)> - the "name" is optional param. Call with "name" if you not assign current process to config.

=head2 assign ($name)

Assign current process to the global named object of type C<Ambrosia::Config>.

=head1 DEPENDENCIES

L<Ambrosia::core::Exceptions>
L<Ambrosia::Meta>

=head1 THREADS

Not tested.

lib/Ambrosia/Context.pm  view on Meta::CPAN

Creates an object of type of C<Ambrosia::Context>.

=head1 METHODS

=head2 destroy

Destroys a context. You must call this method when session finished.

=head2 Context

Returns global an object of type of C<Ambrosia::Context>.

=head1 THREADS

Not tested.

=head1 BUGS

Please report bugs relevant to C<Ambrosia> to <knm[at]cpan.org>.

=head1 COPYRIGHT AND LICENSE

lib/Ambrosia/Logger.pm  view on Meta::CPAN


sub DESTROY
{}

1;

__END__

=head1 NAME

Ambrosia::Logger - a class for create global object for logging.

=head1 VERSION

version 0.010

=head1 SYNOPSIS

    use Ambrosia::Logger;
    BEGIN {
        instance Ambrosia::Logger('myApplication', DEBUG => 1, INFO_EX => 1, INFO => 1, -prefix => 'GoogleCoupon_', -dir => $logger_path);

lib/Ambrosia/Logger.pm  view on Meta::CPAN

    }

    logger->log('is just message', 'other message' );
    logger->log_info('is simple info', ... );
    logger->log_info_ex('is dump of structures info', {foo=>1}, [{bar=>1},{baz=>2}] );
    logger->error('message about errors');
    logger->debug('write with the message and the stack of calls');

=head1 DESCRIPTION

C<Ambrosia::Logger> is a class for create global object for logging.
Implement the pattern B<Singleton>.

=head2 instance

Instances the named object of type C<Ambrosia::Logger> in the pool.
This method not exported. Use as constructor: C<instance Ambrosia::Logger(.....)>

=head2 logger

Returns the global object of type C<Ambrosia::Logger>.
C<logger(name)> - the name is optional param. Call with name if you not assign current process to logger yet.

=head2 assign

Assigns current process to the global named object of type C<Ambrosia::Logger>.

=head1 DEPENDENCIES

L<File::Path>
L<IO::File>
L<Data::Dumper>
L<Time::HiRes>
L<Scalar::Util>
L<Exporter>
L<Ambrosia::error::Exceptions>

lib/Ambrosia/Utils/Container.pm  view on Meta::CPAN


package deferred;

use Ambrosia::error::Exceptions;

use overload
    '%{}' => \&as_hash,
    '@{}' => \&__as_array,
    '${}' => \&__as_scalar,
    '&{}' => \&__as_func,
    '*{}' => \&__as_glob,
    '==' => \&__as_bool,
    'bool'=> \&__as_bool,
    '""'  => \&__as_string,
    '0+'  => \&__as_number,
    'fallback' => 1
    ;

sub call(&)
{
    return bless {code => $_[0]}, 'deferred';

lib/Ambrosia/Utils/Container.pm  view on Meta::CPAN

    #    $_[0]->{scalar} = '' . $_[0]->{code}->();
    #}
    #return $_[0]->{scalar};
}

sub __as_func
{
    goto &__as_any;
}

sub __as_glob
{
    goto &__as_any;
}

sub __as_bool
{
    goto &__as_any;
    #unless ( exists $_[0]->{bool} )
    #{
    #    $_[0]->{bool} = '' . $_[0]->{code}->();

t/Ambrosia/Event.t  view on Meta::CPAN

    $foo->run();
    ok($foo->foo == 2, 'fire event with ignore previos'); #test #3

    $foo->on_run(sub {$foo->foo=3; return 0;});
    $foo->run();
    ok($foo->foo == 4, 'fire event throw chain previos'); #test #4

    my $abort = 0;
    Ambrosia::Event::attachHandler('','on_abort', sub {$abort=123});
    $foo->abort();
    ok($abort == 123, 'global event');
}



( run in 0.569 second using v1.01-cache-2.11-cpan-49f99fa48dc )