Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
If you really think you "need to insert another subroutine into the data", then you should think seriously about refactoring your app to use a real templating system. I've used Template::Toolkit to good effect (despite a daunting array of documentation), though maybe you'd prefer something simpler like HTML::Template.

I'm pretty sure there are other template systems as well. The whole point is that they support the idea of allowing "text data" (the template) to function as code when you want it to.

If I understand your description, you'd like to have a "definition list" stored in one file, and then have one line in the data for a given page that will simply incorporate the def.list at a chosen point. That's one of the nice things that a template system will do very easily. (Other things you might like include loops and conditionals, all tied up in a format that still ends up looking a lot like the actual document structure that defines your page layout.)

Maybe the amount of refactoring you'd have to do to switch whole-hog to a template system is more work that you want to do, which would be a shame, because it's not clear that carrying on in your current direction, without a template system, will be any less arduous.

I actually think there's a good chance that you can try a simpler template system just for this one (class of) page layout(s) that you're struggling with, and not break the rest of your app. Then you can gradually expand your use of templates as you continue to grow and update the app.


In reply to Re: Evaluating subroutines from within data by graff
in thread Evaluating subroutines from within data by Lady_Aleena

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (11)
    As of 2014-11-27 11:53 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My preferred Perl binaries come from:














      Results (184 votes), past polls