Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

use class path

by josera (Beadle)
on May 26, 2010 at 20:24 UTC ( [id://841807]=perlquestion: print w/replies, xml ) Need Help??

josera has asked for the wisdom of the Perl Monks concerning the following question:

Hi, After 5 years, I have to make someting in Perl again. Now, I'm using Strawberry Perl under Windows. I think my problem is a basic one, but I can't find in Internet any solution: I try to run a simple program with this sentence: use Algorithm::Evolutionary with it's in the directory ../lib/Algorithm/Evolutionary.pm Do you know if I have to add something to the path or use an absolute path to the file where the definition is? Thanks,

Replies are listed 'Best First'.
Re: use class path
by almut (Canon) on May 26, 2010 at 20:30 UTC

    Try

    use lib "../lib"; use Algorithm::Evolutionary;
      No, I get the same mistake: Can't locate Alogirthm/Evolutionary in @INC (@INC contans ../lib lib c:/strawberry/perl/site/lib c:/strawberry/perl/vendor/lib c:/strawberry/perl/lib .) at simulated-annealing.pl line 24

        Are you sure the relative path ../lib is correct (maybe you meant ./lib)?  From which directory are you running the script?  In case of doubt, simply specify the absolute path.

        Can't locate Alogirthm/Evolutionary
        It looks like you misspelled "Algorithm".
        You're sure it's spelled right? (It's not in the reply you posted above.)
Re: use class path
by pajout (Curate) on May 27, 2010 at 08:37 UTC
    I am sorry if I advice something trivial for you...

    If you use relative path, this is relative to your current directory, NOT to directory where your script is. If it is the case, module FindBin can help to obtain $RealBin.

      Hi, thanks for your help. I've checked again, and the path is good written. I wrote it wrong here, at the forum. I'm sorry. I'll check FindBin, although it's the frist time I hear it. I'm sorry I've been out of Perl for 4 years.
      I'm confused. I tried FindBin but it didn't work, so as a temporary solution, I copied the .pm files to my current working directory, but even that has failed. What happen with the INC variable?
      Thanks.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2024-04-16 09:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found