<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div><span>Here's my suggestions:</span></div><div><br><span></span></div><div><span></span></div><div><span>Hash::TemplateValues # boring, but explanatory<br></span></div><div><span>Hash::Popcorn # more fun...<br></span></div><div><span>Hash::Splash # ... but less explanatory</span></div><div><span>Hash::Weavalues #<br></span></div><div><br></div> <div style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Tony <tony@metracom.com><br> <b><span style="font-weight: bold;">To:</span></b> losangeles-pm@pm.org <br> <b><span
style="font-weight: bold;">Sent:</span></b> Monday, April 30, 2012 9:01 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [LA.pm] What to call a small module<br> </font> </div> <br>
<br>My 2 cents.<br><br><br>Template::HashExpand<br><br><br>On Monday 30 April 2012 20:54:06 Uri Guttman wrote:<br>> On 04/30/2012 09:47 PM, Ben Tilly wrote:<br>> > I have a small module, I just don't know what to call it. Does anyone<br>> > have any suggestions?<br>> > <br>> > It just takes a hash, and expands it as a template, with the variables<br>> > referring to other keys. It can even handle nested hashes. So you<br>> > <br>> > might pass it something like this:<br>> > {<br>> > <br>> > user => 'btilly',<br>> > project_root => '/home/[% user %]/foo',<br>> > template_root => '[% project_root %]/app/view',<br>> > escaped => '\[% watch_this %]',<br>> > <br>> > }<br>> >
<br>> > and then get back:<br>> > {<br>> > <br>> > user => 'btilly',<br>> > project_root => '/home/btilly/foo',<br>> > template_root => '/home/btilly/foo//app/view',<br>> > escaped => '[% watch_this %]',<br>> > <br>> > }<br>> > <br>> > The use case is mostly for configuration files, where you'd have a<br>> > hash describing a basic sandbox template, override the values you need<br>> > to, and then get the configuration for a developer. With this sort of<br>> > templating, the amount that you need to override goes way down.<br>> <br>> couple of ideas:<br>> <br>> Template::HashValues<br>> Template::Config<br>> <br>> but why another template module? template::simple can do that with
a<br>> simple values loop (untested):<br>> <br>> # add template paths or files here<br>> my $tmpl = Template::Simple->new() ;<br>> # $conf has the replacement values as a hash ref<br>> $_ = ${$tmpl->render( $_, $conf )} for values %config_hash ;<br>> <br>> uri<br>> _______________________________________________<br>> Losangeles-pm mailing list<br>> <a ymailto="mailto:Losangeles-pm@pm.org" href="mailto:Losangeles-pm@pm.org">Losangeles-pm@pm.org</a><br>> http://mail.pm.org/mailman/listinfo/losangeles-pm<br>_______________________________________________<br>Losangeles-pm mailing list<br><a ymailto="mailto:Losangeles-pm@pm.org" href="mailto:Losangeles-pm@pm.org">Losangeles-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/losangeles-pm" target="_blank">http://mail.pm.org/mailman/listinfo/losangeles-pm</a><br><br><br> </div>
</div> </div></body></html>