in reply to Re: Re: Help: Constructors and all things OO.
in thread Help: Constructors and all things OO.

See my Simple Module Tutorial for they whyfors and whatfors of @INC. In a nutshell your module must be in a directory specified in @INC. @INC usually contains these three directories:

C:/Perl/lib 
C:/Perl/site/lib 
.

This is a Windows example, just drop the C: for *nix. Now when you use "MyModule" Perl searches the @INC directories in order for "MyModule.pm". Note that the . dir is the current working directory of the script. There is a difference between module names and package names. If you have the line:

use iXML::TheConstruct

Then Perl will search for a module called "TheConstruct.pm" in a subdir called "iXML" in the @INC dirs. This is your problem. Using the module allows you to use the subs in the module by using the PACKAGE::SUB notation. Your package name could be package WhatsThatGotToDoWithThePriceOfFish;. You would then use iXML::TheConstruct; and instantiate your object via a call $obj = Whatsthatgottodowiththepriceoffish->new

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

  • Comment on Re: Re: Re: Help: Constructors and all things OO.

Replies are listed 'Best First'.
Re: Re: Re: Re: Help: Constructors and all things OO.
by IOrdy (Friar) on Aug 28, 2001 at 18:42 UTC
    Nice try but I read about @INC and have the module in iXML/TheConstruct.pm ("/home/iordy/perl.iordy.net/iXML/TheConstruct.pm")

    I even went to the trouble of using something like:

    use lib "/home/iordy/perl.iordy.net"; in my script that calls iXML/TheConstruct.pm

    interesting: I just found that if I put Apache->request; in a sepereate sub it works. wtf?? It could be painfull but it works.