jptxs has asked for the wisdom of the Perl Monks concerning the following question:
so i'm trying to pump a bit of laziness into my code by learning how to make modules. my first attempt is failing miserably - and it's mostly copied right out of Camel(3ed)...
which is called with:package myMod; use strict; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(tryIt); sub tryIt { print "We did it!!\n\n"; } 1;
when i leave strict out of the module, we're cool. When i put it in we get:use myMod; BEGIN { push @ISA, "/home/jptxs"; } tryIt();
if i take out the our's but leave in the strict:/home/jptxs > perl -w getMyMod Use of reserved word "our" is deprecated at myMod.pm line 5. Bareword "our" not allowed while "strict subs" in use at myMod.pm line + 5. Unquoted string "our" may clash with future reserved word at myMod.pm +line 5. Array found where operator expected at myMod.pm line 5, at end of line (Do you need to predeclare our?) Global symbol "@ISA" requires explicit package name at myMod.pm line 5 +. Use of reserved word "our" is deprecated at myMod.pm line 6. Bareword "our" not allowed while "strict subs" in use at myMod.pm line + 6. Unquoted string "our" may clash with future reserved word at myMod.pm +line 6. Array found where operator expected at myMod.pm line 6, at end of line (Do you need to predeclare our?) Global symbol "@EXPORT" requires explicit package name at myMod.pm lin +e 6. syntax error at myMod.pm line 5, near "our @ISA " BEGIN failed--compilation aborted at getMyMod line 1.
I'm very confused...and after feeling so perl-elated reading the camel.../home/jptxs > perl -w getMyMod Global symbol "@ISA" requires explicit package name at myMod.pm line 5 +. Global symbol "@EXPORT" requires explicit package name at myMod.pm lin +e 6. Compilation failed in require at getMyMod line 1. BEGIN failed--compilation aborted at getMyMod line 1.
-- I'm a solipsist, and so is everyone else. (think about it)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 1: my first module
by tilly (Archbishop) on Oct 07, 2000 at 00:02 UTC | |
|
Re: my first module
by KM (Priest) on Oct 07, 2000 at 00:05 UTC | |
by merlyn (Sage) on Oct 07, 2000 at 00:14 UTC | |
by KM (Priest) on Oct 07, 2000 at 00:31 UTC | |
by merlyn (Sage) on Oct 07, 2000 at 00:34 UTC | |
by KM (Priest) on Oct 07, 2000 at 00:38 UTC | |
by tilly (Archbishop) on Oct 07, 2000 at 00:11 UTC | |
by arturo (Vicar) on Oct 07, 2000 at 02:40 UTC | |
by tilly (Archbishop) on Oct 07, 2000 at 03:08 UTC | |
by jptxs (Curate) on Oct 07, 2000 at 00:12 UTC | |
by KM (Priest) on Oct 07, 2000 at 00:30 UTC | |
by jptxs (Curate) on Oct 07, 2000 at 00:53 UTC | |
|
Re: my first module
by lhoward (Vicar) on Oct 07, 2000 at 01:07 UTC | |
|
Re: my first module
by jptxs (Curate) on Oct 07, 2000 at 00:18 UTC |