Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I have an application where I am attempting to use a simple mechanism for inclusion (hereinafter 'inheritance' (used in a non-OOP, non technical sense)) of 'text blurbs' based on perl modules. The problem is how to persist the notion of 'inheritance' even after the perl code has been run or 'auto-generated'. The details are as follows. A code sample is below.

How do you obviate the need to reproduce text blurbs in multiple places, when what you *really* want to do is inherit those text blurbs from a single, centralized source.

Naive Inheritance solves Problem1. Simply define a MainModule that serves as a repository for all centralized text blurbs. Then include them from that MainModule whenever and wherever necessary.

Naive Inheritance does not work with this particular application, because sometimes the perl source is 'auto-generated' and 'auto-republished'. This means that, from time to time, an identity transformation is applied to (for example), and the entire module code is 'refreshed' via automated process. This 'refresh' operation causes the inherited text blurbs to be 'flattened' into their plain text equivalents. This breaks the intended benefits of using inheritance.

What is a solution to fix Problem2 (the problem of Naive Inheritance) in which the variable values are replaced with their plain-text equivalent?
In order to illustrate the question, a simple example follows (portions omitted for space):

### begin: package CustomerModule ### ... ### ... ### begin node: ccPastDue30 %hDataRec = ( caption => 'Past Due 30 Days', domain => 'customer_corresp', codename => 'ccPastDue30', desc => 'for accounts that are 30 days late', keywords => 'customer warning deadbeat', ### ----------------------------------------------- body => q^ ^.MainModule::StandardHeader().q^ Dear __fname__ __lname__, It has come to our attention that your account is 30 days past due. Please address this oversight as soon as possible to avoid late fees and additional charges. Thank you. ^.MainModule::StandardFooter().q^ ^, ### ----------------------------------------------- ); do{my %hTemp = %hDataRec; $root->{$hTemp{mnemonic}} = \%hTemp; };### end_node ### begin node: ccPastDue60 ### ... ### ... };### end_node ### begin node: ccPastDue90 ### ... ### ... };### end_node
When the above code is run in 'output' context, we obviously want the 'StandardHeader' and 'StandardFooter' portions replaced with their plain-text equivalent. However, when the code is run in 'republish' or 'auto-generate perl' contexts, we do not want the StandardHeader or StandardFooter portions to be interpolated at all.

In reply to modules, auto generated code and content management by dimar

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    erix wonders... how is the neurocent doing these days?
    [marto]: Invest in my crypto currency, derpcoin
    [erix]: ( and only a single italian in the Giro top 10 -- surely you guys are not trying hard enough! )

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (7)
    As of 2018-05-25 15:48 GMT
    Find Nodes?
      Voting Booth?