Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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?

Thanks,
disciple

In reply to Confused about splitting program into multiple files. by disciple

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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> <u> <ul>
  • 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 intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2021-10-27 17:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (94 votes). Check out past polls.

    Notices?