Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I don't suppose you Use strict and warnings (in the script and the module)?? I assume that because otherwise you would immediately get a compile time error about the undeclared variable (or is that the error you're talking about??). The subroutine error is a run-time error.

Might need to see more code, it doesn't sound like the function is being exported. Is the function in the @EXPORT or @EXPORT_OK list in the module? Is Exporter used in the module? Do you say 'use Module qw(function);' in the script if its in EXPORT_OK, or just 'use Module;' if its in @EXPORT? Is Exporter in the @ISA list in the module?

Update: The 'undeclared' error I was talking about is about when you said "I tried removing the my $opendir", and you said that you get an error about it being used later...

Anyway, as others have said, did you forget the package declaration in the module ('package NotesOLE;' if that's the name of the module, and the filename is 'NotesOLE.pm')? Is the module 'NotesOLE'? If not, you need to use it in the main script.


In reply to Re: Calling a subroutine located in a module by runrig
in thread Calling a subroutine located in a module by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-24 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found