Commit 62443feb authored by gregor herrmann's avatar gregor herrmann

* New upstream release 0.42.

parents 4aa0cda9 8dd14b7c
0.42 2009-11-01
* Added the "strict" attribute to make exceptional situations fatal. (Theory)
* Removed unused "implementor" attribute in Template::Declare::TagSet. (Theory)
0.41 2009-10-29 0.41 2009-10-29
* Documentation tweaks (Theory) * Documentation tweaks (Theory)
......
...@@ -61,6 +61,7 @@ t/self.t ...@@ -61,6 +61,7 @@ t/self.t
t/siblings.t t/siblings.t
t/similar-aliases.t t/similar-aliases.t
t/smart_tag_wrapper.t t/smart_tag_wrapper.t
t/strict.t
t/subclassing.t t/subclassing.t
t/subtemplates.t t/subtemplates.t
t/tag_sub_list.t t/tag_sub_list.t
......
...@@ -14,8 +14,8 @@ not run its Makefile.PL or Build.PL. ...@@ -14,8 +14,8 @@ not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE----- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Hash: SHA1
SHA1 b0a4d3b5bacd1c1ae7022f77379f704c42f04f86 Changes SHA1 7cff9cc5fac2ce5a6a95ef53b1a7eec956e38cef Changes
SHA1 1bab0077b133b2d3cdd4d66ef63dafa3ef4adf67 MANIFEST SHA1 a5d3db06dc839282824ffa638a6cfe2ffdee78a9 MANIFEST
SHA1 6c79a8c5140fc8b0146fbc8f77acc613797eeb6f MANIFEST.SKIP SHA1 6c79a8c5140fc8b0146fbc8f77acc613797eeb6f MANIFEST.SKIP
SHA1 ab968279525d26d23e4bf76e3d15e4951f87996f META.yml SHA1 ab968279525d26d23e4bf76e3d15e4951f87996f META.yml
SHA1 ee899bc436e17646223925d431d3e9727c1254d1 Makefile.PL SHA1 ee899bc436e17646223925d431d3e9727c1254d1 Makefile.PL
...@@ -31,14 +31,14 @@ SHA1 9f6beaa2f4749ceb5dd0c9b0c647d0f3289c7b46 inc/Module/Install/Makefile.pm ...@@ -31,14 +31,14 @@ SHA1 9f6beaa2f4749ceb5dd0c9b0c647d0f3289c7b46 inc/Module/Install/Makefile.pm
SHA1 bd988ba3fb7eee0ad889eadc2f5338a8d98fc2a3 inc/Module/Install/Metadata.pm SHA1 bd988ba3fb7eee0ad889eadc2f5338a8d98fc2a3 inc/Module/Install/Metadata.pm
SHA1 e9aa83f3e8b16ccfce544a90a57b63b70a497759 inc/Module/Install/Win32.pm SHA1 e9aa83f3e8b16ccfce544a90a57b63b70a497759 inc/Module/Install/Win32.pm
SHA1 ade2ac0b0246d4d8e28fa46942e53f6925abda46 inc/Module/Install/WriteAll.pm SHA1 ade2ac0b0246d4d8e28fa46942e53f6925abda46 inc/Module/Install/WriteAll.pm
SHA1 01bc4e1b5e6731544a07ddebbefb995f0c7ace20 lib/Template/Declare.pm SHA1 bd3aacdeeec829929f7f9ab7c669510b6e315266 lib/Template/Declare.pm
SHA1 4202a05659532bea1d800bc7296d9c1312624f9b lib/Template/Declare/Buffer.pm SHA1 4202a05659532bea1d800bc7296d9c1312624f9b lib/Template/Declare/Buffer.pm
SHA1 2794aeecd4d243899d80881376502e5444664e55 lib/Template/Declare/TagSet.pm SHA1 c86b1e4749f76137c854358f496e8a8030d39fe7 lib/Template/Declare/TagSet.pm
SHA1 bd39d582e69e0725124a0ffcee10c5d12a2377b3 lib/Template/Declare/TagSet/HTML.pm SHA1 bd39d582e69e0725124a0ffcee10c5d12a2377b3 lib/Template/Declare/TagSet/HTML.pm
SHA1 c1703c1f999d27878117e0aaf59dcae1d9d98645 lib/Template/Declare/TagSet/RDF.pm SHA1 c1703c1f999d27878117e0aaf59dcae1d9d98645 lib/Template/Declare/TagSet/RDF.pm
SHA1 8ba58a5c640010febb799bb03b7857eda34c86bc lib/Template/Declare/TagSet/RDF/EM.pm SHA1 8ba58a5c640010febb799bb03b7857eda34c86bc lib/Template/Declare/TagSet/RDF/EM.pm
SHA1 2941a453d2627e0c0c02b8f50e7600c648867831 lib/Template/Declare/TagSet/XUL.pm SHA1 2941a453d2627e0c0c02b8f50e7600c648867831 lib/Template/Declare/TagSet/XUL.pm
SHA1 c64560b8308421deffdc124d87d2f27f2c0b35d9 lib/Template/Declare/Tags.pm SHA1 f12037ad41f686043f0bfbb8e7a8ad643424b072 lib/Template/Declare/Tags.pm
SHA1 238e8999db8b1a8221dcac8afbf0c60448670974 t/99-pod-coverage.t SHA1 238e8999db8b1a8221dcac8afbf0c60448670974 t/99-pod-coverage.t
SHA1 bb0da54f2b3f2d7955baa41ee458cb3d1887f475 t/99-pod.t SHA1 bb0da54f2b3f2d7955baa41ee458cb3d1887f475 t/99-pod.t
SHA1 8de6d59c7ed7c771f9cdc5e2dbaef0c31c7ab439 t/MyTagSet.pm SHA1 8de6d59c7ed7c771f9cdc5e2dbaef0c31c7ab439 t/MyTagSet.pm
...@@ -76,6 +76,7 @@ SHA1 dad25f5c714947cf7fb5954fb876b18114c43ed5 t/self.t ...@@ -76,6 +76,7 @@ SHA1 dad25f5c714947cf7fb5954fb876b18114c43ed5 t/self.t
SHA1 771c903ee077531f0829b9d4efda1ca4fbd2fdfd t/siblings.t SHA1 771c903ee077531f0829b9d4efda1ca4fbd2fdfd t/siblings.t
SHA1 31a78875cd464b5b2c21cee53c5498c97c395ebb t/similar-aliases.t SHA1 31a78875cd464b5b2c21cee53c5498c97c395ebb t/similar-aliases.t
SHA1 fe981469874ceb8b32100e82559d5eea14db3259 t/smart_tag_wrapper.t SHA1 fe981469874ceb8b32100e82559d5eea14db3259 t/smart_tag_wrapper.t
SHA1 3827af507d9d6f29c64be94d1444d6c146ece611 t/strict.t
SHA1 5a4d6002efea9daf71d3d291bf2a35751a51cba8 t/subclassing.t SHA1 5a4d6002efea9daf71d3d291bf2a35751a51cba8 t/subclassing.t
SHA1 679b39abb4812ca1c61ad9e9dd3f5aab97f8829c t/subtemplates.t SHA1 679b39abb4812ca1c61ad9e9dd3f5aab97f8829c t/subtemplates.t
SHA1 44f81200ec38ebf8bc9c836e34942f70990e7207 t/tag_sub_list.t SHA1 44f81200ec38ebf8bc9c836e34942f70990e7207 t/tag_sub_list.t
...@@ -92,7 +93,7 @@ SHA1 7bdcccbdd5253f4eae12d3c279183e10577a0184 t/xss.t ...@@ -92,7 +93,7 @@ SHA1 7bdcccbdd5253f4eae12d3c279183e10577a0184 t/xss.t
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin) Version: GnuPG v1.4.7 (Darwin)
iD8DBQFK6eivsxfQtHhyRPoRApQpAJ9ed3HQZaHJpNJqx7Q4FAQfIZQMVACePkQ2 iD8DBQFK7fTjsxfQtHhyRPoRAoS6AJ4tPTryahUgXsB7i655g8PN6YVF3QCeKeVK
yDQgnPWhv7oNpYKl/cMI/M4= 04wL4T14yJ+WzU5iR0ILz+o=
=HEfH =oL96
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----
libtemplate-declare-perl (0.41-1) unstable; urgency=low libtemplate-declare-perl (0.42-1) UNRELEASED; urgency=low
* New upstream release [ Jonathan Yu ]
* New upstream release 0.41
* Added a NEWS file to mention deprecated stuff * Added a NEWS file to mention deprecated stuff
* Rewrote control description * Rewrote control description
* Standards-Version 3.8.3 (drop perl version dep) * Standards-Version 3.8.3 (drop perl version dep)
* Use short debhelper 7 rules format * Use short debhelper 7 rules format
* Update upstream years of copyright per README * Update upstream years of copyright per README
[ gregor herrmann ]
* New upstream release 0.42.
-- Jonathan Yu <jawnsy@cpan.org> Sat, 31 Oct 2009 10:24:12 -0400 -- Jonathan Yu <jawnsy@cpan.org> Sat, 31 Oct 2009 10:24:12 -0400
libtemplate-declare-perl (0.40-1) unstable; urgency=low libtemplate-declare-perl (0.40-1) unstable; urgency=low
......
...@@ -7,11 +7,12 @@ use Template::Declare::Buffer; ...@@ -7,11 +7,12 @@ use Template::Declare::Buffer;
use Class::ISA; use Class::ISA;
use String::BufferStack; use String::BufferStack;
our $VERSION = '0.41'; our $VERSION = '0.42';
use base 'Class::Data::Inheritable'; use base 'Class::Data::Inheritable';
__PACKAGE__->mk_classdata('dispatch_to'); __PACKAGE__->mk_classdata('dispatch_to');
__PACKAGE__->mk_classdata('postprocessor'); __PACKAGE__->mk_classdata('postprocessor');
__PACKAGE__->mk_classdata('strict');
__PACKAGE__->mk_classdata('templates'); __PACKAGE__->mk_classdata('templates');
__PACKAGE__->mk_classdata('private_templates'); __PACKAGE__->mk_classdata('private_templates');
__PACKAGE__->mk_classdata('buffer'); __PACKAGE__->mk_classdata('buffer');
...@@ -473,6 +474,7 @@ Now let's have a look at how we use these templates with a post-processor: ...@@ -473,6 +474,7 @@ Now let's have a look at how we use these templates with a post-processor:
Template::Declare->init( Template::Declare->init(
dispatch_to => ['MyApp::Templates'], dispatch_to => ['MyApp::Templates'],
postprocessor => \&emphasize, postprocessor => \&emphasize,
strict => 1,
); );
print Template::Declare->show( 'before' ); print Template::Declare->show( 'before' );
...@@ -1056,6 +1058,12 @@ of the template itself. You can use this for instrumentation. For example: ...@@ -1056,6 +1058,12 @@ of the template itself. You can use this for instrumentation. For example:
warn "Rendering $path took " . (time - $start) . " seconds."; warn "Rendering $path took " . (time - $start) . " seconds.";
}); });
=item strict
Die in exceptional situations, such as when a template can't be found, rather
than just warn. False by default for backward compatibility. The default may
be changed in the future, so specifying the value explicitly is recommended.
=back =back
=cut =cut
...@@ -1064,20 +1072,15 @@ sub init { ...@@ -1064,20 +1072,15 @@ sub init {
my $class = shift; my $class = shift;
my %args = (@_); my %args = (@_);
if ( $args{'dispatch_to'} ) { if ( $args{dispatch_to} ) {
$class->dispatch_to( $args{'dispatch_to'} ); $class->dispatch_to( $args{dispatch_to} );
} elsif ( $args{'roots'} ) { } elsif ( $args{roots} ) {
$class->roots( $args{'roots'} ); $class->roots( $args{roots} );
}
if ( $args{'postprocessor'} ) {
$class->postprocessor( $args{'postprocessor'} );
}
if ( $args{'around_template'} ) {
$class->around_template( $args{'around_template'} );
} }
$class->strict( $args{strict} ) if exists $args{strict};
$class->postprocessor( $args{postprocessor} ) if $args{postprocessor};
$class->around_template( $args{around_template} ) if $args{around_template};
} }
=head2 show TEMPLATE_NAME =head2 show TEMPLATE_NAME
......
...@@ -5,7 +5,7 @@ use warnings; ...@@ -5,7 +5,7 @@ use warnings;
use base qw(Class::Accessor::Fast); use base qw(Class::Accessor::Fast);
__PACKAGE__->mk_ro_accessors( __PACKAGE__->mk_ro_accessors(
qw{ namespace package implementor } qw{ namespace package }
); );
sub get_alternate_spelling { sub get_alternate_spelling {
......
...@@ -6,7 +6,7 @@ use strict; ...@@ -6,7 +6,7 @@ use strict;
package Template::Declare::Tags; package Template::Declare::Tags;
our $VERSION = '0.41'; our $VERSION = '0.42';
use Template::Declare; use Template::Declare;
use base 'Exporter'; use base 'Exporter';
...@@ -465,8 +465,9 @@ sub with (@) { ...@@ -465,8 +465,9 @@ sub with (@) {
if ( lc($key) eq 'id' ) { if ( lc($key) eq 'id' ) {
if ( $ELEMENT_ID_CACHE{$val}++ ) { if ( $ELEMENT_ID_CACHE{$val}++ ) {
warn my $msg = "HTML appears to contain illegal duplicate element id: $val";
"HTML appears to contain illegal duplicate element id: $val"; die $msg if Template::Declare->strict;
warn $msg;
} }
} }
...@@ -866,6 +867,7 @@ sub _show_template { ...@@ -866,6 +867,7 @@ sub _show_template {
unless ($callable) { unless ($callable) {
my $msg = "The template '$template' could not be found"; my $msg = "The template '$template' could not be found";
$msg .= " (it might be private)" if !$inside_template; $msg .= " (it might be private)" if !$inside_template;
croak $msg if Template::Declare->strict;
carp $msg; carp $msg;
return ''; return '';
} }
......
use warnings;
use strict;
package Wifty::UI;
use base qw/Template::Declare/;
use Template::Declare::Tags;
template oops => sub {
with( id => 'foo', id => 'foo' ), html {
};
};
package main;
use Test::More tests => 11;
use Test::Warn;
##############################################################################
Template::Declare->init(dispatch_to => ['Wifty::UI']);
pass 'Init with no strict setting';
warning_like { Template::Declare->show('nonesuch' ) }
qr/The template 'nonesuch' could not be found [(]it might be private[)]/,
'Should get warning for nonexistent template';
warning_like { Template::Declare->show('oops' ) }
qr/HTML appears to contain illegal duplicate element id: foo/,
'Should get warning for duplicate "id" attribute';
##############################################################################
Template::Declare->init(dispatch_to => ['Wifty::UI'], strict => 0);
pass 'Init with strict off';
warning_like { Template::Declare->show('nonesuch' ) }
qr/The template 'nonesuch' could not be found [(]it might be private[)]/,
'Should still get warning for nonexistent template';
warning_like { Template::Declare->show('oops' ) }
qr/HTML appears to contain illegal duplicate element id: foo/,
'Should still get warning for duplicate "id" attribute';
##############################################################################
Template::Declare->init(dispatch_to => ['Wifty::UI'], strict => 1);
pass 'Init with strict on';
undef $@;
eval { Template::Declare->show('nonesuch' ) };
ok my $err = $@, 'Should get exception for missing template';
like $err,
qr/The template 'nonesuch' could not be found [(]it might be private[)]/,
'... and it should be about nonexistent template';
undef $@;
eval { Template::Declare->show('oops' ) };
ok my $err = $@, 'Should get exception for duplicate "id"';
like $err,
qr/HTML appears to contain illegal duplicate element id: foo/,
'... and it should be about the duplicate "id" attribute';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment