I have set a way to do this kind of thing
I use this shell command My pl files and pm files are in "p2" directory
However, it gives me an error:
Perl script can not be opened "maxconnect4.pl": Any such file or directory
< P> Do you have any problems?
You have two problems:
-
-i
does not apply to specified files on the command line, only for the module loaded with therequirement
orusage
. -
You should not use the related code with
-i
if your script does achdir
The directory is now relative to the current new current directory, not the current script when it was started. (In many cases, you can participate with breaking this rule, because most of the time, the dialog loads when the module is listed before loading.)And you actually have a relative directory Also, because you have said
-i / p2
, which meansp2
Try:
perl-I $ PWD / p2 p2 / maxconnect4.pl arg1 arg2 arg3 arg4
(assuming you're using a Unix-type shell).
In many cases, set up a better solution script automatically @INC
p2 / maxconnect4.pl
( p2
before loading any module):
Use FindBin; Use Lib FindBin :: Bin; The programmatic version of
-i
switch, and tells your script the pathname of the directory in which it is located. Then you can just say:
perl p2 / maxconnect4.pl arg1 arg2 arg3 arg4
and -i
at all .
Comments
Post a Comment