-
-
04 Oct 2018 11:12:03 UTC
- Distribution: DBIx-Mojo-Template
- Module version: 0.060
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (1)
- Testers (740 / 5 / 0)
- Kwalitee
Bus factor: 1- 88.11% Coverage
- License: artistic_2
- Perl: v5.6.0
- Activity
24 month- Tools
- Download (7.49KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
++ed by:1 non-PAUSE userand 1 contributors- ÐÐ¸Ñ Ð°Ð¸Ð» Че (Mikhail Che) <mche[-at-]cpan.org>
- Dependencies
- Clone
- Hash::Merge
- Mojolicious
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- DBIx::Mojo::Template
- NAME
- VERSION
- SYNOPSIS
- SUBROUTINES/METHODS
- AUTHOR
- BUGS / CONTRIBUTING
- LICENSE AND COPYRIGHT
Доброго всем
DBIx::Mojo::Template
¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !
NAME
DBIx::Mojo::Template - Render SQL statements by Mojo::Template
VERSION
0.060
SYNOPSIS
use DBIx::Mojo::Template; my $dict = DBIx::Mojo::Template->new(__PACKAGE__,mt=>{tag_start=>'%{', tag_end=>'%}',}); my $sql = $dict->{'foo'}->render(table=>'foo', where=> 'where id=?'); # or same my $sql = $dict->render('bar', where=> 'where id=?'); __DATA__ @@ foo?cache=1 %# my foo statement with prepare_cached (model sth) select * from {% $table %} {% $where %}
SUBROUTINES/METHODS
new
my $dict = DBIx::Mojo::Template->new('Foo::Bar', vars=>{...}, mt=>{...})
where arguments:
$pkg (string)
Package name, where __DATA__ section SQL dictionary. Package must be loaded (use/require) before!
vars (hashref)
Hashref of this dict templates variables. Vars can be merged when render - see #render.
mt (hashref)
For Mojo::Template object attributes. See Mojo::Template#ATTRIBUTES.
mt=>{ line_start=>'+', }
Defaults <mt> attrs:
mt=> {vars => 1, prepend=>'no strict qw(vars); no warnings qw(uninitialized);',}
data (arrayref) - optional
Define extra data files for dictionary. Absolute or relative to path of the module $pkg file point.
singleton
Merge ditcs packages to one. Arguments same as #new.
DBIx::Mojo::Template->singleton('Foo'); my $dict = DBIx::Mojo::Template->singleton('Bar');
render
Render template dict key.
my $sql = $dict->render($key, var1=>..., var2 => ...,);
Each dict item is a object DBIx::Mojo::Statement with one method
render
:my $sql = $dict->{'key foo'}->render(bar=>'baz', ...);
data
Same as #new but returns unblessed hashref dict.
AUTHOR
Михаил Че (Mikhail Che),
<mche[-at-]cpan.org>
BUGS / CONTRIBUTING
Please report any bugs or feature requests at https://github.com/mche/DBIx-Mojo-Template/issues. Pull requests also welcome.
LICENSE AND COPYRIGHT
Copyright 2016 Михаил Че (Mikhail Che).
This module is free software; you can redistribute it and/or modify it under the term of the Perl itself.
Module Install Instructions
To install DBIx::Mojo::Template, copy and paste the appropriate command in to your terminal.
cpanm DBIx::Mojo::Template
perl -MCPAN -e shell install DBIx::Mojo::Template
For more information on module installation, please visit the detailed CPAN module installation guide.