Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
Call Perl Scripts from Other Dir in Linux, Path Messed Up
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Bart Lateur, post: 4746403"] That's not your problem. your problem is here: I'm sure you're using relative paths? Then your problem is simply in your current directory when the script is run. You could demand that people chdir to the path containing the files, before calling your script, or you could use the FindBin module to find out where the script itself is. I'll stay a bit sketchy on that approach, because FindBin is somewhat broken, it sometimes refuses to work in mysterious ways. The approach I'm advocating, is to simply figure out the path, either absolute or relative, out of $0, the name for the script, since that is *always* a valid path, at startup. At least, I can't think of any counter-examples. So I guess this should work, at least on Unixy systems: $0 =~ /(.*)\// and chdir $1; Now your script should be able to find the files. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
Call Perl Scripts from Other Dir in Linux, Path Messed Up
Top