Ado

 view release on metacpan or  search on metacpan

lib/Ado.pm  view on Meta::CPAN

            if   (ref $over eq 'HASH') { $r->over(%$over); }
            else                       { $r->over($over); }
        }
        if ($via) {
            $r->via(@$via);
        }
        $r->to(ref $to eq 'HASH' ? %$to : $to);
    }

    # Default "/perldoc" page is Ado/Manual
    my $perldoc = $routes->lookup('perldocmodule');
    if ($perldoc) { $perldoc->to->{module} = 'Ado/Manual'; }

    return $app;
}

sub define_mime_types {
    my ($app) = @_;
    my $mimes = $app->config('types') || {};    #HASHREF
    foreach my $mime (keys %$mimes) {

        # Add new MIME type or redefine any existing
        $app->types->type($mime => $mimes->{$mime});
    }
    return $app;
}

1;


=pod

=encoding utf8

=head1 NAME

Ado - a rapid active commotion (framework for web-projects on Mojolicious)

=head1 SYNOPSIS

  require Mojolicious::Commands;
  Mojolicious::Commands->start_app('Ado');

=head1 DESCRIPTION

L<Ado> is a framework for web-projects based on L<Mojolicious>, written in the
L<Perl programming language|http://www.perl.org/>.  This is the base
application class. Ado C<ISA> L<Mojolicious>.  For a more detailed description
on what Ado is and how to get started with Ado see B<L<Ado::Manual>>.

=head1 ATTRIBUTES

Ado inherits all attributes from Mojolicious and implements the following new
ones.

=head2 ado_home

Returns an instance of L<Mojo::Home> pointing to the base directory where
L<Ado> is installed.

    ~$ ado eval 'say app->ado_home'
    /home/berov/opt/public_dev/Ado

=head2 CODENAME

Returns the current C<CODENAME>.

=head2 home

    #/where/is/your_app/rootdir
    $app->home;

Returns the root directory into which $app is installed.  The guessing order is
the following:

=over

=item 1. If C<$ENV{MOJO_HOME}> is defined, it is honored.

=item 2. The upper directory of the directory in which the starting executable
C<$app-E<gt>moniker> is found, e.g. C<bin/..>.  This may happen to be the same
as L</ado_home>.

=item 3. Fallback to L<Mojo/home>. This is the usual behavior of any L<Mojo>
application.

=back

=head2 sessions

Access the L<Ado::Sessions> instance. Instantiates one of
L<Ado::Sessions::File>, L<Ado::Sessions::Database>
or L<Mojolicious::Sessions> depending on configuration and returns it.
By default (no configuration in C<etc/ado.conf>)
a L<Mojolicious::Sessions> is returned.


=head1 METHODS

Ado inherits all methods from Mojolicious and implements
the following new ones.


=head2 startup

Sets various default paths like C<templates>, C<site_templates>, C<public>.
Defines L<Mojolicious/secrets> as sha1_sum of C<$moniker.$mode. $home>.  Sets
L<Mojolicious/controller_class> and L<Mojolicious::Routes/namespaces> to
L<${CLASS}::Control>.  Sets L<Mojolicious::Plugins/namespaces> to
C<['Mojolicious::Plugin', "${CLASS}::Plugin"]>.  Sets
L<Mojolicious::Commands/namespaces> to C<${CLASS}::Command>.  C<$CLASS> is
usually L<Ado>.  Then calls the following methods in the order they are listed.
Returns void.

You can amend this behavior in the application configuration file.

=head2 load_config

Checks C<$ENV{MOJO_CONFIG}> and if not set sets it to
C<$app-E<gt>home/etc/ado.conf>.  Loads L<Mojolicious::Plugin::Config> to do the
rest of the dirty work.  Returns $app.



( run in 3.665 seconds using v1.01-cache-2.11-cpan-56fb94df46f )