| 1 | package Template::Liquid::Tag::Decrement; | ||
| 2 | 25 | our $VERSION = '1.0.23'; | |
| 3 | 25 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 25 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 25 | require Template::Liquid::Error; | |
| 6 | 25 | require Template::Liquid::Utility; | |
| 7 | 25 | ▶ | use base 'Template::Liquid::Tag::Increment'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 25 | ▶ | sub import { Template::Liquid::register_tag('decrement') } |
|
Subroutine
import: called CC=1 SCAR=0.0
| |||
| 9 | # | ||
| 10 | 2 | ▶ | sub _initial {-1} |
|
Subroutine
_initial: called CC=1 SCAR=0.0
| |||
| 11 | 2 | ▶ | sub _direction {-1} |
|
Subroutine
_direction: called CC=1 SCAR=0.0
| |||
| 12 | 0 | ▶ | sub _me {'decrement'} |
|
Subroutine
_me: not called CC=1 SCAR=6.9
| |||
| 13 | 25 | 1; | |
| 14 | |||
| 15 | =pod | ||
| 16 | |||
| 17 | =encoding UTF-8 | ||
| 18 | |||
| 19 | =begin stopwords | ||
| 20 | |||
| 21 | Lütke jadedPixel | ||
| 22 | |||
| 23 | =end stopwords | ||
| 24 | |||
| 25 | =head1 NAME | ||
| 26 | |||
| 27 | Template::Liquid::Tag::Decrement - Document-level Persistant Number | ||
| 28 | |||
| 29 | =head1 Description | ||
| 30 | |||
| 31 | Creates a new number variable, and decreases its value by one every time it is | ||
| 32 | called. The initial value is C<-1>. | ||
| 33 | |||
| 34 | =head1 Synopsis | ||
| 35 | |||
| 36 | {% decrement my_counter %} | ||
| 37 | {% decrement my_counter %} | ||
| 38 | {% decrement my_counter %} | ||
| 39 | |||
| 40 | ...will result in... | ||
| 41 | |||
| 42 | -1 | ||
| 43 | -2 | ||
| 44 | -3 | ||
| 45 | |||
| 46 | =head1 Notes | ||
| 47 | |||
| 48 | Like C<increment>, variables declared inside C<decrement> are independent from | ||
| 49 | variables created through C<assign> or C<capture>. | ||
| 50 | |||
| 51 | =head1 See Also | ||
| 52 | |||
| 53 | Liquid for Designers: http://wiki.github.com/tobi/liquid/liquid-for-designers | ||
| 54 | |||
| 55 | =head1 Author | ||
| 56 | |||
| 57 | Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/ | ||
| 58 | |||
| 59 | The original Liquid template system was developed by jadedPixel | ||
| 60 | (http://jadedpixel.com/) and Tobias Lütke (http://blog.leetsoft.com/). | ||
| 61 | |||
| 62 | =head1 License and Legal | ||
| 63 | |||
| 64 | Copyright (C) 2009-2022 by Sanko Robinson E<lt>sanko@cpan.orgE<gt> | ||
| 65 | |||
| 66 | This program is free software; you can redistribute it and/or modify it under | ||
| 67 | the terms of The Artistic License 2.0. See the F<LICENSE> file included with | ||
| 68 | this distribution or http://www.perlfoundation.org/artistic_license_2_0. For | ||
| 69 | clarification, see http://www.perlfoundation.org/artistic_2_0_notes. | ||
| 70 | |||
| 71 | When separated from the distribution, all original POD documentation is covered | ||
| 72 | by the Creative Commons Attribution-Share Alike 3.0 License. See | ||
| 73 | http://creativecommons.org/licenses/by-sa/3.0/us/legalcode. For clarification, | ||
| 74 | see http://creativecommons.org/licenses/by-sa/3.0/us/. | ||
| 75 | |||
| 76 | =cut | ||