[Templates] Template2/lib/Template/Plugin/File.pm: bug in File.user method

[prev] [thread] [next] [Date index for 2004/07/12]

From: rajo (Lubomir Host)
Subject: [Templates] Template2/lib/Template/Plugin/File.pm: bug in File.user method
Date: 09:59 on 12 Jul 2004
Hi!

Please, try process following template with TT2:

-------------------%<-------------------
[% TRY %]
[% USE File('/etc/passwd', noid = 0) %]
File size: [% File.size %]
Owner: [% File.user OR 'UNDEFINED' %]
Group: [% File.group OR 'UNDEFINED' %]
[% CATCH File %]
File error: [% error.info %]
[% END %]
-------------------%<-------------------


On my Linux box with perl 5.8.3 "File.user" returns undefined value.
"File.group" is OK.  Very simple patch follows (current CVS version):


-----------------------------------%<-----------------------------------
--- Template2/lib/Template/Plugin/File.pm.orig	2004-07-12 11:44:27.000000000 +0200
+++ Template2/lib/Template/Plugin/File.pm	2004-07-12 11:44:35.000000000 +0200
@@ -101,7 +101,7 @@
 	    || return $class->throw("$abs: $!");
 	@$self{ @STAT_KEYS } = @stat;
 	unless ($config->{ noid }) {
-	    $self->{ user  } = eval { &getpwuid( $self->{ uid }) || $self->{ uid } };
+	    $self->{ user  } = eval { getpwuid( $self->{ uid }) || $self->{ uid } };
 	    $self->{ group } = eval { getgrgid( $self->{ gid }) || $self->{ gid } };
 	}
 	$self->{ isdir } = -d $abs;
-----------------------------------%<-----------------------------------

Thanks. Best regards

Lubomir Host

        -- 
        Lubomir Host 'rajo' <rajo AT platon.sk>        ICQ #:  257322664
Platon Software Development Group              http://platon.sk/
http://www.gnu.org/philosophy/no-word-attachments.html

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

(message missing)

[Templates] Template2/lib/Template/Plugin/File.pm: bug in File.user method
rajo (Lubomir Host) 09:59 on 12 Jul 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52