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

Re: Re: Help: Constructors and all things OO.

by IOrdy (Friar)
on Aug 28, 2001 at 17:49 UTC ( [id://108439]=note: print w/replies, xml ) Need Help??


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

Thats ++great tachyon... thanks heaps, I had read about the sort in another node on perlmonks but all the examples where using spaceships :) but hadn't tried to use anything I read yet (though I had it all bookmarked) but thanks heaps.

As stated in one of my re:'s above, after more testing the problem seems to come when I try and load the module at the same time as Apache::Request; ( not the use itself but when I do "my $r = Apache->request" or "my $r = Apache::Request->new()" )

I was thinking it might have something to do with the "use lib '';" statement. (I will add the site address to @INC another way and see if that makes any difference)
  • Comment on Re: Re: Help: Constructors and all things OO.

Replies are listed 'Best First'.
Re: Re: Re: Help: Constructors and all things OO.
by tachyon (Chancellor) on Aug 28, 2001 at 18:33 UTC

    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

      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://108439]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (None)
    As of 2024-04-25 04:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found