http://www.perlmonks.org?node_id=248287


in reply to How do you organize your Perl applications?

This is partially rehashing some comments already mentioned above, but I want to emphasise them. As always, I welcome comments or suggestions from more experienced Monks if they are inaccurate.

In Apache:

  1. You should NOT have code (scripts or modules) in a DocumentRoot or Alias directory. This is typically done using ScriptHandler with a file extension (e.g. .cgi or .pl). This will lead to your code being echo'd to the browser if the ScriptHandler breaks for whatever reason.
  2. If you are using a cgi-bin directory (and this is to be preferred over using ScriptHandler), do not leave your modules, templates, tests, or other runtime 'assets' in this directory.

    Put them outside your cgi-bin, and (for perl code) use the lib pragma or @INC instead. You can do this easily with SetEnv PERL5LIB directory.

My tree has much in common with others already cited (and is revision controlled using svn 0.20), but the following directories are relevant:

+--htdocs # Use with Apache <tt>Alias</tt> directive. +--cgi-bin # Use with Apache <tt>ScriptAlias</tt> directive. +--lib # Put this in you PERL5LIB environment variable. +--templates +--t