Well bretheren I'm in a bit of a pickle! I'm writing my first Perl Module and though it is working there is a small but irritating problem! My module called Hoos has several house-keeping related subroutines in it. In an ordinary script I have "use Hoos ;" and a call to one of the subs Hoos::mail_log(params). This works fine but I would prefer to omit the Hoos:: from the call. To this end I've included the following -
use Exporter ;
our @ISA = qw(Exporter)
in the Hoos.pm code. My script now fails as a result of "an undefined routine main::mail_log" being called.
Next I changed the Hoos.pm code to include -
package Hoos ;
our @EXPORT = qw( list of subs mail_log mail end_it etc) ;
use Exporter ;
our @ISA = qw(Exporter);
All of which was lifted from the Perl Objects References & Modules manual. None of this has made a blind bit of a difference, the only way I can call any of the subs in Hoos.pm is to prefix the routine name by Hoos:: - can anyone tell me how to fix this.
Cheers,
Ronnie "Novice" Cruickshank
PS I don't pretend to understand the Exporter/Import business yet so don't presume I know very much!
edit (broquaint): added formatting
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.