logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Re: H::T future: msg#00053

lang.perl.modules.html-template

Subject: Re: Re: H::T future

On Wed, Dec 10, 2003 at 12:18:52PM +1100, Mathew Robertson wrote:

>Is this implemented as a filter? In any case, I would be interested in having
>a look at how you did this.

Very much like the param version just posted here. Insert tags of the
form:

<tmpl_set name=x value=y>

with _no_ quoting around the x and y (this is a quick-and-dirty hack);
each one will provide a value for a top-level parameter. You can't do
anything about values within loops with this.


package HTML::Template::Set;

use HTML::Template;

use base qw(HTML::Template);

sub new {

my %set_params;

my $set_filter = sub {
my $text_ref=shift;
my $match='<(?:\!--\s*)?tmpl_set\s*name=(.*?)\s*value=(.*?)\s*(?:--)?>';
my @taglist=$$text_ref =~ m/$match/gi;
while (@taglist) {
my ($t,$v)=(shift @taglist,shift @taglist);
$set_params{$t}=$v;
}
$$text_ref =~ s/$match/<tmpl_if name=never><tmpl_var name=$1><\/tmpl_if>/gi;
};

my $proto = shift;
my $class = ref($proto) || $proto;
my $self=HTML::Template->new(filter => $set_filter,
@_);
bless ($self, $class);
$self->param(%set_params);
return $self;
}

1;


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
krysalis.sandbo...    web.zope.zwiki/...    gnome.apps.gnum...    xfree86.newbie/...    editors.vim/200...    mozilla.enigmai...    boot-loaders.gr...    network.vnc.ult...    redhat.release....    java.geronimo.u...    os.netbsd.devel...    horde.wicked/20...    linux.lsb.discu...    ietf.ips/2005-0...    alsa.devel/2002...    user-groups.lin...    package-managem...    debian.devel.da...    security.cyrus....    video.gstreamer...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation