in reply to reference to a subroutine inside a package

I may be totally off-base here, but this part of your code looked strange, and struck me as possibly being related to your problem -- it just doesn't seem right, in any case:
package test; use gadget; use vars qw($VERSION $CLASS); $CLASS = __PACKAGE__; $VERSION = "0.01"; BEGIN { @test::ISA = qw(gadget); @test::ISA = qw(Exporter); @test::EXPORT = qw(parse_tag); }
First off, why put a BEGIN block inside a package? If you're going to load this as a module via "use test;", then the script that invokes this "use" statement is already handling the package within its own BEGIN block. If you're loading it with "require test;" then I think it's already too late for your package's BEGIN block to be heeded as such.

Second, I would have thought that the assignment to @ISA should go like this:

@ISA = qw/gadget Exporter/;
You're already in "package test" at this point, so having "@test::ISA" seems redundant. But the main point is that in the code you posted, the assignment of "Exporter" to @ISA would appear to replace (obliterate) the preceding assignment of "gadget" to that array.

I actually haven't had much practice with OO inheritance, but just in terms of basic Perl syntax, you may want to take a closer look at these things (and let me know if I'm wrong). Good luck.

Replies are listed 'Best First'.
Re: reference to a subroutine inside a package
by imcsk8 (Pilgrim) on Jun 02, 2004 at 23:55 UTC
    thanks for the advices, i have corrected my code (it looks better now)


    ignorance, the plague is everywhere
    --guttermouth