This looks like something I whipped up a while ago, when I tried to explain to a colleague writing a template why they had to "shift" away the first argument inside their custom perl code...
I trust yours more, though. Sounds like a good addition. -Bryan > -----Original Message----- > From: Mark Fowler [mailto:[EMAIL PROTECTED]] > Sent: Monday, September 02, 2002 2:49 PM > To: [EMAIL PROTECTED] > Subject: [Templates] Template::Plugin::Procedural > > > Another random Idea for the Template Toolkit: > > =head1 NAME > > Template::Plugin::Procedural - Base class for procedural plugins > > =head1 SYNOPSIS > > package Template::Plugin::LWPSimple; > use base qw(Template::Plugin::Procedural); > use LWP::Simple; # exports 'get' > 1; > > [% USE LWPSimple %] > [% LWPSimple.get("http://www.tt2.org/") %] > > =head1 DESCRIPTION > > B<Template::Plugin::Procedural> is a base class for Template Toolkit > plugins that causes defined subprocedures to be called directly > rather than as a method. Essentially this means that subroutines will > not receive the class name or object as its first argument. > > This is most useful when creating plugins for modules that normally > work by exporting subroutines that do not expect such additional > arguments. > > Despite the fact that procedures will not be called in an OO manner, > inheritance still functions as normal. A class that uses > B<Template::Plugin::Procedural> can be subclassed and both > subprocedures > defined in the subclass and subprocedures defined in the original > class will be available to the Template Toolkit and will be called > without the class/object argument. > > > Is all done and has passing tests. Should I go ahead and > commit it in? > > Oh, and if I do, what should I do about Changes? Start a > section for a > new developer release? > > Mark. > > -- > s'' Mark Fowler > London.pm Bath.pm > http://www.twoshortplanks.com/ > [EMAIL PROTECTED] > ';use Term'Cap;$t=Tgetent > Term'Cap{};print$t->Tputs(cl);for$w(split/ +/ > ){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." > $w";select$k,$k,$k,.03}$y+=2} > > > _______________________________________________ > templates mailing list > [EMAIL PROTECTED] > http://www.template-toolkit.org/mailman/listinfo/templates > _______________________________________________ templates mailing list [EMAIL PROTECTED] http://www.template-toolkit.org/mailman/listinfo/templates
