Tutorial
Manual
Modules
Library
Tools
FAQ
Release
   
Template Toolkit | Modules | Template::Plugin::Math

Template::Plugin::Math

  Template::Plugin::Iterator
Template::Plugin::Pod  
Plugin interface to mathematical functions

Table of Contents

SYNOPSIS Index  ] [ Modules  ] [ Top  ]

    [% USE Math %]
    [% Math.sqrt(9) %]

DESCRIPTION Index  ] [ Modules  ] [ Top  ]

The Math plugin provides numerous mathematical functions for use within templates.

METHODS Index  ] [ Modules  ] [ Top  ]

Template::Plugin::Math makes available the following functions from the Perl core:

  • abs
  • atan2
  • cos
  • exp
  • hex
  • int
  • log
  • oct
  • rand
  • sin
  • sqrt
  • srand

In addition, if the Math::Trig module can be loaded, the following functions are also available:

  • pi
  • tan
  • csc
  • cosec
  • sec
  • cot
  • cotan
  • asin
  • acos
  • atan
  • acsc
  • acosec
  • asec
  • acot
  • acotan
  • sinh
  • cosh
  • tanh
  • csch
  • cosech
  • sech
  • coth
  • cotanh
  • asinh
  • acosh
  • atanh
  • acsch
  • acosech
  • asech
  • acoth
  • acotanh
  • rad2deg
  • rad2grad
  • deg2rad
  • deg2grad
  • grad2rad
  • grad2deg

If the Math::TrulyRandom module is available, and you've got the time to wait, the 'truly_random_number' method is available:

    [% Math.truly_random_number %]

AUTHOR Index  ] [ Modules  ] [ Top  ]

Andy Wardley <[email protected]>

http://www.andywardley.com/

VERSION Index  ] [ Modules  ] [ Top  ]

1.11, distributed as part of the Template Toolkit version 2.14, released on 04 October 2004.

COPYRIGHT Index  ] [ Modules  ] [ Top  ]

  Copyright (C) 1996-2004 Andy Wardley.  All Rights Reserved.
  Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO Index  ] [ Modules  ] [ Top  ]

Template::Plugin


  Template::Plugin::Iterator
Template::Plugin::Pod  
Tutorial
Manual
Modules
Library
Tools
FAQ
Release
http://www.template-toolkit.org/