Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Good package practices

by bmann (Priest)
on Jan 26, 2006 at 22:46 UTC ( #525861=note: print w/ replies, xml ) Need Help??


in reply to Good package practices

There is a problem with the package declaration in the module. The package name should match the path to the module relative to @INC.

In the script, you have:

use lib "../config"; use webData qw(GetLinks);

In webData.pm, you have:

package MyPackages::Config::webData;

See the difference? One has MyPackages::Config, one doesn't. You have two choices here - change the package declaration or change the 'use' statement:

  1. Change the package statement in the pm to "package webData;". Perl will be able to import the funtion.
  2. Move the module to a directory that matches the package statement and
    use MyPackages::Config::webData qw(GetLinks);
    (ie '../config/MyPackages/Config/webData.pm").


Comment on Re: Good package practices
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2015-07-06 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (71 votes), past polls