| 1 |
Template::Timer provides inline timings of the template processing |
| 2 |
througout your code. It's an overridden version of Template::Context |
| 3 |
that wraps the process() and include() methods. |
| 4 |
|
| 5 |
Using Template::Timer is simple. |
| 6 |
|
| 7 |
my %config = ( # Whatever your config is |
| 8 |
INCLUDE_PATH => "/my/template/path", |
| 9 |
COMPILE_EXT => ".ttc", |
| 10 |
COMPILE_DIR => "/tmp/tt", |
| 11 |
); |
| 12 |
|
| 13 |
if ( $development_mode ) { |
| 14 |
$config{ CONTEXT } = Template::Timer->new( %config ); |
| 15 |
} |
| 16 |
|
| 17 |
my $template = Template->new( \%config ); |
| 18 |
|
| 19 |
Now when you process templates, HTML comments will get embedded in your |
| 20 |
output, which you can easily grep for. |
| 21 |
|
| 22 |
<!-- TIMER START: process mainmenu/mainmenu.ttml --> |
| 23 |
<!-- TIMER START: include mainmenu/cssindex.tt --> |
| 24 |
<!-- TIMER START: process mainmenu/cssindex.tt --> |
| 25 |
<!-- TIMER END: process mainmenu/cssindex.tt (0.017279 seconds) --> |
| 26 |
<!-- TIMER END: include mainmenu/cssindex.tt (0.017401 seconds) --> |
| 27 |
|
| 28 |
.... |
| 29 |
|
| 30 |
<!-- TIMER END: process mainmenu/footer.tt (0.003016 seconds) --> |
| 31 |
<!-- TIMER END: include mainmenu/footer.tt (0.003104 seconds) --> |
| 32 |
<!-- TIMER END: process mainmenu/mainmenu.ttml (0.400409 seconds) --> |
| 33 |
|
| 34 |
INSTALLATION |
| 35 |
|
| 36 |
To install this module, run the following commands: |
| 37 |
|
| 38 |
perl Makefile.PL |
| 39 |
make |
| 40 |
make test |
| 41 |
make install |
| 42 |
|
| 43 |
|
| 44 |
COPYRIGHT AND LICENSE |
| 45 |
|
| 46 |
Copyright (C) 2004-2009 Andy Lester |
| 47 |
|
| 48 |
This library is free software; you can redistribute it and/or modify |
| 49 |
it under the terms of either the GNU Public License v3, or the Artistic |
| 50 |
License 2.0. |
| 51 |
|
| 52 |
* http://www.gnu.org/copyleft/gpl.html |
| 53 |
|
| 54 |
* http://www.opensource.org/licenses/artistic-license-2.0.php |