Ambrosia

 view release on metacpan or  search on metacpan

benchmark/Ambrosia/BaseManager.b  view on Meta::CPAN

#!/usr/bin/perl -w
use warnings;
use strict;
use lib qw(lib t);
use Benchmark;

use Ambrosia::Context;
instance Ambrosia::Context( engine_name => 'CGI', engine_params => {} );
Context->start_session();

use Ambrosia::BaseManager;


my %conf = (

benchmark/Ambrosia/CommonGatewayInterface.b  view on Meta::CPAN

#!/usr/bin/perl -w
use warnings;
use strict;
use lib qw(lib t);
use Benchmark;

use Data::Dumper;

BEGIN
{
    use Ambrosia::Context;
    instance Ambrosia::Context({
            engine_name   => 'CGI',
            engine_params => {

benchmark/Ambrosia/Config.b  view on Meta::CPAN

#!/usr/bin/perl
use strict;
use warnings;
use lib qw(lib t);

use Benchmark;

use Ambrosia::Config;

my $i = 0;
my $h = { param1 => 123, param2 => 456 };

timethese(10_000, {
        'config create'    => sub {

benchmark/Ambrosia/DataProvider.b  view on Meta::CPAN

#!/usr/bin/perl -w
use warnings;
use strict;
use lib qw(lib t);
use Benchmark;

use Ambrosia::DataProvider;

my $confDS = {
    DBI => [
        {
            engine_name   => 'mysql',
            source_name   => 'Employee',
            user          => 'root',

benchmark/Ambrosia/EntityDataModel.b  view on Meta::CPAN

#!/usr/bin/perl
use warnings;
use strict;
use lib qw(lib t);
use Benchmark;

use Ambrosia::DataProvider;
use Ambrosia::EntityDataModel;
use PersonEDM;


my $confDS = {
    DBI => [
        {

benchmark/Ambrosia/Event.b  view on Meta::CPAN

#!/usr/bin/perl
use warnings;
use strict;
use lib qw(lib t);
use Benchmark;

{
    package Foo;
    use Ambrosia::Event qw/on_run/;

    use Ambrosia::Meta;
    class
    {
        public  => [qw/foo/],

benchmark/Ambrosia/Meta.b  view on Meta::CPAN

#!/usr/bin/perl
{
    package Foo;
    use strict;
    use warnings;
    use lib qw(lib t ..);
    use Ambrosia::Event qw/on_run/;

    use Ambrosia::Meta;
    class
    {
        public     => [qw/Name Age/],
        protected  => [qw/State/],
    };

    sub getState

benchmark/Ambrosia/Meta.b  view on Meta::CPAN

        return $_[0]->State;
    }

    1;
}

{
    package FooSealed;
    use strict;
    use warnings;
    use lib qw(lib t ..);
    use Ambrosia::Event qw/on_run/;

    use Ambrosia::Meta;
    class sealed
    {
        public     => [qw/Name Age/],
        protected  => [qw/State/],
    };

    sub getState

benchmark/Ambrosia/Meta.b  view on Meta::CPAN

        return $_[0]->State;
    }

    1;
}

{
    package Vanilla;
    use strict;
    use warnings;
    use lib qw(lib t ..);
    use Ambrosia::Event qw/on_run/;

    sub new
    {
        my $proto = shift;
        my $class = ref $proto || $proto;
        my %self = @_;
        return bless \%self, $class;
    };

benchmark/Ambrosia/Meta.b  view on Meta::CPAN

    }

    1;
}


{
    package main;
    use warnings;
    use strict;
    use lib qw(lib t);
    use Dog;
    use Benchmark qw(:all);

    my $dog = new Dog(Name => 'John Smit', Age => 33, State => 'new', Foo=>123);
    my $foo = new Foo(Name => 'John Smit', Age => 33, State => 'new');
    my $fooSealed = new FooSealed(Name => 'John Smit', Age => 33, State => 'new');
    my $vanilla = new Vanilla(Name => 'John Smit', Age => 33, State => 'new');

my $NUM_ITER = 100_000;
cmpthese($NUM_ITER, {

benchmark/Ambrosia/QL.b  view on Meta::CPAN

#!/usr/bin/perl
use warnings;
use strict;
use lib qw(lib t);
use Benchmark;

use Ambrosia::DataProvider;
use Ambrosia::QL;

use Data::Dumper;

my $confDS = {
    DBI => [
        {

benchmark/Ambrosia/Utils/Enumeration.b  view on Meta::CPAN

#!/usr/bin/perl
use warnings;
use strict;
use lib qw(lib t);
use Benchmark;

{
    package Foo;
    use strict;
    use warnings;
    use lib qw(lib t ..);

    use Ambrosia::Utils::Enumeration property => __state => RUN => 1, DONE => 2;
    use Ambrosia::Utils::Enumeration flag => __options => F1 => 0, F2 => 1, F3 => 2;

    use Ambrosia::Meta;
    class
    {
        private => [qw/__state __options/],
    };

benchmark/Ambrosia/core/ClassFactory.b  view on Meta::CPAN

#!/usr/bin/perl
use strict;
use warnings;
use lib qw(lib t);

use Benchmark;

use Ambrosia::core::ClassFactory;

my $i = 0;
timethese(50_000, {
        'create'    => sub {
            Ambrosia::core::ClassFactory::create('Employes::Person::' . $i++, {public => [qw/FirstName LastName Age/]});
        },

benchmark/Ambrosia/core/Nil.b  view on Meta::CPAN

#!/usr/bin/perl -w
use warnings;
use strict;
use lib qw(lib t);
use Benchmark;

use Ambrosia::core::Nil;

my $sum = 0;
my $str = '';
timethese(100000, {
        'new'    => sub {
            my $my_nil = new Ambrosia::core::Nil;
        },

benchmark/Ambrosia/core/Object.b  view on Meta::CPAN

#!/usr/bin/perl -w
use strict;
use warnings;
use lib qw(lib t);

use Benchmark;
use Data::Dumper;

use Ambrosia::core::ClassFactory;
use Ambrosia::core::Object;
use Bar;

my $bar = new Bar;
$bar->foo_pub1 = 1;

script/ambrosia  view on Meta::CPAN

            $share_dir = $dist_dir . '/share/Ambrosia';
        }
        else
        {
            $dist_dir = $FindBin::Bin . '/../lib';
            $share_dir = $FindBin::Bin . '/../share';
        }
    }
}

use lib $dist_dir;
use lib $share_dir;

BEGIN
{
    use XML::LibXML;

    use Ambrosia::core::Nil;
    use Ambrosia::Config;
    use Ambrosia::Context;
    use Ambrosia::DataProvider;

share/Templates/Common/ApacheInclude.xsl  view on Meta::CPAN

    <IfModule mod_perl.c>
        PerlSetEnv  <xsl:value-of select="$UcAppName" />_ROOT <xsl:value-of select="atns:Application/atns:Host/@ProjectPath" />
        PerlSetEnv  <xsl:value-of select="$UcAppName" />_MODE <xsl:value-of select="atns:Application/atns:Host/@Name" />

        <xsl:if test="boolean(atns:Application/atns:Host/@PerlLibPath)">
        #sometimes it not work correctly
        #PerlSetEnv PERL5LIB <xsl:value-of select="translate(atns:Application/atns:Host/@PerlLibPath, ' ', ':')"></xsl:value-of>:<xsl:value-of select="atns:Application/atns:Host/@ProjectPath"/>
        </xsl:if>

        &lt;Perl>
            use lib qw(<xsl:value-of select="atns:Application/atns:Host/@PerlLibPath"
                        /><xsl:text> </xsl:text
                        ><xsl:value-of select="atns:Application/atns:Host/@ProjectPath"/>);

            $ENV{PATH} = "/usr/local/bin:/usr/bin:/bin";
            delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; 

            use Ambrosia::Config;

            my $rootPath = ($ENV{<xsl:value-of select="$UcAppName" />_ROOT} || '') . '/<xsl:value-of select="$RealAppName" />';

share/Templates/Common/Cgi.xsl  view on Meta::CPAN

<xsl:include href="../incName.xsl" />

<xsl:template match="/">#!/usr/bin/perl
use strict;
use warnings;

our $VERSION = sprintf('0.%03d', q$Revision: 01 $ =~ /(\d+)/o);

BEGIN
{
    use lib qw(<xsl:value-of select="atns:Application/atns:Host/@PerlLibPath"
                /><xsl:text> </xsl:text
                ><xsl:value-of select="atns:Application/atns:Host/@ProjectPath"/>);

    $ENV{PATH} = "/usr/local/bin:/usr/bin:/bin";
    delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; 

    use Ambrosia::Config;

    my $rootPath = ($ENV{<xsl:value-of select="$UcAppName" />_ROOT} || '') . '/<xsl:value-of select="$RealAppName" />';

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

#!/usr/bin/perl

{
    package test1;
    use lib qw(lib t ..);
    use Ambrosia::Assert test1 => 'nodebug';

    our $val = 0;

    sub sucess1
    {
        assert(sub {$val < 2}, 'valid condition');
        return 1;
    }

    sub sucess2
    {
        assert(sub {$val > 2}, 'invalid condition');
        return 1;
    }
}

{
    package test2;
    use lib qw(lib t ..);
    use Ambrosia::Assert test2 => 'debug';

    our $val = 0;

    sub sucess1
    {
        assert(sub {$val < 2}, 'valid condition');
        return 1;
    }

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

#!/usr/bin/perl
use Test::More tests => 8;
#use Test::Exception;
use Test::Deep;
use lib qw(lib t ..);
use Carp;

use Data::Dumper;

BEGIN {
    use_ok( 'Ambrosia::BaseManager' ); #test #1
}

use Ambrosia::Context;
instance Ambrosia::Context( engine_name => 'CGI', engine_params => {} );

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

#!/usr/bin/perl

use Test::More tests => 9;
use Test::Exception;
use Test::Deep;
use lib qw(lib t ../..);

BEGIN {
    use_ok( 'Ambrosia::Config' ); #test #1
}
require_ok( 'Ambrosia::Config' ); #test #2

instance Ambrosia::Config( test => { param1 => 123, param2 => [1,2,3] } );

cmp_ok(config('test')->param1, '==', 123, 'config(test)->param1 is ok'); #test #3
cmp_deeply(config('test')->param2, [1,2,3], 'config(test)->param2 is ok'); #test #4

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

#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 14;
use Test::Exception;
use lib qw(lib t .);
use Carp;

use Data::Dumper;

BEGIN {
    use_ok( 'Ambrosia::DataProvider' ); #test #1
}

my $confDS = do 'db.params';

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

#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 8;
use Test::Exception;
use Test::Deep;
use lib qw(lib t ..);
use Carp;

use Data::Dumper;

use Ambrosia::DataProvider;
use t::PersonEDM;

BEGIN {
    use_ok( 'Ambrosia::EntityDataModel' ); #test #1
}

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

#!/usr/bin/perl
{
    package Foo;
    use strict;
    use warnings;
    use lib qw(lib t ..);
    use Ambrosia::Event qw/on_run/;

    use Ambrosia::Meta;
    class
    {
        public  => [qw/foo/],
    };

    sub run
    {

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

        Ambrosia::Event::fireEvent('', on_abort => 321);
    }

    1;
}

{
    package main;
    use Test::More tests => 5;
    use Test::Exception;
    use lib qw(lib t ..);
    use Carp;

    use Data::Dumper;

    BEGIN {
        use_ok( 'Ambrosia::Event' ); #test #1
    }

    my $foo = new Foo(foo=>123);
    $foo->on_run(sub {$foo->foo=1; return 1;});

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

#!/usr/bin/perl
{
    package Foo;
    use strict;
    use warnings;
    use lib qw(lib t ..);
    use Ambrosia::Event qw/on_run/;

    use Ambrosia::Meta;
    class
    {
        public     => [qw/Name Age/],
        protected  => [qw/State/],
    };

    sub getState

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

        return $_[0]->State;
    }

    1;
}

{
    package FooSealed;
    use strict;
    use warnings;
    use lib qw(lib t ..);
    use Ambrosia::Event qw/on_run/;

    use Ambrosia::Meta;
    class sealed
    {
        public     => [qw/Name Age/],
        protected  => [qw/State/],
    };

    sub getState

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

        return $_[0]->State;
    }

    1;
}

{
    package main;
    use Test::More tests => 6;
    use Test::Exception;
    use lib qw(lib t ..);
    use Carp;

    my $foo = new Foo(Name => 'John Smit', Age => 33, State => 'new');
    ok($foo->Name eq 'John Smit', 'check data in field Name');
    ok($foo->Age == 33, 'check data in field Age');
    ok($foo->getState eq 'new' , 'call method');

    my $fooSealed = new FooSealed(Name => 'John Smit', Age => 33, State => 'new');
    ok($fooSealed->Name eq 'John Smit', 'in sealed check data in field Name');
    ok($fooSealed->Age == 33, 'in sealed check data in field Age');

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

#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 8;

use lib qw(lib t ..);
use Carp;

use Data::Dumper;

BEGIN {
    use_ok( 'Ambrosia::CommonGatewayInterface::Options' ); #test #1
}

sub opt_check
{

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

#!/usr/bin/perl
use strict;
use warnings;
use lib qw(lib t ..);

use Test::More tests => 7;
use Test::Deep;

use Data::Dumper;

use Ambrosia::DataProvider;
#use Ambrosia::QL;

BEGIN {

t/Ambrosia/Utils/Container.t  view on Meta::CPAN

#!/usr/bin/perl
use Test::More tests => 24;
use Test::Deep;
use lib qw(lib t ..);

BEGIN
{
    use_ok( 'Ambrosia::Utils::Container' ); #test #1
}

my $container = new Ambrosia::Utils::Container;

ok($container->set(name => 'John') eq 'John', 'set');

t/Ambrosia/Utils/Enumeration.t  view on Meta::CPAN

#!/usr/bin/perl
{
    package Foo;
    use strict;
    use warnings;
    use lib qw(lib t ..);

    use Ambrosia::Utils::Enumeration property => __state => RUN => 1, DONE => 2;
    use Ambrosia::Utils::Enumeration flag => __options => F1 => 0, F2 => 1, F3 => 2;

    use Ambrosia::Meta;
    class
    {
        private => [qw/__state __options/],
    };

    1;
}

{
    package main;
    use Test::More tests => 17;
    use Test::Exception;
    use lib qw(lib t ..);
    use Carp;

    use Data::Dumper;

    BEGIN {
        use_ok( 'Ambrosia::Utils::Enumeration' ); #test #1
    }

    my $foo = new Foo();

t/Ambrosia/core/ClassFactory.t  view on Meta::CPAN

#!/usr/bin/perl

use Test::More tests => 6;
use Test::Exception;
use Test::Deep;
use Data::Dumper;
use lib qw(lib t ../..);

BEGIN {
    use_ok( 'Ambrosia::Meta' ); #test #1
}
require_ok( 'Ambrosia::Meta' ); #test #2

BEGIN {
    use_ok( 'Ambrosia::core::ClassFactory' ); #test #3
}
require_ok( 'Ambrosia::core::ClassFactory' ); #test #4

t/Ambrosia/core/Nil.t  view on Meta::CPAN

#!/usr/bin/perl

use Test::More tests => 8;
use Test::Exception;

use lib qw(lib t);

BEGIN {
    use_ok( 'Ambrosia::core::Nil' ); #test #1
}
require_ok( 'Ambrosia::core::Nil' ); #test #2

my $my_nil = new_ok Ambrosia::core::Nil => [a => 1, b => 2, c => 3]; #test #3

cmp_ok($my_nil->a, '==', 0, 'Integer 1.'); #test #4
$my_nil->a(321);

t/Ambrosia/core/Object.t  view on Meta::CPAN

#!/usr/bin/perl

use Test::More tests => 23;
use Test::Exception;
use Test::Deep;
use Data::Dumper;
use lib qw(lib t ../..);

BEGIN {
    use_ok( 'Ambrosia::Meta' ); #test #1
}
require_ok( 'Ambrosia::Meta' ); #test #2

BEGIN {
    use_ok( 'Ambrosia::core::Object' ); #test #3
}
require_ok( 'Ambrosia::core::Object' ); #test #4

t/Ambrosia/error/Exception.t  view on Meta::CPAN

#!/usr/bin/perl
use strict;
use Test::More tests => 15;
use lib qw(lib t ..);

BEGIN
{
    use_ok( 'Ambrosia::error::Exceptions' ); #test #1
}

sub err1
{
    throw Ambrosia::error::Exception 'error in "err1()"';
}



( run in 0.626 second using v1.01-cache-2.11-cpan-87723dcf8b7 )