r47832 - in /trunk/libtemplate-provider-fromdata-perl: Changes MANIFEST META.yml README debian/changelog lib/Template/Provider/FromDATA.pm t/10-basic.t t/13-cache.t t/14-qualified.t t/15-same_name.t t/lib/My/Other/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Fri Nov 27 03:21:57 UTC 2009
Author: jawnsy-guest
Date: Fri Nov 27 03:21:52 2009
New Revision: 47832
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=47832
Log:
integrate new upstream version
Added:
trunk/libtemplate-provider-fromdata-perl/t/14-qualified.t
- copied unchanged from r47831, branches/upstream/libtemplate-provider-fromdata-perl/current/t/14-qualified.t
trunk/libtemplate-provider-fromdata-perl/t/15-same_name.t
- copied unchanged from r47831, branches/upstream/libtemplate-provider-fromdata-perl/current/t/15-same_name.t
trunk/libtemplate-provider-fromdata-perl/t/lib/My/Other/
- copied from r47831, branches/upstream/libtemplate-provider-fromdata-perl/current/t/lib/My/Other/
Modified:
trunk/libtemplate-provider-fromdata-perl/Changes
trunk/libtemplate-provider-fromdata-perl/MANIFEST
trunk/libtemplate-provider-fromdata-perl/META.yml
trunk/libtemplate-provider-fromdata-perl/README
trunk/libtemplate-provider-fromdata-perl/debian/changelog
trunk/libtemplate-provider-fromdata-perl/lib/Template/Provider/FromDATA.pm
trunk/libtemplate-provider-fromdata-perl/t/10-basic.t
trunk/libtemplate-provider-fromdata-perl/t/13-cache.t
Modified: trunk/libtemplate-provider-fromdata-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-provider-fromdata-perl/Changes?rev=47832&op=diff
==============================================================================
--- trunk/libtemplate-provider-fromdata-perl/Changes (original)
+++ trunk/libtemplate-provider-fromdata-perl/Changes Fri Nov 27 03:21:52 2009
@@ -1,4 +1,9 @@
Revision history for Perl extension Template::Provider::FromDATA
+
+0.10 Tue Nov 24 2009
+ - Added the ability to specify a fully qualified template
+ name (Kevin McGrath)
+ - Fix for mod_perl usage (Kevin McGrath)
0.09 Thu Nov 19 2009
- repackaged with a new version of Module::Install
Modified: trunk/libtemplate-provider-fromdata-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-provider-fromdata-perl/MANIFEST?rev=47832&op=diff
==============================================================================
--- trunk/libtemplate-provider-fromdata-perl/MANIFEST (original)
+++ trunk/libtemplate-provider-fromdata-perl/MANIFEST Fri Nov 27 03:21:52 2009
@@ -17,7 +17,10 @@
t/11-classes.t
t/12-external_classes.t
t/13-cache.t
+t/14-qualified.t
+t/15-same_name.t
t/20-error.t
t/98-pod_coverage.t
t/99-pod.t
+t/lib/My/Other/Templates.pm
t/lib/My/Templates.pm
Modified: trunk/libtemplate-provider-fromdata-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-provider-fromdata-perl/META.yml?rev=47832&op=diff
==============================================================================
--- trunk/libtemplate-provider-fromdata-perl/META.yml (original)
+++ trunk/libtemplate-provider-fromdata-perl/META.yml Fri Nov 27 03:21:52 2009
@@ -25,4 +25,4 @@
resources:
license: http://dev.perl.org/licenses/
repository: http://github.com/bricas/template-provider-fromdata/tree/master
-version: 0.09
+version: 0.10
Modified: trunk/libtemplate-provider-fromdata-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-provider-fromdata-perl/README?rev=47832&op=diff
==============================================================================
--- trunk/libtemplate-provider-fromdata-perl/README (original)
+++ trunk/libtemplate-provider-fromdata-perl/README Fri Nov 27 03:21:52 2009
@@ -16,6 +16,9 @@
LOAD_TEMPLATES => [ $provider ]
} );
+ # Render a template
+ $template->process( 'mytemplate', { bar => 'Bar' } );
+
# ...and now the templates
__DATA__
@@ -32,7 +35,13 @@
CAVEAT
If you have two templates with the same name, this module will not
- understand the difference, it will simply return the first one found.
+ understand the difference, it will simply return the first one found. If
+ you wish, you can specify a fully qualified template name by prefixing
+ the template with the module name (using "-" instead of "::" as a
+ namespace separator), adding a "/" to separate the module name from the
+ template name.
+
+ $template->process( 'My-Templates/mytemplate', { bar => 'Bar' } );
INSTALLATION
perl Makefile.PL
Modified: trunk/libtemplate-provider-fromdata-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-provider-fromdata-perl/debian/changelog?rev=47832&op=diff
==============================================================================
--- trunk/libtemplate-provider-fromdata-perl/debian/changelog (original)
+++ trunk/libtemplate-provider-fromdata-perl/debian/changelog Fri Nov 27 03:21:52 2009
@@ -1,4 +1,4 @@
-libtemplate-provider-fromdata-perl (0.09-1) UNRELEASED; urgency=low
+libtemplate-provider-fromdata-perl (0.10-1) UNRELEASED; urgency=low
IGNORE-VERSION: 0.09-1
@@ -16,7 +16,7 @@
perl (>= 5.6.0-{12,16}) with an unversioned dependency on perl (as
permitted by Debian Policy 3.8.3).
- -- Jonathan Yu <jawnsy at cpan.org> Thu, 19 Nov 2009 15:04:55 -0500
+ -- Jonathan Yu <jawnsy at cpan.org> Thu, 26 Nov 2009 19:04:05 -0500
libtemplate-provider-fromdata-perl (0.08-1) unstable; urgency=low
Modified: trunk/libtemplate-provider-fromdata-perl/lib/Template/Provider/FromDATA.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-provider-fromdata-perl/lib/Template/Provider/FromDATA.pm?rev=47832&op=diff
==============================================================================
--- trunk/libtemplate-provider-fromdata-perl/lib/Template/Provider/FromDATA.pm (original)
+++ trunk/libtemplate-provider-fromdata-perl/lib/Template/Provider/FromDATA.pm Fri Nov 27 03:21:52 2009
@@ -27,6 +27,9 @@
LOAD_TEMPLATES => [ $provider ]
} );
+ # Render a template
+ $template->process( 'mytemplate', { bar => 'Bar' } );
+
# ...and now the templates
__DATA__
@@ -46,7 +49,12 @@
=head1 CAVEAT
If you have two templates with the same name, this module will not understand
-the difference, it will simply return the first one found.
+the difference, it will simply return the first one found. If you wish, you
+can specify a fully qualified template name by prefixing the template with the
+module name (using C<-> instead of C<::> as a namespace separator), adding
+a C</> to separate the module name from the template name.
+
+ $template->process( 'My-Templates/mytemplate', { bar => 'Bar' } );
=head1 INSTALLATION
@@ -59,7 +67,7 @@
__PACKAGE__->mk_accessors( qw( cache classes ) );
-our $VERSION = '0.09';
+our $VERSION = '0.10';
=head1 METHODS
@@ -134,6 +142,14 @@
my $classes = $self->classes;
my( $content, $error );
+ # handle fully qualified names
+ if( $name =~ m{/} ) {
+ my( $class, $template ) = split( m{/}, $name, 2 );
+ $class =~ s{-}{::}g;
+ $classes = [ $class ];
+ $name = $template;
+ }
+
for my $class ( @$classes ) {
$content = $self->get_file( $class, $name );
last if $content;
@@ -165,32 +181,32 @@
my( $self, $class, $template ) = @_;
my $cache = $self->cache;
-
- if( !exists $cache->{ templates }->{ $template } ) {
- unless ( $cache->{ classes }->{ $class } ) {
- local $/;
- no strict 'refs';
- my $fh = \*{"${class}\::DATA"};
- my $filecache = <$fh>;
- $cache->{ classes }->{ $class }++;
-
- my $result;
- my @files = split /^__(.+)__\r?\n/m, $filecache;
- shift @files;
- while (@files) {
- my( $name, $content ) = splice @files, 0, 2;
- $cache->{ templates }->{ $name } = $content;
- $result = $content if $name eq $template;
- }
-
- return $result;
- }
-
- return undef;
- }
- else {
- return $cache->{ templates }->{ $template };
- }
+ my $key = "${class}/${template}";
+
+ if( exists $cache->{ templates }->{ $key } ) {
+ return $cache->{ templates }->{ $key };
+ }
+
+ return undef if $cache->{ classes }->{ $class };
+
+ no strict 'refs';
+ my $fh = \*{"${class}\::DATA"};
+ my $pos = tell( $fh );
+ my $filecache = do { local $/; <$fh>; };
+ seek( $fh, $pos, 0 );
+ $cache->{ classes }->{ $class }++;
+
+ my $result;
+ my @files = split /^__(.+)__\r?\n/m, $filecache;
+ shift @files;
+ while (@files) {
+ my( $name, $content ) = splice @files, 0, 2;
+ my $key = "${class}/${name}";
+ $cache->{ templates }->{ $key } = $content;
+ $result = $content if $name eq $template;
+ }
+
+ return $result;
}
=head1 AUTHOR
Modified: trunk/libtemplate-provider-fromdata-perl/t/10-basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-provider-fromdata-perl/t/10-basic.t?rev=47832&op=diff
==============================================================================
--- trunk/libtemplate-provider-fromdata-perl/t/10-basic.t (original)
+++ trunk/libtemplate-provider-fromdata-perl/t/10-basic.t Fri Nov 27 03:21:52 2009
@@ -5,8 +5,6 @@
use_ok( 'Template' );
use_ok( 'Template::Provider::FromDATA' );
-
-use Template::Constants qw( :debug );
my $provider = Template::Provider::FromDATA->new;
isa_ok( $provider, 'Template::Provider::FromDATA' );
Modified: trunk/libtemplate-provider-fromdata-perl/t/13-cache.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtemplate-provider-fromdata-perl/t/13-cache.t?rev=47832&op=diff
==============================================================================
--- trunk/libtemplate-provider-fromdata-perl/t/13-cache.t (original)
+++ trunk/libtemplate-provider-fromdata-perl/t/13-cache.t Fri Nov 27 03:21:52 2009
@@ -6,14 +6,11 @@
use_ok( 'Template' );
use_ok( 'Template::Provider::FromDATA' );
-use Template::Constants qw( :debug );
-
my $provider = Template::Provider::FromDATA->new;
isa_ok( $provider, 'Template::Provider::FromDATA' );
my $template = Template->new( {
LOAD_TEMPLATES => [ $provider ],
-# DEBUG => DEBUG_ALL
} );
isa_ok( $template, 'Template' );
More information about the Pkg-perl-cvs-commits
mailing list