What is the preferred way to write a program (cgi,console - doesn't really matter) and group related functionality into separate files? I have searched PM, and Google; read Learning Perl and Programming Perl and have not yet found an answer. If it is obvious and I have missed it, please forgive me. Let's assume the following:
- I do not care if I do or do not pollute my namespace.
- I am not currently doing OO, but I will on another project
- I was hoping to avoid having to use a package name qualifier and exporting/importing (obviously this does not apply when I am using OO)
- I want the files to reside in the same directory the main program file resides. Or possibly in a nested directory under that same directory. I cannot install this as a module on the system, I only have limited access to where I can put my files.
I do alot of C# and VB.NET programming, and when I want to include functionality from another file, I simply include the namespace the object resides in. When doing classic ASP, I would simply #include the file containing the functions I want. So what is the preferred method of including functions from other files within the same application?
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.