r21479 - in /branches/upstream/libtemplate-timer-perl: ./ current/ current/Changes current/MANIFEST current/META.yml current/Makefile.PL current/README current/Timer.pm current/t/ current/t/00-load.t current/t/eval.t current/t/pod.t
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Sun Jun 15 15:25:45 UTC 2008
Author: gregoa
Date: Sun Jun 15 15:25:44 2008
New Revision: 21479
URL: http://svn.debian.org/wsvn/?sc=1&rev=21479
Log:
[svn-inject] Installing original source of libtemplate-timer-perl
Added:
branches/upstream/libtemplate-timer-perl/
branches/upstream/libtemplate-timer-perl/current/
branches/upstream/libtemplate-timer-perl/current/Changes
branches/upstream/libtemplate-timer-perl/current/MANIFEST
branches/upstream/libtemplate-timer-perl/current/META.yml
branches/upstream/libtemplate-timer-perl/current/Makefile.PL
branches/upstream/libtemplate-timer-perl/current/README
branches/upstream/libtemplate-timer-perl/current/Timer.pm
branches/upstream/libtemplate-timer-perl/current/t/
branches/upstream/libtemplate-timer-perl/current/t/00-load.t
branches/upstream/libtemplate-timer-perl/current/t/eval.t
branches/upstream/libtemplate-timer-perl/current/t/pod.t
Added: branches/upstream/libtemplate-timer-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libtemplate-timer-perl/current/Changes?rev=21479&op=file
==============================================================================
--- branches/upstream/libtemplate-timer-perl/current/Changes (added)
+++ branches/upstream/libtemplate-timer-perl/current/Changes Sun Jun 15 15:25:44 2008
@@ -1,0 +1,23 @@
+Revision history for Template::Timer
+
+0.04 Sun Oct 16 22:56:51 CDT 2005
+
+ [FIXES]
+ When calling
+
+ [% PROCESS block_1 + block_2 %]
+
+ the block names are passed as an array reference to process().
+ Template::Timer was assuming that any ref() passed was an object
+ and calling ->name on that object. Thanks to Bill Moseley.
+
+
+0.02 Tue Oct 26 11:08:33 CDT 2004
+
+ * First actual working version. Fixed bonheaded typo.
+
+
+0.01 Tue Oct 26 09:58:24 CDT 2004
+
+ * First rudimentary version. Patches and comments welcome.
+
Added: branches/upstream/libtemplate-timer-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libtemplate-timer-perl/current/MANIFEST?rev=21479&op=file
==============================================================================
--- branches/upstream/libtemplate-timer-perl/current/MANIFEST (added)
+++ branches/upstream/libtemplate-timer-perl/current/MANIFEST Sun Jun 15 15:25:44 2008
@@ -1,0 +1,9 @@
+Changes
+MANIFEST
+META.yml # Will be created by "make dist"
+Makefile.PL
+README
+Timer.pm
+t/00-load.t
+t/eval.t
+t/pod.t
Added: branches/upstream/libtemplate-timer-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libtemplate-timer-perl/current/META.yml?rev=21479&op=file
==============================================================================
--- branches/upstream/libtemplate-timer-perl/current/META.yml (added)
+++ branches/upstream/libtemplate-timer-perl/current/META.yml Sun Jun 15 15:25:44 2008
@@ -1,0 +1,13 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Template-Timer
+version: 0.04
+version_from: Timer.pm
+installdirs: site
+requires:
+ Template: 0
+ Test::More: 0
+ Time::HiRes: 0
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30
Added: branches/upstream/libtemplate-timer-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libtemplate-timer-perl/current/Makefile.PL?rev=21479&op=file
==============================================================================
--- branches/upstream/libtemplate-timer-perl/current/Makefile.PL (added)
+++ branches/upstream/libtemplate-timer-perl/current/Makefile.PL Sun Jun 15 15:25:44 2008
@@ -1,0 +1,18 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Template::Timer',
+ AUTHOR => 'Andy Lester <andy at petdance.com>',
+ VERSION_FROM => 'Timer.pm',
+ ABSTRACT_FROM => 'Timer.pm',
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Template' => 0,
+ 'Test::More' => 0,
+ 'Time::HiRes' => 0,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'Template-Timer-*' },
+);
Added: branches/upstream/libtemplate-timer-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libtemplate-timer-perl/current/README?rev=21479&op=file
==============================================================================
--- branches/upstream/libtemplate-timer-perl/current/README (added)
+++ branches/upstream/libtemplate-timer-perl/current/README Sun Jun 15 15:25:44 2008
@@ -1,0 +1,49 @@
+Template::Timer provides inline timings of the template processing
+througout your code. It's an overridden version of Template::Context
+that wraps the process() and include() methods.
+
+Using Template::Timer is simple.
+
+ my %config = ( # Whatever your config is
+ INCLUDE_PATH => "/my/template/path",
+ COMPILE_EXT => ".ttc",
+ COMPILE_DIR => "/tmp/tt",
+ );
+
+ if ( $development_mode ) {
+ $config{ CONTEXT } = Template::Timer->new( %config );
+ }
+
+ my $template = Template->new( \%config );
+
+Now when you process templates, HTML comments will get embedded in your
+output, which you can easily grep for.
+
+ <!-- TIMER START: process mainmenu/mainmenu.ttml -->
+ <!-- TIMER START: include mainmenu/cssindex.tt -->
+ <!-- TIMER START: process mainmenu/cssindex.tt -->
+ <!-- TIMER END: process mainmenu/cssindex.tt (0.017279 seconds) -->
+ <!-- TIMER END: include mainmenu/cssindex.tt (0.017401 seconds) -->
+
+....
+
+ <!-- TIMER END: process mainmenu/footer.tt (0.003016 seconds) -->
+ <!-- TIMER END: include mainmenu/footer.tt (0.003104 seconds) -->
+ <!-- TIMER END: process mainmenu/mainmenu.ttml (0.400409 seconds) -->
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2004 Andy Lester
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
Added: branches/upstream/libtemplate-timer-perl/current/Timer.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtemplate-timer-perl/current/Timer.pm?rev=21479&op=file
==============================================================================
--- branches/upstream/libtemplate-timer-perl/current/Timer.pm (added)
+++ branches/upstream/libtemplate-timer-perl/current/Timer.pm Sun Jun 15 15:25:44 2008
@@ -1,0 +1,108 @@
+package Template::Timer;
+
+use warnings;
+use strict;
+
+=head1 NAME
+
+Template::Timer - Rudimentary profiling for Template Toolkit
+
+=head1 VERSION
+
+Version 0.04
+
+=cut
+
+our $VERSION = '0.04';
+
+=head1 SYNOPSIS
+
+Template::Timer provides inline timings of the template processing
+througout your code. It's an overridden version of L<Template::Context>
+that wraps the C<process()> and C<include()> methods.
+
+Using Template::Timer is simple.
+
+ my %config = ( # Whatever your config is
+ INCLUDE_PATH => "/my/template/path",
+ COMPILE_EXT => ".ttc",
+ COMPILE_DIR => "/tmp/tt",
+ );
+
+ if ( $development_mode ) {
+ $config{ CONTEXT } = Template::Timer->new( %config );
+ }
+
+ my $template = Template->new( \%config );
+
+Now when you process templates, HTML comments will get embedded in your
+output, which you can easily grep for.
+
+ <!-- TIMER START: process mainmenu/mainmenu.ttml -->
+ <!-- TIMER START: include mainmenu/cssindex.tt -->
+ <!-- TIMER START: process mainmenu/cssindex.tt -->
+ <!-- TIMER END: process mainmenu/cssindex.tt (0.017279 seconds) -->
+ <!-- TIMER END: include mainmenu/cssindex.tt (0.017401 seconds) -->
+
+ ....
+
+ <!-- TIMER END: process mainmenu/footer.tt (0.003016 seconds) -->
+ <!-- TIMER END: include mainmenu/footer.tt (0.003104 seconds) -->
+ <!-- TIMER END: process mainmenu/mainmenu.ttml (0.400409 seconds) -->
+
+Note that since INCLUDE is a wrapper around PROCESS, calls to INCLUDEs
+will be doubled up, and slightly longer than the PROCESS call.
+
+=cut
+
+use base qw( Template::Context );
+use Time::HiRes (); # Save as much space as we can
+
+foreach my $sub ( qw( process include ) ) {
+ no strict;
+ my $super = __PACKAGE__->can("SUPER::$sub") or die;
+ *$sub = sub {
+ my $self = shift;
+ my $template = ref $_[0] eq 'ARRAY'
+ ? join( ' + ', @{$_[0]} )
+ : ref $_[0] ? $_[0]->name : $_[0];
+ my $start = [Time::HiRes::gettimeofday];
+ my $data = $super->($self, @_);
+ my $elapsed = Time::HiRes::tv_interval($start);
+ return <<"END"
+<!-- TIMER START: $sub $template -->
+$data
+<!-- TIMER END: $sub $template ($elapsed seconds) -->
+END
+ }; # sub
+} # for
+
+
+=head1 AUTHOR
+
+Andy Lester, C<< <andy at petdance.com> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-template-timer at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org>. I will be notified, and then you'll automatically
+be notified of progress on your bug as I make changes.
+
+=head1 ACKNOWLEDGEMENTS
+
+Thanks to
+Randal Schwartz,
+Bill Moseley,
+and to Gavin Estey for the original code.
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2005 Andy Lester, All Rights Reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+1; # End of Template::Timer
Added: branches/upstream/libtemplate-timer-perl/current/t/00-load.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtemplate-timer-perl/current/t/00-load.t?rev=21479&op=file
==============================================================================
--- branches/upstream/libtemplate-timer-perl/current/t/00-load.t (added)
+++ branches/upstream/libtemplate-timer-perl/current/t/00-load.t Sun Jun 15 15:25:44 2008
@@ -1,0 +1,7 @@
+use Test::More tests => 1;
+
+BEGIN {
+use_ok( 'Template::Timer' );
+}
+
+diag( "Testing Template::Timer $Template::Timer::VERSION" );
Added: branches/upstream/libtemplate-timer-perl/current/t/eval.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtemplate-timer-perl/current/t/eval.t?rev=21479&op=file
==============================================================================
--- branches/upstream/libtemplate-timer-perl/current/t/eval.t (added)
+++ branches/upstream/libtemplate-timer-perl/current/t/eval.t Sun Jun 15 15:25:44 2008
@@ -1,0 +1,27 @@
+#!perl -Tw
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+BEGIN {
+ use_ok( 'Template::Timer' );
+}
+
+my $tt =
+ Template->new( {
+ CONTEXT => Template::Timer->new
+ } );
+
+my $block = "[% thing = 'doohickey' %]";
+
+TODO: { # See RT # 13225
+ local $TODO = "Problem identified but not fixed";
+ my $rc = $tt->process( \*DATA, { block => $block } );
+ ok( $rc, 'eval' );
+}
+
+__DATA__
+[% block | eval %]
+[% thing %]
Added: branches/upstream/libtemplate-timer-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtemplate-timer-perl/current/t/pod.t?rev=21479&op=file
==============================================================================
--- branches/upstream/libtemplate-timer-perl/current/t/pod.t (added)
+++ branches/upstream/libtemplate-timer-perl/current/t/pod.t Sun Jun 15 15:25:44 2008
@@ -1,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
More information about the Pkg-perl-cvs-commits
mailing list