Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Collapsing smaller scripts into a larger one, request for comment (no)

by Anonymous Monk
on May 31, 2020 at 02:53 UTC ( [id://11117519]=note: print w/replies, xml ) Need Help??


in reply to Collapsing smaller scripts into a larger one, request for comment

No.

Keep all your files.

But keep your data and your code separate.

Remove the code from your scripts because it doesn't belong. Remove everything before __DATA__.

Rename your .pl templates to .lat or .dat

Collapse any other page specific code needed into subroutines inside a module.

This is all that should be in your master script

use lib ...; use MyStuff; MyStuff::run_cgi( '/path/to/root/or/config/if/nonstandard' );

Eventually get inspired by https://metacpan.org/release/Template-TT2Site/tt2site and make the dynamically generated static parts of your site truly static

  • Comment on Re: Collapsing smaller scripts into a larger one, request for comment (no)
  • Download Code

Replies are listed 'Best First'.
Re^2: Collapsing smaller scripts into a larger one, request for comment (no)
by Lady_Aleena (Priest) on Jun 03, 2020 at 03:42 UTC

    I intend to keep all the text in the __DATA__ fields, but not in their current directories. I am not sure what the difference is between me leaving the files in place and renaming them or moving the text to a new directory with a similar new filename.

    ./Collections/Fiction.pl # to ./Collections/Fiction.txt # or ./files/text/Collections/Fiction.txt

    Leaving them in place would mean adding another grep to exclude all .txt files in the directories in base_menu along with initial lower case files. I'm having difficulty rewriting base_menu for the new structure I am contemplating.

    I think .dat would expand to "data", so what would .lat expand to be? I am curious.

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.8.8 on web host.

    Version control is a non-issue, I do not use it.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11117519]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-19 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found