Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Howto set path for local package in a Perl code

by krisahoch (Deacon)
on Jun 01, 2006 at 17:56 UTC ( #553104=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2022-05-25 04:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (84 votes). Check out past polls.

    Notices?