NAME
Template::Plugin::POSIX - Plugin to Import POSIX Functions Provided by Perl
SYNOPSIS
[% USE POSIX %]
[% POSIX.log(100) %]
[% POSIX.rand(1) %]
[% POSIX.exp(2) %]
[% POSIX.sprintf("%.0f", 3.5) %]
[% POSIX.pow(2, 3) %]
[% POSIX.ceil(3.8) %]
[% POSIX.floor(3.8) %]
[% POSIX.sin(3.14) %]
[% POSIX.cos(0) %]
DESCRIPTION
As a TT programmer, I found it quite inflexible to use the Template Toolkit's presentation language Language due to the very limited vocabulary. So I wrote this little plugin in order to open a window for the template file to the full richness of most POSIX functions, making the Template language a "programming language" in a much more serious sense.
Arguments of all POSIX.* functions are passed by values, and returned in scalar context, so some functions for list data, like map and grep, make little sense in this context.
Please keep in mind I just used AUTOLOAD, eval, and Data::Dumper to do the magic here.
If you're looking for smart Perl built-in functions, I suggest you take a look at the Template::Plugin::Perl module which exports the excellent POSIX repertoire.
SEE ALSO
AUTHOR
Agent Zhang, <agent2002@126.com>
COPYRIGHT AND LICENSE
Copyright (c) 2005 Agent Zhang.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available.