Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How do you organize your Perl applications?

by simon.proctor (Vicar)
on Apr 04, 2003 at 23:37 UTC ( #248217=note: print w/replies, xml ) Need Help??


in reply to How do you organize your Perl applications?

Here's mine:
docroot logs admin templates config logs Readme.txt lib <---- may be called something else see below
It should be fairly explanatory other than the admin programs for any web application go in the admin folder and have a separate (sub)domain/virtual host. Naturally the docroot folder (document root) is for the web application main. The logs folder is both for any debug or normal running logs as well as any logs from the webserver.

If this isn't a web application, then the docroot goes but the admin folder normally remains (it depends). As for the lib folder. This holds any modules that I write that I don't find on CPAN or need to get from CPAN but cannot install and have to do a 'use lib' for.

One thing I always do is add a --help option to any command line scripts . I always forget how to use my own programs!

In the context of your files, ini goes in the config folder, html in the templates folder (or sub folder), module in the lib folder and as this isn't a web app, the perl script goes in the root. As you would expect, tests go into a 't' folder.

The readme is to describe where everything is and what it does. Possibly not Perl style but some of my command line apps get used by people not used to these things but who can follow instructions.

As an aside, when using templates I tend to create template aliases (see below). This allows me to change where files are in one place without hunting through code.
$templates->{'login screen'} = '/www/templates/login/form.phtml';
I also call all my files with the same endings. So config files end in .config, html templates end in .phtml and so on.

HTH

SP

Replies are listed 'Best First'.
Re: Re: How do you organize your Perl applications?
by DapperDan (Pilgrim) on Apr 05, 2003 at 08:37 UTC
    As an aside, when using templates I tend to create template aliases (see below). This allows me to change where files are in one place without hunting through code.

    $templates->{'login screen'} = '/www/templates/login/form.phtml';

    Ahhh! A phrasebook for templates? That's a great idea.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://248217]
help
Chatterbox?
[ambrus]: You hvae to be careful with the timer, because apparently Prima::Timer insists on being periodic, wheras AnyEvent::Impl:: Whatever::timer should give a one-shot timer watcher
[ambrus]: I think the minimal implementation here is just a timer and io function, plus pushing to the @REGISTRY.
[Corion]: ambrus: Yeah, at least that's what I think I'll start with. A timer and potentially the dummy IO function that never is ready
[ambrus]: That only lets you invoke the main loop from Prima->run;, not from AnyEvent->condvar- >recv; but that shouldn't matter

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2016-12-08 12:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (141 votes). Check out past polls.