in reply to Re: Inherit XML::DOM::Document?
in thread Inherit XML::DOM::Document?

use XML::DOM; @ISA = qw( XML::DOM::Document );
yields:
Global symbol "@ISA" requires explicit package name at lib/Literally +/Document.pm
and
use XML::DOM::Document; @ISA = qw( XML::DOM::Document );
yields:
Can't locate XML/DOM/Document.pm in @INC
I'd like to do the normal thing for which one uses inheritance: extend existing functionality. The particular problem I'm trying to solve involves creating a DOM tree from scratch; while that's not directly related to my desire to use inheritance, it is another thing that the XML::DOM documentation doesn't make obvious (rather, it focuses on operating on a DOM tree constructed with the parser).

Replies are listed 'Best First'.
Re^3: Inherit XML::DOM::Document?
by herveus (Prior) on Apr 06, 2006 at 11:57 UTC
    Howdy!

    The error message from your first snippet simply means that 'strict vars' is in effect, and you haven't told it that @ISA is ok.

    use vars qw ( @ISA ); use XML::DOM; @ISA = qw(XML::DOM::Document);
    should compile fine. The current package will now be a subclass of XML::DOM::Document. Whether that acutally does what you want is a separate problem.

    yours,
    Michael
      Ah, thanks. Presumably that would get me as far as the other problem: that I simply cannot inherit XML::DOM::Document.
Re^3: Inherit XML::DOM::Document?
by Anonymous Monk on Apr 06, 2006 at 10:33 UTC
    Looking at XML-DOM, XML::DOM::Document is a documentation module, consisting of POD only. You cannot inherit anything from in. Try XML::DOM as base class instead.

      Aha. I suspected something along those lines.

      I don't think inheriting from XML::DOM is what I want; the package I'm writing has the semantics of being a document. I probably don't want to use inheritance at all; and instead just contain a XML::DOM::Document.

      Thanks.