Text::Placeholder::Group::Counter - counts execution of placeholder substitution
use Text::Placeholder; my $placeholder = Text::Placeholder->new( my $counter = '::Counter'); $placeholder->compile('Counter: [=counter=]'); print ${$placeholder->execute()}, "<-\n"; print ${$placeholder->execute()}, "<-\n"; $counter->reset; print ${$placeholder->execute()}, "<-\n";
Text::Placeholder::Group::Counter provides the placeholder 'counter'. Increments the counter each time 'execute' is called.
The design goal was a simple and robust API with a straightforward implementation, respecting all limitations of Perl 5. $obj refers to a Text::Placeholder object.
Resets the counter to one.
Adds the $code_ref under the name of $placeholder. $code_ref is executed and returns the current value to be substituted for $placeholder.
This is the first public release.
Text::Placeholder was part of a bigger software project and has recently been separated. However, the style of the code should be good enough for an initial release.
Winfried Trumper <pub+perl(a)wt.tuxomania.net>
Copyright (C) 2011 Winfried Trumper
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Text::Placeholder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Placeholder
CPAN shell
perl -MCPAN -e shell install Text::Placeholder
For more information on module installation, please visit the detailed CPAN module installation guide.