On Monday, Aug 25, 2003, at 09:30 US/Pacific, Jattie van der Linde wrote:
[..]
How can I call a function from my main script file located
in a seperate file i.e. for instance a reusable piece of code
that will generate the index of my site without having to copy
the code to every singe page that I generate?
[..]

The moment that you say,

        Well I have these functions/methods that I want
                to make common to more than one piece of perl

you want to run down and Pick Up a Copy of

        learning perl Objects, References & Modules:
        <http://www.oreilly.com/catalog/lrnperlorm/>

since you are in need of feeling at home with
how to make a perl module, and how to use them.

{ wiggins has already covered the stock perldoc sequence,
but I want to stress that for 'normal people' from 'mostly
sane backgrounds' it would be best to start with the learning
book, before falling in amongst 'the diseased'.... You were warned. }

My own Personal Ranting on Perl Modules is up at:

<http://www.wetware.com/drieux/CS/lang/Perl/PM/>

So while I am a RELIGIOUS FANATIC about 'h2xs' - as
a way to start a new module cleanly - cf:

<http://www.wetware.com/drieux/CS/Proj/PID/>

as a case study in how to spin up modules. There is
the minor issue with how to 'contain them' in a way
that they are exposed to ONLY your 'cgi code'. The
trick I use is

        use lib "../lib";
        .....
        use MyNameSpace::Stuff;
        ....

this way the cgi code will know to look 'up and over' in
a lib directory to find the 'special stack of stuff'....

HTH.

ciao
drieux

---

The current state of the Documentation about
        The Project From Hell:
<http://www.wetware.com/drieux/CS/Proj/TPFH/gen_doc.html>


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to