Logicus has asked for the wisdom of the Perl Monks concerning the following question:
Ok, I have a question. Just from intellectual curiosity rather than any actual pressing need for a solution, I am wondering thusly...
Given that the following aXML code fragment:
<given g="somevalue"> <foo> [get_file]foo[/get_file] </foo> <bar> [get_file]bar[/get_file] </bar> <else> [get_file]baz[/get_file] </else> </given>
Is functionally identical to the following Modern::Perl code fragment :
given ("somevalue") { when (/foo/) { return get_file('foo'); } when (/bar/) { return get_file('bar'); } default { return get_file('baz'); } }
What then would be the Perl equivalent of this fragment :
<given g="somevar"> <get_file>cases</get_file> </given>
Where the file "cases" contains the same data as existed inside the given tag of the original fragment, and is dynamically loaded prior to the given tag being processed?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dynamic given statement
by CountZero (Bishop) on Oct 21, 2011 at 20:34 UTC | |
by Logicus (Initiate) on Oct 21, 2011 at 20:52 UTC | |
by mrstlee (Beadle) on Oct 22, 2011 at 15:49 UTC | |
by Logicus (Initiate) on Oct 22, 2011 at 22:33 UTC |