Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Inverting Template::Toolkit

by talexb (Canon)
on Jul 25, 2005 at 20:37 UTC ( #477961=perlquestion: print w/replies, xml ) Need Help??
talexb has asked for the wisdom of the Perl Monks concerning the following question:

I'm in a situation where I'd like to be able to use a Template::Toolkit file (the template, with variables where the data will go) and a populated file and go backwards to get a hash of variables that contain the corresponding values.

That is, if I have a template

directory: [%- foobar -%]
and a config file
directory: /home/alpha/beta
then eventually I'll have
$variables{'foobar'} = '/home/alpha/beta';

Hmmm .. I do have conditionals in my file, so this may be a tough nut to crack .. let me tinker a bit. But if you have ideas, feel free!

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re: Inverting Template::Toolkit
by Corion (Pope) on Jul 25, 2005 at 20:41 UTC

      From the CPAN notes:

        This document describes version 0.39 of Template::Extract, released July 15, 2005.


      That's fresh software. Thanks! I'll try it out.

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Re: Inverting Template::Toolkit
by davorg (Chancellor) on Jul 26, 2005 at 08:06 UTC
      Wow that's impressive. If you'd combine the generate and extract modules, you could get the data from a template-driven site.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://477961]
Approved by ChrisR
[LanX]: unusual that "Pimp my Bride" never made it into TV (?)
LanX sighs ... no idea stupid enough
[choroba]: "Smack My Bitch Up" did, though
[Eily]: that's the internet for you LanX
[Eily]: and I'm pretty sure there's a rule somewhere that states that the stupider the idea, the more likely it is to already have been done

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (14)
As of 2017-03-27 15:18 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.