Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: How do you organize your Perl applications?

by DapperDan (Pilgrim)
on Apr 05, 2003 at 12:51 UTC ( #248287=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://248287]
[Discipulus]: my ($need,$opta,$optb ) = @_; .. if $opta..
[shmem]: all else leads to trouble, even if the third argument depends on the existence of the second. That may become brittle.
[Discipulus]: but if have case like subname(15,undef,3 ) maybe bettere named parameters
[Lady_Aleena]: I don't want to have to do: alpha_menu($hash, undef, $type);
[Lady_Aleena]: Or what Discipulus said.
[shmem]: Lady_Aleena: geany supports ctags.
[Discipulus]: a good compromise can be my ($need, $opts_ref) = @_ a scalar and an hash reference
[Discipulus]: see you monks!
[Lady_Aleena]: shmem, let me get this sub rewritten, then I will look into how to use ctags in geany. Deal? 8)
[shmem]: Discipulus: yeah, that might eventually prepare the path for OO ;-)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2017-04-27 12:22 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (506 votes). Check out past polls.