The file is located in the same folder as MyService.pl
That's irrelevant. What matters with where the file is located relative to the current directory (assuming you're relying on . in @INC). You can synchronize the two by adding the following at the top of your script.
use File::Basename qw( dirname ); use File::Spec::Functions qw( rel2abs ); BEGIN { chdir(dirname(rel2abs($0))); }
Or like you said, you can tell Perl where to look by adding the following at the top of your script.
use File::Basename qw( dirname ); use File::Spec::Functions qw( rel2abs ); use lib dirname(rel2abs($0));
Note that FindBin does funky stuff, thus its absence from the above snippets.
In reply to Re: Problems with using Modules in script
by ikegami
in thread Problems with using Modules in script
by rishi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |