[LA.pm] What to call a small module

Mike MacKenzie mackenziemikebus at yahoo.com
Mon Apr 30 23:10:59 PDT 2012


Here's my suggestions:

Hash::TemplateValues  # boring, but explanatory

Hash::Popcorn   #  more fun...

Hash::Splash    #  ... but less explanatory
Hash::Weavalues #



________________________________
 From: Tony <tony at metracom.com>
To: losangeles-pm at pm.org 
Sent: Monday, April 30, 2012 9:01 PM
Subject: Re: [LA.pm] What to call a small module
 

My 2 cents.


Template::HashExpand


On Monday 30 April 2012 20:54:06 Uri Guttman wrote:
> On 04/30/2012 09:47 PM, Ben Tilly wrote:
> > I have a small module, I just don't know what to call it.  Does anyone
> > have any suggestions?
> > 
> > It just takes a hash, and expands it as a template, with the variables
> > referring to other keys.  It can even handle nested hashes.  So you
> > 
> > might pass it something like this:
> >    {
> >    
> >      user =>  'btilly',
> >      project_root =>  '/home/[% user %]/foo',
> >      template_root =>  '[% project_root %]/app/view',
> >      escaped =>  '\[% watch_this %]',
> >    
> >    }
> > 
> > and then get back:
> >    {
> >    
> >      user =>  'btilly',
> >      project_root =>  '/home/btilly/foo',
> >      template_root =>  '/home/btilly/foo//app/view',
> >      escaped =>  '[% watch_this %]',
> >    
> >    }
> > 
> > The use case is mostly for configuration files, where you'd have a
> > hash describing a basic sandbox template, override the values you need
> > to, and then get the configuration for a developer.  With this sort of
> > templating, the amount that you need to override goes way down.
> 
> couple of ideas:
> 
> Template::HashValues
> Template::Config
> 
> but why another template module? template::simple can do that with a
> simple values loop (untested):
> 
>     # add template paths or files here
>     my $tmpl = Template::Simple->new() ;
>     # $conf has the replacement values as a hash ref
>     $_ = ${$tmpl->render( $_, $conf )} for values %config_hash ;
> 
> uri
> _______________________________________________
> Losangeles-pm mailing list
> Losangeles-pm at pm.org
> http://mail.pm.org/mailman/listinfo/losangeles-pm
_______________________________________________
Losangeles-pm mailing list
Losangeles-pm at pm.org
http://mail.pm.org/mailman/listinfo/losangeles-pm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/losangeles-pm/attachments/20120430/fc7a7c17/attachment.html>


More information about the Losangeles-pm mailing list