-
-
02 Mar 2021 13:12:11 UTC
- Distribution: Mojolicious-Che
- Module version: 0.0902
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues
- Testers (97 / 0 / 0)
- Kwalitee
Bus factor: 1- 42.67% Coverage
- License: perl_5
- Perl: v5.6.0
- Activity
24 month- Tools
- Download (9.58KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
++ed by:1 non-PAUSE user- Dependencies
- Mojo::Log::Che
- Mojolicious
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- Mojolicious::Che
- VERSION
- NAME
- SYNOPSIS
- Config file
- ATTRIBUTES
- METHODS
- SEE ALSO
- AUTHOR
- BUGS / CONTRIBUTING
- COPYRIGHT
Mojolicious::Che
Доброго всем
¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !
VERSION
0.0902
NAME
Mojolicious::Che - Мой базовый модуль для приложений Mojolicious. Нужен только развернутый конфиг.
SYNOPSIS
# app.pl use lib 'lib'; use Mojo::Base 'Mojolicious::Che'; __PACKAGE__->new(config => 'lib/Config.pm')->start();
Config file
Порядок строк в этом конфиге соответствует исполнению в модуле!
{ 'Проект'=>'Тест-проект', # mojo => { # defaults => # secrets => # mode=> # log => {level=>...} # static => {paths => [...]}, # renderer => {paths => [...], classes => [...], }, # session[s] => # has => # plugins => # hooks => # namespaces => # routes => # jobs => # types => # }, # or with prefix mojo_ # Default values for "stash" in Mojolicious::Controller, assigned for every new request. mojo_defaults => {layout=>'default',}, # 'шифры' => [ mojo_secrets => ['true 123 my app',], mojo_mode=> 'development', mojo_log=>{level => 'error'}, mojo_static_paths => ["static"], mojo_renderer_classes => ["Mojolicious::Foo::Fun"], # 'сессия'(или сессии) => mojo_session[s] => {cookie_name => 'EXX', default_expiration => 86400}, # 'хазы' => 'Лет 500-700 назад был такой дикий степной торговый жадный народ ХАЗАРЫ. Столицей их "государства" был город Тьмутаракань, где-то на берегу моря Каспия. Потомки этих людей рассыпаны по странам России, Средней Азии, Европы. Есть мнение, что хазары присвоили себе название ЕВРЕИ, но это не те библейские кроткие евреи, а жадные потомки кроманьонцев' mojo_has => { foo => sub {my $app = shift; return 'is a bar';}, }, # 'базы' => # will be as has! dbh=>{ 'main' => { # DBI->connect(dsn, user, passwd, $attrs) connect => ["DBI:Pg:dbname=test;", "postgres", undef, { ShowErrorStatement => 1, AutoCommit => 1, RaiseError => 1, PrintError => 1, pg_enable_utf8 => 1, #mysql_enable_utf8 => 1, #mysql_auto_reconnect=>1, }], # or use Foo::Dbh; external defined dbh # dbh => Dbh->dbh, # will do on connect do => ['set datestyle to "ISO, DMY";',], # prepared sth will be as has $app->sth->{<dbh name>}{<sth name>} sth => { foo => <<SQL, select * from foo where bar = ?; SQL }, } }, # 'запросы' => # prepared sth will be as has $app->sth->{<dbh name>}{<sth name>} sth => { main => { now => "select now();" }, }, # 'плугины'=> [ mojo_plugins=>[ ['Foo::Bar'], [Foo::Bar::Plugin => opt1 => ..., opt2 => ...], ['Foo::Plugin' => sub {<...returns config data list...>}], ], # 'хуки' => mojo_hooks=>{ #~ before_dispatch => sub {1;}, }, # 'спейсы' => [...] namespaces => ['Space::Shattle'], # 'маршруты' => [...] routes => [ [get=>'/', to=> {cb=>sub{shift->render(format=>'txt', text=>'Hello friend!');},}], ] #~ 'задачи'=> {#first enable plugin Minion jobs => { slow_log => sub { my ($job, $msg) = @_; sleep 5; $job->app->log->error(qq{slow_log "$msg"}); }, }, # или 'типы'=>{...} types => { docx => ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'], ... }, };
ATTRIBUTES
Mojolicious::Che inherits all attributes from Mojolicious and implements the following new ones.
dbh
Set DBI handlers from config dbh (или базы)
my $dbh = $app->dbh->{main};
sth
Set prepared stattements from config sth (или запросы).
my $sth = $app->sth->{main}{foo};
плугины
Apply the plugins. See Mojolicious#plugins, Mojolicious::Plugins.
METHODS
Mojolicious::Che inherits all methods from Mojolicious and implements the following new ones.
сессия()
Session object config apply. See Mojolicious#sessions, Mojolicious::Sessions.
хазы()
Apply the has's. UTF names allow.
хуки()
Apply the hooks. See Mojolicious#HOOKS.
спейсы()
Apply the namespaces. Push @{$app->routes->namespaces} your namespaces. See Mojolicious#routes.
namespaces => ['Space::Shattle'],
маршруты()
Apply the routes. See Mojolicious#routes, Mojolicious::Guides::Routing.
#~ 'маршруты' => [ 'routes'=>[ [get=>'/', to=> {cb=>sub{shift->render(format=>'txt', text=>'Welcome!');},}], ],
задачи()
Apply the jobs. See Minion.
#~ 'задачи'=> {#first enable plugin Minion 'jobs'=> { # or tasks slow_log => sub { my ($job, $msg) = @_; sleep 5; $job->app->log->error(qq{slow_log "$msg"}); }, },
Apply the new types. See Mojolicious#types, Mojolicious::Types.
SEE ALSO
AUTHOR
Михаил Че (Mikhail Che),
<mche[-at-]cpan.org>
BUGS / CONTRIBUTING
Please report any bugs or feature requests at https://github.com/mche/Mojolicious-Che/issues. Pull requests also welcome.
COPYRIGHT
Copyright 2016+ Mikhail Che.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 492:
Unknown directive: =head
Module Install Instructions
To install Mojolicious::Che, copy and paste the appropriate command in to your terminal.
cpanm Mojolicious::Che
perl -MCPAN -e shell install Mojolicious::Che
For more information on module installation, please visit the detailed CPAN module installation guide.