CHI-Cascade
view release on metacpan or search on metacpan
lib/CHI/Cascade/Rule.pm view on Meta::CPAN
The instance of this object is passed to L<CHI::Cascade/code>,
L<CHI::Cascade/coderef>, L<CHI::Cascade/recomputed>,
L<CHI::Cascade/depends_catch> by L<CHI::Cascade> as first argument I<(The API of
running this code was changed since v0.16)>. You can use it object as accessor
to some parameters of your currect executed target.
=head1 METHODS
=over
=item qr_params
returns a list. It is used for getting a result of C<=~> operation if target is
described for L<rule|CHI::Cascade/rule> through C<qr//> operator.
=item depends
returns arrayref of dependencies (L<depends|CHI::Cascade/depends> option of
L<rule|CHI::Cascade/rule> method) even if one scalar value is passed there (as
one dependence). Always is defined even there no defined C<depends> option for
C<rule>. If L<'depends'|CHI::Cascade/depends> is coderef you will get a returned
value of one. If any item of depends array is code it will be executed too. To
see more details in L<CHI::Cascade/depends>.
=item target()
returns current target as plain text after matching.
=item params()
returns any data of any type what were passed to L<CHI::Cascade/params>
=item cascade()
returns reference to L<CHI::Cascade> instance object for this rule.
=item stash()
It returns I<hashref> to a stash. A stash is hash for temporary data between
rule's codes. It can be used only from inside call stack of L<CHI::Cascade/run>. Example:
$cascade->run( 'target', stash => { key1 => value1 } )
and into rule's code:
$rule->stash->{key1}
If a L<CHI::Cascade/run> method didn't get stash hashref the default stash will be as empty
hash. You can pass a data between rule's codes but it's recommended only in
special cases. For example when run's target cannot get a full data from its
target's name.
=item value_expires
Sets an L<CHI>'s cache expire value for the target marker of this value to be
created by this rule in notation described in L<CHI/"DURATION EXPRESSIONS">. The
B<default> is 'never'. It can be B<coderef> or B<string scalar> format as
L<CHI/"DURATION EXPRESSIONS">. A B<coderef> to be called as C<<
$coderef->($rule) >> and should return expire time as string value. You can use
this method inside L<CHI::Cascade/code> and L<CHI::Cascade/recomputed> your
callbacks if you want to force recomputing of current target through minimum
this time.
=back
=head1 AUTHOR
This module has been written by Perlover <perlover@perlover.com>
=head1 LICENSE
This module is free software and is published under the same terms as Perl
itself.
=head1 SEE ALSO
L<CHI::Cascade>
=cut
( run in 0.731 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )