Ambrosia

 view release on metacpan or  search on metacpan

Example/README  view on Meta::CPAN

                             Ambrosia framework.
              Copyright (c) 2012 by Kuritsyn Nikolay <knm@cpan.org>

Project version: 0.10
Project state: Experimental / Unde construction
Licension: see LICENSE

"ambrosia" is the script to create project skeleton that implements CRUD.

Before run the "ambrosia" you should have the ready database
and the installed Apache 1.3 with mod_perl.

META.yml  view on Meta::CPAN

--- #YAML:1.0
name:               Ambrosia
version:            0.010
abstract:           a powerful web application framework that can be used to create general applications too.
author:
    - Nikolay Kuritsyn <knm@cpan.org>
license:            perl
distribution_type:  module
configure_requires:
    ExtUtils::MakeMaker:  6.31
    File::ShareDir::Install:  0.03
build_requires:
    Moose:            0
    Test::Deep:       0

Makefile.PL  view on Meta::CPAN

    close $fh;
}

use ExtUtils::MakeMaker 6.31;

use File::ShareDir::Install;
install_share dist => "share";


my %WriteMakefileArgs = (
  'ABSTRACT' => 'a powerful web application framework that can be used to create general applications too.',
  'AUTHOR' => 'Nikolay Kuritsyn <knm@cpan.org>',
  'BUILD_REQUIRES' => {
    'Moose' => '0',
    'Test::Deep' => '0',
    'Test::Exception' => '0',
    'Test::More' => '0'
  },
  'CONFIGURE_REQUIRES' => {
    'ExtUtils::MakeMaker' => '6.31',
    'File::ShareDir::Install' => '0.03'

README  view on Meta::CPAN

                             Ambrosia framework.
              Copyright (c) 2012 by Kuritsyn Nikolay <knm@cpan.org>

Project version: 0.10
Project state: Experimental / Unde construction
Licension: see LICENSE

This archive contains the distribution Ambrosia,
a powerful web application framework that can be used
to create general applications too.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

INSTALLATION

    perl Makefile.PL
    make
    make test

lib/Ambrosia.pm  view on Meta::CPAN

package Ambrosia;
our $VERSION = 0.010;
1;

__END__

=head1 NAME

Ambrosia - a powerful web application framework that can be used to create general applications too.

=head1 VERSION

    The current release is experimental.
version 0.010

=head1 DESCRIPTION

(I'm sorry for my English. And I apologize for the scant documentation. A little bit later I will fill this gap.)

The Ambrosia is a powerful framework to build web applications.
The Ambrosia implements MVC model for applications.
In this document I will briefly describe how to use the Ambrosia in general.
For better understanding see the examples.

For further information, please check the following documentation:

=over 4

=item L<Ambrosia::Meta>

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

    my @callers;
 
    while ( do { package DB; ($package, $line, $subroutine) = (caller($x++))[0, 2, 3] } )
    {
        my @arg = $subroutine !~ /^$p\:\:/ ? @DB::args : ('...');
        unshift @callers, "\t$subroutine"
            . ( $subroutine ne '(eval)' ? ('( '.(join ", ", @arg).' )'):'')
            . ' At ' . $package
            . ' line ' . $line;
    }
    push @msg, "\nstack frames = [\n", (join "\n", @callers), "\n]";
    $self->log_info_ex(@msg);
}

sub __info_ex
{
    local $Data::Dumper::Indent = 1;
    shift->log( map { ref $_ ? Dumper($_) : $_ } @_);
}

sub __info

lib/Ambrosia/error/Exception/Error.pm  view on Meta::CPAN

    my $class = shift;
    my $error_code = shift;
    my @msg = @_;

    unless ( $error_code =~ /^E\d+/ )
    {
        unshift @msg, $error_code;
        $error_code = 'E0000';
    }

    my $frames = undef;
    foreach ( @msg )
    {
        if ( ref $_ && eval{$_->can('frames')} )
        {
            $frames = $_;
            last;
        }
    }

    my $self = bless
        {
            _error_code => $error_code,
            _message    => (join ' - ', grep { !ref $_ } @msg),
            _frames     => $frames || [],
        }, $class;

    $self->_addFrames() unless defined $frames;

    die $self;
}

# Формирует стек вызова
sub _addFrames
{
    my $self = shift;
    my $p = __PACKAGE__;
    my $x = 0;
    my ($package, $line, $subroutine);
    
    while ( do { package DB; ($package, $line, $subroutine) = (caller($x++))[0, 2, 3] } )
    {# Do the quickest ones first.
        next if $package eq __PACKAGE__ or substr($subroutine, 0, 33) eq __PACKAGE__;
        my @arg = $subroutine !~ /^$p\:\:/ ? @DB::args : ('...');
        push @{ $self->{_frames} }, { 'callers' => [$line, $subroutine, $package], 'argums' => \@arg };
    }
}

sub frames
{
    my $self = shift;

    local $@;
    return $self->{_frames}->frames if ref $self->{_frames} && ref $self->{_frames} ne 'ARRAY' && eval {$self->{_frames}->can('frames')};

    my @frms;
    foreach my $f ( @{$self->{_frames}} )
    {
        if ( ref $f )
        {
            my $subrutine = $f->{callers}->[1];
            unshift @frms, &PREF . $subrutine
                        . ( $subrutine ne '(eval)'
                                ? ( '( ' . (join ', ', map { defined $_ ? $_ : 'undef' } @{$f->{argums}}) . ' )')
                                : ''
                          )
                        . ' at ' . $f->{callers}->[2]

lib/Ambrosia/error/Exception/Error.pm  view on Meta::CPAN

}

sub message
{
    my $self = shift;
    my $indent = shift || 0;
    local $@;

    my $pref = (&PREF x $indent);
    my $msg = $pref . $self->{_message};
    if ( ref $self->{_frames} && ref $self->{_frames} ne 'ARRAY' && eval {$self->{_frames}->can('message')} )
    {
        $msg .= " [\n" . $self->{_frames}->message($indent+1) . "\n$pref]";
    }
    return $msg;
}

sub stack
{
    return join("\n", reverse @{$_[0]->frames()}) . "\n";
}

sub as_string
{
#warn caller(0);
    my $self = shift;
    return $self->message() . "\n" . $self->stack();
}

sub code

lib/Ambrosia/error/Exception/Error.pm  view on Meta::CPAN

Return a stack of calls.

=cut

=head2 as_string

Returns this exception as string.

=cut

=head2 frames

Returns pointer to list of calls.

=cut

=head2 code

Returns an error code.

=cut

share/Managers/buildApp.pm  view on Meta::CPAN

    if ( config->TemplateStyle->{htmltemplate} eq 'xslt' )
    {
        $tpl_path = 'XSLT';
        $ex = '.xsl';
    }
    elsif( config->TemplateStyle->{htmltemplate} eq 'tt' )
    {
        $tpl_path = 'TOOLKIT';
        $ex = '.ttkt.html';
    }
    if (  config->TemplateStyle->{jsframework} eq 'dojo' )
    {
        $tpl_path .= '+DOJO';
    }
    $self->makeEntityCode($hDir{dirTemplates}, $tmplPath . '/Templates/Templates/' . $tpl_path . '/edit_json.xsl', '_edit_json' . $ex, 1, '@Type!="BIND" and @Type!="VIEW"');
    copy($tmplPath . '/Templates/Templates/' . $tpl_path . '/message.xsl',
         $hDir{dirTemplates} . '/_message.xsl') or die "Copy failed: $! ['${tmplPath}/Templates/Templates/${tpl_path}/message.xsl']";

    copy($tmplPath . '/Templates/incUtils.xsl',
         $hDir{dirTemplates} . '/_inc_utils.xsl') or die "Copy failed: $! ['${tmplPath}/Templates/incUtils.xsl']";

share/Managers/buildApp.pm  view on Meta::CPAN

    mkpath($dirEntity, 0, oct(777)) unless -d $dirEntity;

    my $dirResources = (config->ProjectPath || ('./' . $appName)) . '/Resources';
    mkpath($dirResources, 0, oct(777)) unless -d $dirResources;

    my $dirManagers = (config->ProjectPath || ('./' . $appName)) . '/Managers';
    mkpath($dirManagers, 0, oct(777)) unless -d $dirManagers;

    my $dirTemplates = (config->ProjectPath || ('./' . $appName)) . '/Templates';
    mkpath($dirTemplates, 0, oct(777)) unless -d $dirTemplates;
    if ( config->TemplateStyle->{jsframework} eq 'dojo' )
    {
        my $ajaxDir = $dirHtdocs . '/ajax/libs/dojo';
        mkpath($ajaxDir, 0, oct(777)) unless -d $ajaxDir;
        eval { symlink(config->DojoToolkitPath, $ajaxDir . '/1.7.2'); 1 };
    }

    my $dirConfig = (config->ProjectPath || ('./' . $appName)) . '/Config';
    mkpath($dirConfig, 0, oct(777)) unless -d $dirConfig;

    my $dirValidators = (config->ProjectPath || ('./' . $appName)) . '/Validators';

share/Managers/buildConfig.pm  view on Meta::CPAN

    #Application label (title)
    Label => '##TITLE##',

    #Template charset
    Charset => '##CHARSET##',

    #The path to templates of Ambrosia Builder
    TemplatePath  => '##SHARE_DIR##',

    #Now only so. Don't edit this.
    TemplateStyle => { jsframework => 'dojo', htmltemplate => 'xslt' },
    #You must load Dojo Toolkit 1.7.2 from http://download.dojotoolkit.org/release-1.7.2/dojo-release-1.7.2.tar.gz
    #and extract it into this directory
    DojoToolkitPath => '##DOJO_TOOLKIT_PATH##',

    #parameters for project
    ServerName => '##HTTP_SERVER_NAME##',
    ServerPort => ##HTTP_PORT##,

    #The path to the directory where the project will be deployed
    ProjectPath  => $ROOT . '/##NAME##',

share/Templates/Templates/XSLT+DOJO/list_json.xsl  view on Meta::CPAN

					}, "grid");
					grid.startup();
				});
		</script>
	</head>
	<body class="claro">
		<div class="claro dojoxGridMasterHeader head">List of <xsl:value-of select="//repository/@Name"/></div>
		<div id="grid"></div>
	<xsl:if test="//repository/@mutable=1">
		<div id="exForm" data-dojo-type="dijit.Dialog" title="Edit" style="overflow:auto; width: 300px; height: 300px; display:none;">
			<iframe id="exFormFrame" src="" style="overflow:auto; width: 99%; border:0px;">
			</iframe>
		</div>
	</xsl:if>
	</body>
</html>
</xsl:template>

<xsl:template match="//repository/Field">
	{
		name: "<xsl:value-of select="@label"/>",
		field: "<xsl:value-of select="@field"/>",

share/Templates/Templates/XSLT+DOJO/main.xsl  view on Meta::CPAN

			<div id="leftCol" class="leftCol" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'left', splitter: true"><div style="width: 100%;height:50%;">
				<xslt:apply-templates select="/atns:Application/atns:MenuGroups" />
				<a>
					<xsl:attribute name="href">
						<xsl:value-of>
							<xslt:attribute name="select"><xslt:value-of select="concat('concat(', $UcAppName, '/@script', ',', $s_q, '/?action=/exit', $s_q, ')')" /></xslt:attribute>
						</xsl:value-of>
					</xsl:attribute>Logout</a><br />
			</div></div>
			<div class="centerPanel" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'center'">
				<iframe name="mainFrame" style="width:100%; height:99%; border:0px;"></iframe>
			</div>
		</div>
	</body>
</html>

</xsl:template>
</xsl:stylesheet>

</xslt:template>



( run in 1.611 second using v1.01-cache-2.11-cpan-e1769b4cff6 )