« blib/lib/Mojolicious/Command/generate/callbackery_app/bin/script.pl
↑ Summary
blib/lib/Mojolicious/Command/generate/callbackery_app/lib/App/Controller/RpcService.pm »
| 1 | % my $p = shift; | ||
| 2 | package <%= $p->{class} %>; | ||
| 3 | |||
| 4 | use Mojo::Base 'CallBackery'; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | <%= $p->{class} %> - the application class | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | use Mojolicious::Commands; | ||
| 13 | Mojolicious::Commands->start_app('<%= $p->{class} %>'); | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | Configure the mojolicious engine to run our application logic | ||
| 18 | |||
| 19 | =cut | ||
| 20 | |||
| 21 | =head1 ATTRIBUTES | ||
| 22 | |||
| 23 | <%= $p->{class} %> has all the attributes of L<CallBackery> plus: | ||
| 24 | |||
| 25 | =cut | ||
| 26 | |||
| 27 | =head2 config | ||
| 28 | |||
| 29 | use our own plugin directory and our own configuration file: | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | has config => sub { | ||
| 34 | my $self = shift; | ||
| 35 | my $config = $self->SUPER::config(@_); | ||
| 36 | $config->file($ENV{<%= $p->{class} %>_CONFIG} || $self->home->rel_file('etc/<%= $p->{name} %>.cfg')); | ||
| 37 | unshift @{$config->pluginPath}, '<%= $p->{class} %>::GuiPlugin'; | ||
| 38 | return $config; | ||
| 39 | }; | ||
| 40 | |||
| 41 | has database => sub { | ||
| 42 | my $self = shift; | ||
| 43 | my $database = $self->SUPER::database(@_); | ||
| 44 | $database->sql->migrations | ||
| 45 | ->name('<%= $p->{class} %>BaseDB') | ||
| 46 | ->from_data(__PACKAGE__,'appdb.sql') | ||
| 47 | ->migrate; | ||
| 48 | return $database; | ||
| 49 | }; | ||
| 50 | |||
| 51 | 1; | ||
| 52 | |||
| 53 | =head1 COPYRIGHT | ||
| 54 | |||
| 55 | Copyright (c) <%= $p->{year} %> by <%= $p->{fullName} %>. All rights reserved. | ||
| 56 | |||
| 57 | =head1 AUTHOR | ||
| 58 | |||
| 59 | S<<%= $p->{fullName} %> E<lt><%= $p->{email} %>E<gt>> | ||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | __DATA__ |