r60020 - in /branches/upstream/libtext-micromason-perl/current: MANIFEST META.yml MicroMason.pm MicroMason/Docs/Changes.pod MicroMason/Docs/ReadMe.pod MicroMason/Safe.pm samples/uninitialized.msn t/32-safe.t t/33-filters.t t/41-line_numbers.t
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Sat Jul 3 16:22:12 UTC 2010
Author: ansgar-guest
Date: Sat Jul 3 16:21:37 2010
New Revision: 60020
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=60020
Log:
[svn-upgrade] new version libtext-micromason-perl (2.10)
Added:
branches/upstream/libtext-micromason-perl/current/samples/uninitialized.msn
Modified:
branches/upstream/libtext-micromason-perl/current/MANIFEST
branches/upstream/libtext-micromason-perl/current/META.yml
branches/upstream/libtext-micromason-perl/current/MicroMason.pm
branches/upstream/libtext-micromason-perl/current/MicroMason/Docs/Changes.pod
branches/upstream/libtext-micromason-perl/current/MicroMason/Docs/ReadMe.pod
branches/upstream/libtext-micromason-perl/current/MicroMason/Safe.pm
branches/upstream/libtext-micromason-perl/current/t/32-safe.t
branches/upstream/libtext-micromason-perl/current/t/33-filters.t
branches/upstream/libtext-micromason-perl/current/t/41-line_numbers.t
Modified: branches/upstream/libtext-micromason-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-micromason-perl/current/MANIFEST?rev=60020&op=diff
==============================================================================
--- branches/upstream/libtext-micromason-perl/current/MANIFEST (original)
+++ branches/upstream/libtext-micromason-perl/current/MANIFEST Sat Jul 3 16:21:37 2010
@@ -48,6 +48,7 @@
samples/test-recur.msn
samples/test-relative.msn
samples/test.msn
+samples/uninitialized.msn
t/00-startup.t
t/01-syntax.t
t/02-perl.t
Modified: branches/upstream/libtext-micromason-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-micromason-perl/current/META.yml?rev=60020&op=diff
==============================================================================
--- branches/upstream/libtext-micromason-perl/current/META.yml (original)
+++ branches/upstream/libtext-micromason-perl/current/META.yml Sat Jul 3 16:21:37 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Text-MicroMason
-version: 2.09
+version: 2.10
abstract: Simple and Extensible Templating
author:
- Alan Ferrency <ferrency at cpan.org>
Modified: branches/upstream/libtext-micromason-perl/current/MicroMason.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-micromason-perl/current/MicroMason.pm?rev=60020&op=diff
==============================================================================
--- branches/upstream/libtext-micromason-perl/current/MicroMason.pm (original)
+++ branches/upstream/libtext-micromason-perl/current/MicroMason.pm Sat Jul 3 16:21:37 2010
@@ -1,5 +1,5 @@
package Text::MicroMason;
-$VERSION = '2.09';
+$VERSION = '2.10';
# The #line directive requires Perl 5.6 to work correctly the way we use
# it in Base.
Modified: branches/upstream/libtext-micromason-perl/current/MicroMason/Docs/Changes.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-micromason-perl/current/MicroMason/Docs/Changes.pod?rev=60020&op=diff
==============================================================================
--- branches/upstream/libtext-micromason-perl/current/MicroMason/Docs/Changes.pod (original)
+++ branches/upstream/libtext-micromason-perl/current/MicroMason/Docs/Changes.pod Sat Jul 3 16:21:37 2010
@@ -6,6 +6,31 @@
=head1 VERSION 2 HISTORY
=over 4
+
+=head2 Version 2.10
+
+=item 2010-06-29
+
+[rt.cpan.org #57797] Deprecate safe_methods parameter. Unfortunately,
+Safe.pm version 2.27 patches a bug we were inadvertantly taking
+advantage of to implement the safe_methods parameter. Unless we can
+find a working implementation of safe_methods that is smaller than
+"make everything unsafe" then we can't continue to support
+safe_methods.
+
+Using safe_methods now issues a deprecation warning, but it should
+work with older versions of Safe. I'm in no hurry to remove the
+feature, but I don't want anyone to use it who isn't already using it,
+until we know it can be supported in the future.
+
+=item 2010-04-05
+
+"uninitialized" warnings in templates were being taggedgenerated at a
+line number within MicroMason instead of a line number within the
+template itself. Thanks to Mike Kelly for a patch: by concatenating
+an empty string to each TOKEN within the template, the warning's line
+number is shifted to inside the template where the interpolation took
+place.
=head2 Version 2.09
Modified: branches/upstream/libtext-micromason-perl/current/MicroMason/Docs/ReadMe.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-micromason-perl/current/MicroMason/Docs/ReadMe.pod?rev=60020&op=diff
==============================================================================
--- branches/upstream/libtext-micromason-perl/current/MicroMason/Docs/ReadMe.pod (original)
+++ branches/upstream/libtext-micromason-perl/current/MicroMason/Docs/ReadMe.pod Sat Jul 3 16:21:37 2010
@@ -50,7 +50,7 @@
=head1 DISTRIBUTION STATUS
-This is version 2.09 of Text::MicroMason.
+This is version 2.10 of Text::MicroMason.
If you encounter any problems, please inform the current maintainer and
I'll endeavor to patch them promptly.
Modified: branches/upstream/libtext-micromason-perl/current/MicroMason/Safe.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-micromason-perl/current/MicroMason/Safe.pm?rev=60020&op=diff
==============================================================================
--- branches/upstream/libtext-micromason-perl/current/MicroMason/Safe.pm (original)
+++ branches/upstream/libtext-micromason-perl/current/MicroMason/Safe.pm Sat Jul 3 16:21:37 2010
@@ -33,6 +33,12 @@
sub safe_facade {
my $self = shift;
+
+ our @CARP_NOT = qw(Text::MicroMason::Base);
+
+ carp("* WARNING: safe_methods is deprecated; please see the pod")
+ if $self->{safe_methods};
+
Text::MicroMason::Safe::Facade->new(
map {
my $method = $_;
@@ -139,6 +145,31 @@
=item safe_methods
+B<IMPORTANT NOTE:> The C<safe_methods> parameter is deprecated and will
+be removed in future versions of Text::MicroMason (unless a Safe and
+future-proof implementation can be found). If you use this parameter,
+you will receive a warning via carp:
+
+"* WARNING: safe_methods is deprecated; please see the pod"
+
+This parameter works correctly with sufficiently old versions of the
+Safe module (prior to the release of perl 5.12.1), but modern versions
+of Safe make it impossible for a Safe compartment to run any code
+outside the compartment. Even with the object shared within the Safe
+compartment, there is currently no known way to call methods on it
+without defining the whole class within the compartment (which isn't
+safe).
+
+If anyone has an appropriately safe solution that will allow
+C<safe_methods> to work, please submit a patch to the module maintainer.
+Also see t/32-safe.t for tests related to C<safe_methods> that are
+currently being skipped.
+
+The following pod is provided for legacy purposes only. It is
+strongly recommended that you do not use this method. It is no longer
+allowed to call methods from within a "Safe" template, because it
+isn't actually safe.
+
A space-separated string of methods names to be supported by the Safe::Facade.
To control which Mason methods are available within the template, pass a
@@ -150,6 +181,7 @@
method. We'll also load the TemplateDir mixin with strict_root on to prevent
inclusion of templates from outside the current directory.
+ # safe_methods is DEPRECATED, please see above
$mason = Text::MicroMason->new( -Safe, safe_methods => 'execute',
-TemplateDir, strict_root => 1 );
@@ -157,6 +189,7 @@
calls to the filter method; to allow multiple methods, join their names
with spaces:
+ # safe_methods is DEPRECATED, please see above
$mason = Text::MicroMason->new( -Safe, safe_methods => 'execute filter',
-TemplateDir, strict_root => 1,
-Filters );
Added: branches/upstream/libtext-micromason-perl/current/samples/uninitialized.msn
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-micromason-perl/current/samples/uninitialized.msn?rev=60020&op=file
==============================================================================
--- branches/upstream/libtext-micromason-perl/current/samples/uninitialized.msn (added)
+++ branches/upstream/libtext-micromason-perl/current/samples/uninitialized.msn Sat Jul 3 16:21:37 2010
@@ -1,0 +1,11 @@
+% my $x;
+Hello Mr. <% $x %>!
+
+% # another line
+% sub stuff { 1 }
+% do { stuff() };
+
+% my %h;
+Hello, <% $h{not_defined} %>!
+
+And, then end.
Modified: branches/upstream/libtext-micromason-perl/current/t/32-safe.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-micromason-perl/current/t/32-safe.t?rev=60020&op=diff
==============================================================================
--- branches/upstream/libtext-micromason-perl/current/t/32-safe.t (original)
+++ branches/upstream/libtext-micromason-perl/current/t/32-safe.t Sat Jul 3 16:21:37 2010
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 23;
+use Test::More tests => 24;
use_ok 'Text::MicroMason', qw( safe_compile safe_execute try_safe_compile try_safe_execute );
@@ -39,7 +39,10 @@
local $^W; # no warnings uninitialized
my $variable = 'secret';
my $scr_hidden = '<% $variable %>';
- unlike try_safe_execute( $scr_hidden ), qr/secret/;
+
+ my ($output, $err) = try_safe_execute( $scr_hidden );
+ is $output, undef;
+ like $err, qr/requires explicit package name/;
}
{
@@ -83,7 +86,9 @@
like $@, qr/Can't call .*?execute/;
}
+SKIP:
{
+ skip "safe_methods is deprecated because it can't work with modern Safe", 2;
my $m = Text::MicroMason->new( '-Safe', safe_methods => 'execute' );
my $script = qq| <& 'samples/test.msn', %ARGS &> |;
@@ -93,13 +98,14 @@
}
my $safe_dir_mason = Text::MicroMason->class( 'Safe', 'TemplateDir' );
+SKIP:
{
-# my $m = Text::MicroMason->new( '-Safe', safe_methods => 'execute',
-# -TemplateDir, template_root => 'samples', strict_root => 1 );
+ skip "safe_methods is deprecated because it can't work with modern Safe", 2;
+
my $m = Text::MicroMason->new(
- -TemplateDir, template_root => 'samples', strict_root => 1,
- '-Safe', safe_methods => 'execute',
- );
+ -TemplateDir, template_root => 'samples', strict_root => 1,
+ '-Safe', safe_methods => 'execute',
+ );
my $script = qq| <& 'test.msn', %ARGS &> |;
my $output = eval{ $m->execute( text => $script, name => 'Sam', hour => 9)};
@@ -107,9 +113,12 @@
ok !$@, "Execute produced error: $@";
}
+SKIP:
{
- my $m = Text::MicroMason->new( '-Safe', safe_methods => 'execute',
- -TemplateDir, template_root => 'samples', strict_root => 1 );
+ skip "safe_methods is deprecated because it can't work with modern Safe", 2;
+ my $m = Text::MicroMason->new(
+ '-Safe', safe_methods => 'execute',
+ -TemplateDir, template_root => 'samples', strict_root => 1 );
my $script = qq| <& '../MicroMason.pm', %ARGS &> |;
my $output = eval{ $m->execute( text => $script, name => 'Sam', hour => 9)};
Modified: branches/upstream/libtext-micromason-perl/current/t/33-filters.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-micromason-perl/current/t/33-filters.t?rev=60020&op=diff
==============================================================================
--- branches/upstream/libtext-micromason-perl/current/t/33-filters.t (original)
+++ branches/upstream/libtext-micromason-perl/current/t/33-filters.t Sat Jul 3 16:21:37 2010
@@ -48,12 +48,12 @@
skip "URI::Escape is not installed", 8
unless URI::Escape->can('uri_escape');
- my $res_u = 'Hello %3C%27world%27%3E!';
+ my $res_u = 'Hello %3C%3Fworld%3F%3E!';
- is $m->execute(text => qq(Hello <% "<'world'>" |u %>!)), $res_u,
+ is $m->execute(text => qq(Hello <% "<?world?>" |u %>!)), $res_u,
"Execute text with URI::Escape filter";
- ok my $res = eval {$m->execute(text => qq(Hello <% "<'world'>"|u %>!))},
+ ok my $res = eval {$m->execute(text => qq(Hello <% "<?world?>"|u %>!))},
"Execute text with URI::Escape filter and no space";
is $res, $res_u;
@@ -65,18 +65,18 @@
# Test u as a default filter
{
local $m->{default_filters} = 'u';
- my $src_u2 = qq(Hello <% "<'world'>" %>!);
+ my $src_u2 = qq(Hello <% "<?world?>" %>!);
is $m->execute( text => $src_u2), $res_u, "Execute text with URI::Escape default filter";
# Explicitly disable the default filters
- my $src_u3 = qq(Hello <% "<'world'>" | n %>!);
- my $res_u3 = q(Hello <'world'>!);
- is $m->execute( text => $src_u3), "Hello <'world'>!", "Execute text with URI::Escape default turned off";
+ my $src_u3 = qq(Hello <% "<?world?>" | n %>!);
+ my $res_u3 = q(Hello <?world?>!);
+ is $m->execute( text => $src_u3), "Hello <?world?>!", "Execute text with URI::Escape default turned off";
}
# Test stacking and canceling with n
- my $res_hnu = 'Hello %3C%27world%27%3E!';
- my $src_hnu = qq(Hello <% "<'world'>" |hnu %>!);
+ my $res_hnu = 'Hello %3C%3Fworld%3F%3E!';
+ my $src_hnu = qq(Hello <% "<?world?>" |hnu %>!);
is $m->execute( text => $src_hnu), $res_hnu, "Execute text with stacking u filter";
}
Modified: branches/upstream/libtext-micromason-perl/current/t/41-line_numbers.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-micromason-perl/current/t/41-line_numbers.t?rev=60020&op=diff
==============================================================================
--- branches/upstream/libtext-micromason-perl/current/t/41-line_numbers.t (original)
+++ branches/upstream/libtext-micromason-perl/current/t/41-line_numbers.t Sat Jul 3 16:21:37 2010
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 33;
+use Test::More tests => 37;
use_ok 'Text::MicroMason';
@@ -76,3 +76,19 @@
}
######################################################################
+
+SKIP: {
+ skip "Test::Warn is not installed", 4
+ unless eval { require Test::Warn; };
+ use warnings;
+
+ ok my $m = Text::MicroMason->new( -LineNumbers );
+ Test::Warn::warnings_like(sub {
+ ok my $output = eval { $m->execute( file => 'samples/uninitialized.msn' ) };
+ is $@, '';
+ }, [
+ qr/^Use of uninitialized value.*at samples\/uninitialized\.msn line 1/,
+ qr/^Use of uninitialized value.*at samples\/uninitialized\.msn line 8/,
+ ]);
+}
+
More information about the Pkg-perl-cvs-commits
mailing list