[Templates] A question (again) and a possible bugreport

[prev] [thread] [next] [Date index for 2004/05/10]

From: HdV
Subject: [Templates] A question (again) and a possible bugreport
Date: 09:59 on 10 May 2004
Hi,

After two weeks absence from TT2 I wrote my first plugin yesterday. I
have to admit it was easier than I had anticipated (or dreaded `;-). It
is just a simple thing that converts ISO8601 strings to something that
can be fed to strftime. While writing it I noticed two things.

The first is a possible bug/inconsistency I thought I should report.

The version of strftime on my system (Debian GNU/Linux "sarge") allows
for the use of the %z format specifier, but the Date plugin doesn't seem
to recognize it and returns it just as the plain string '%z'.

A simple commandline test confirms that perl itself isn't the cause:

$ perl -MPOSIX=strftime -e 'print strftime("%F %T %z", localtime),
"\n";'
2004-05-09 15:38:07 +0200

My TT2 version is:

$ apt-cache show libtemplate-perl | grep '^Version'
Version: 2.10-1

The second question is about accessing template variables. I tried to
find something in the docs, but found nothing appropriate so I'd like to
pester you with it.

Is there a method by which I can read the META variables set in the
calling template from the plugin without having to explicitly pass them
as parameters? I'd like to modify the behaviour of the plugin if a
certain variable is set. Right now I have an optional named variable
that can be given to the plugin constructor, but it would be more
convenient to the users if the plugin would somehow be able to figure
out for itself if this variable is set or not. (I am talking about
document dependend locales in this case.)

Grx HdV

P.S. Randal I finally read your "meta sitemap extractor" solution. It
certainly was enlightening to read for this newbie. As soon as I have
finished this plugin business I am going to try to adapt that concept to
something I can use for my project.



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

[Templates] A question (again) and a possible bugreport
HdV 09:59 on 10 May 2004

Re: [Templates] A question (again) and a possible bugreport
merlyn (Randal L. Schwartz) 14:45 on 10 May 2004

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