in reply to ISA with packages ... A barebones minimal example

You appear to be confusing package references with objects. Perl is not solely object-oriented, like Java or other langauages.

The B::method syntax is a package reference. It looks for a method inside package B. Adding a method to @EXPORT allows you to use that method without referencing the package directly.

What you are looking for is object inheritance. Objects don't need to be exported. You reference an object inside package B with B->object. If that object is a subroutine, it will be called (with parameters).

That's why everyone is saying "use B->". Your inclusion of A in @ISA causes B to inherit A's objects, but not package references. Do you understand?

radiantmatrix
require General::Disclaimer;
  • Comment on Re: ISA with packages ... A barebones minimal example

Replies are listed 'Best First'.
Re^2: ISA with packages ... A barebones minimal example
by Anonymous Monk on Oct 08, 2004 at 23:08 UTC
    The B::method syntax is a package reference. It looks for a method inside package B.

    No, it looks for a subroutine inside package B. A subroutine is not a method unless it is called with the pointy arrow syntax. This may be slightly confusing, but it's important to pay attention to the difference, because methods and normal subroutine calls receive different arguments.

    B::foo; # subroutine call B->foo; # method call

      Sorry, I forgot that OO-language CS types use "method" to mean exclusively object methods. I generally use the term as a generic way of saying "subroutine, function, procedure, accessor, etc.". So, using my nomenclature:

      B::bar; #package method (subroutine, in this case) B->bar; #object method (subroutine, in this case)
      Hope that clears up any vaguities in my earlier post.

      radiantmatrix
      require General::Disclaimer;
Re^2: ISA with packages ... A barebones minimal example
by tilly (Archbishop) on Oct 10, 2004 at 07:09 UTC
    A technical note. Java is not solely object-oriented either. As any Smalltalk fan will be glad to ask, what methods does 1 support?

    Java is far more OO than Perl. But is less than Smalltalk or Ruby.