http://qs321.pair.com?node_id=553104


in reply to Re^2: Howto set path for local package in a Perl code
in thread Howto set path for local package in a Perl code

neversaint, try this code.
This is for you script file 'mycode.plx'
# In script file named: mycode.plx use strict; use warnings; use diagnostics; # This just gives you more info. use lib '/home/neversaint/MyPerl/src'; use MyPackage; # Now the rest of your code.
This is for your package file 'MyPackage.pm'
# In MyPackage.pm package MyPackage; use strict; use warnings; use diagnostics; sub some_function { print("My some function"); }
Now here is the important part. The use statement, the file name, and the package declaration MUST all be in the same case.
  • Use statement: use MyPackage;
  • File Name: MyPackage.pm
  • Package statement: package MyPackage;
Kristofer Hoch