in reply to my first module

Are you using Perl 5.6 or 5.005? Sounds like 5.005, which has no 'our'.. so try making the 'our' to 'my' and see what happens. You should also

use vars qw(@ISA @EXPORT};

I don't understand why you are pushing onto @ISA.. do you mean @INC?

Cheers,
KM

Replies are listed 'Best First'.
RE: Re: my first module
by merlyn (Sage) on Oct 07, 2000 at 00:14 UTC
    You can't change our to my for things like @ISA or @EXPORT. They have to be package variables. The closest older thing for our is use vars, as others have pointed out.

    -- Randal L. Schwartz, Perl hacker

      I did point that out. I had meant 'in general' to change 'our' to 'my' if he isn't in 5.6.. bad wording left room for interpretation. But, I am wrong (this Florida sun is scrambling my brain), you would want use vars.

      Cheers,
      KM

        No, in general, you cannot change our to my, because that changes a package variable into a lexical variable, really hosing things up.

        "In General", you'll be wanting to change our to use vars, the closest analog between 5.1 and 5.5.3 for the new-in-5.6 our construct.

        -- Randal L. Schwartz, Perl hacker

RE (tilly) 2: my first module
by tilly (Archbishop) on Oct 07, 2000 at 00:11 UTC
    I think he really meant @ISA.

    The purpose is to inherit import from Exporter, so that when someone use's your module they get stuff imported correctly from your namespace.

    For modules with procedural stuff, that is usually the right way to do things.

    UPDATE
    Oops, I just saw the "push" line. You are right, that doesn't make sense to me either. blush

      Can anybody think of advantages to the "push @INC" move here and the more familiar
      use lib 'foo/bar/bletch';

      ?

      Philosophy can be made out of anything -- or less

        Well with lib you are saying that directory is the *first* place to look for modules, with push you are saying it is the last. Sometimes you might want that control.

        I once had to deal with a Perl system that didn't know where its libraries were, manipulating @INC in a BEGIN block was what got me out of that. OTOH if you know about PERL5LIB (which I do now and didn't then) then that is easy enough to fix.

        So yes, I can think of uses. But none that I would cause me to recommend manipulating @INC rather than using lib.

RE: Re: my first module
by jptxs (Curate) on Oct 07, 2000 at 00:12 UTC

    I did mean @INC and I since found I don't need to do either as it finds modules in the same directory by default...I was hoping that would slide by since I couldn't edit the top node, but why would i think that with all the Monks on the job? :)

    -- I'm a solipsist, and so is everyone else. (think about it)

      @INC will contain . (the cwd), unless you are using -T, in which case it will remove it and you need to put it back in there.

      Cheers,
      KM

        I didn't realize -T would remove . (I'd vote that up if i weren't out of votes), but I guess I thought that it would be insecure to have that be the default and that so did the peeps who did taint checking : )

        -- I'm a solipsist, and so is everyone else. (think about it)