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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
use lib '../files/lib';
I'd use FindBin here. Regarding what all is in __DATA__, you could separate the driver code and turn each set of __DATA__ into a module. And rather than having a __DATA__ section, have an our DATA variable - since you're clearly editing this manually anyway, the work to maintain it will be the same after you convert it. This brings you closer to the suggestion, which I agree with, to separate your code from your data.

For example, becomes:

use strict; use warnings; package site::index; our $DATA = q{Welcome to Lady Aleena's B<collections>, which is lists +of A<novels|href="">, A<books|href="">, A<mus +ic|href="">, A<movies|href="">, A<tie-ins +|href="">, and A<programs|href=""> I am willing +to admit I own or use. The list of movies here is just those movies I + own and should not to be confused with my more general interest in A +<movies|href="../Movies">. Tie-ins are books and music connected to m +ovies or television series. I also share my A<fandom|href="../Fandom" +> elsewhere. Here is a key for the notations after each title with the exception of + programs.}; 1; becomes:
use strict; use warnings; package site::collection::Fiction; our $DATA = q{This is my B<fiction collection> of SPAN<hardcovers|^har +dcovers^>, SPAN<trade paperbacks|^trades^>, and SPAN<mass market pape +rbacks|^massmarkets^>.} 1;

Then you'd register these modules in your main driver, and based on whatever it is that you're dispatching on you could use the appropriate full package name to get the content via $site::index::DATA, $site::collection::Fiction::DATA, etc. I suggest this because it seems you like this style for its maintenance ease, but not for it's Perl sophistication. The solution above keeps the maintenance overhead similar to now, but is more sophisticated Perl by allowing you to eliminate the repeated calling code and implement some dispatching. And you can even keep the same .pl file names and directory structure provided you require them (which you'd have to anyway.

In reply to Re: Collapsing smaller scripts into a larger one, request for comment by perlfan
in thread Collapsing smaller scripts into a larger one, request for comment by Lady_Aleena

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
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (4)
    As of 2021-04-19 22:51 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found