App-ZofCMS
view release on metacpan or search on metacpan
lib/App/ZofCMS/Plugin/DBIPPT.pm view on Meta::CPAN
=head3 C<key>
plug_dbippt => {
key => 'dbi',
}
# or
plug_dbippt => {
key => [ qw/dbi dbi2 dbi3 etc/ ],
}
# or
plug_dbippt => {
key => sub {
my ( $t, $q, $config ) = @_;
return
unless $q->{single};
return $q->{single} == 1
? 'dbi' : [ qw/dbi dbi2 dbi3 etc/ ];
}
}
B<Optional>. Takes either
a string, subref or an arrayref as a value. If the value is a subref,
that subref will be executed and its return value will be assigned
to C<key> as if it was already there. The C<@_> will contain
(in that order) ZofCMS Template hashref, query parameters hashref and
L<App::ZofCMS::Config> object. Passing (or returning from the sub)
a string is the same as passing an arrayref with just that string in it.
Each element of the arrayref specifies the second-level key(s) inside
C<cell> first-level key value of which is an arrayref of either hashrefs
or arrayrefs (i.e. typical output of L<App::ZofCMS::Plugin::DBI>).
B<Defaults to:> C<dbi>
=head3 C<n>
plug_dbippt => {
n => 'comments',
}
# or
plug_dbippt => {
n => [ 'comments', 'posts', 'messages' ],
}
# or
plug_dbippt => {
n => sub {
my ( $t, $q, $config ) = @_;
return
unless $q->{single};
return $q->{single} == 1
? 'comments' : [ qw/comments posts etc/ ];
}
}
B<Optional>. Pneumonic: B<n>ew lines. Keys/indexes specified in
C<n> argument will have HTML entities escaped and new lines converted
to C<< <br> >> HTML elements.
Takes either a string, subref or an arrayref as a value. If the value is a subref,
that subref will be executed and its return value will be assigned
to C<n> as if it was already there. The C<@_> will contain
(in that order) ZofCMS Template hashref, query parameters hashref and
L<App::ZofCMS::Config> object. Passing (or returning from the sub)
a string is the same as passing an arrayref with just that string in it.
If set to C<undef> no processing will be done for new lines.
Each element of the arrayref specifies either the B<keys> of the hashrefs
(for DBI plugin that would be when second element of C<sql> arrayref
is set to C<< { Slice => {} } >>) or B<indexes> of the arrayrefs
(if they are arrayrefs).
B<Defaults to:> C<undef>
=head3 C<t>
plug_dbippt => {
t => undef, # no processing, as the default value is "time"
}
# or
plug_dbippt => {
t => [ qw/time post_time other_time/ ],
}
# or
plug_dbippt => {
t => sub {
my ( $t, $q, $config ) = @_;
return
unless $q->{single};
return $q->{single} == 1
? 'time' : [ qw/time post_time other_time/ ];
}
}
B<Optional>. Pneumonic: B<t>ime. Keys/indexes specified in
C<t> argument are expected to point to either C<undef> or empty string, in which case, no conversion will
be done, or values of C<time()> output
and what will be done is C<scalar localtime($v)> (where C<$v>) is
the original value) run on them and the return is assigned back to
the original. In other words, they will be converted from C<time> to
C<localtime>.
Takes either a string, subref or an arrayref as a value. If the value is a subref,
that subref will be executed and its return value will be assigned
to C<t> as if it was already there. The C<@_> will contain
(in that order) ZofCMS Template hashref, query parameters hashref and
L<App::ZofCMS::Config> object. Passing (or returning from the sub)
a string is the same as passing an arrayref with just that string in it.
If set to C<undef> no processing will be done.
Each element of the arrayref specifies either the B<keys> of the hashrefs
(for DBI plugin that would be when second element of C<sql> arrayref
is set to C<< { Slice => {} } >>) or B<indexes> of the arrayrefs
(if they are arrayrefs).
B<Defaults to:> C<time>
( run in 0.589 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )