* Andrew Ford <A.Ford at ford-mason.co.uk> [2006/04/28 14:25]:
> I have created two trivial plugin modules to wrap Digest::MD5 and 
> Digest::SHA1 respectively.  

The attached (untested) patches add vmethod support:

    [% stuff.md5_hex %]

Comments?

(darren)

-- 
Behold UNIVERSAL::AUTOLOAD and despair.
    -- Chip Salzenberg
diff -u Template-Plugin-Digest-MD5-0.01.orig/MD5.pm 
Template-Plugin-Digest-MD5-0.01/MD5.pm
--- Template-Plugin-Digest-MD5-0.01.orig/MD5.pm 2006-04-28 08:27:07.000000000 
-0400
+++ Template-Plugin-Digest-MD5-0.01/MD5.pm      2006-04-28 10:10:23.000000000 
-0400
@@ -7,0 +7,0 @@

 use base qw(Template::Plugin);
 use Template::Plugin;
+use Template::Stash;
 use Digest::MD5 qw(md5 md5_hex md5_base64);

+$Template::Stash::SCALAR_OPS->{'md5'} = \&_md5;
+$Template::Stash::SCALAR_OPS->{'md5_hex'} = \&_md5_hex;
+$Template::Stash::SCALAR_OPS->{'md5_base64'} = \&_md5_base64;
+
 sub new {
     my ($class, $context, $options) = @_;

Common subdirectories: Template-Plugin-Digest-MD5-0.01.orig/t and 
Template-Plugin-Digest-MD5-0.01/t
diff -u Template-Plugin-Digest-SHA1-0.01.orig/SHA1.pm 
Template-Plugin-Digest-SHA1-0.01/SHA1.pm
--- Template-Plugin-Digest-SHA1-0.01.orig/SHA1.pm       2006-04-28 
08:50:58.000000000 -0400
+++ Template-Plugin-Digest-SHA1-0.01/SHA1.pm    2006-04-28 10:11:25.000000000 
-0400
@@ -7,0 +7,0 @@

 use base qw(Template::Plugin);
 use Template::Plugin;
+use Template::Stash;
 use Digest::SHA1 qw(sha1 sha1_hex sha1_base64);

+$Template::Stash::SCALAR_OPS->{'sha1'} = \&_sha1;
+$Template::Stash::SCALAR_OPS->{'sha1_hex'} = \&_sha1_hex;
+$Template::Stash::SCALAR_OPS->{'sha1_base64'} = \&_sha1_base64;
+
 sub new {
     my ($class, $context, $options) = @_;

Common subdirectories: Template-Plugin-Digest-SHA1-0.01.orig/t and 
Template-Plugin-Digest-SHA1-0.01/t

Attachment: pgpjBWDxebFZl.pgp
Description: PGP signature

Reply via email to