in reply to Re^2: use fields, underscores and subclasses
in thread use fields, underscores and subclasses

no he didn't, -> is for REFs, and @ISA/bless is for OO
  • Comment on Re^3: use fields, underscores and subclasses

Replies are listed 'Best First'.
Re^4: use fields, underscores and subclasses
by ikegami (Patriarch) on Nov 23, 2008 at 01:48 UTC

    -> in general is for refs, but ->name is for OOP. It even works on more than refs.

    JavaFan also forgot the universal base class UNIVERSAL and the methods is provides.

      yes, but I wasn't sure if UNIVERSAL may already have a meaning for classical packages, with the methods called with ::

      well I'm too tired to look it up now ... vote me down guys .. good night!

      Cheers Rolf

        It wasn't the universal base class before OOP because there were no classes before OOP.

        As for whether the methods existed before OOP, all but VERSION only make sense in an OOP context.

Re^4: use fields, underscores and subclasses
by LanX (Saint) on Nov 23, 2008 at 01:56 UTC
    nope!

    -> has a special meaning for OOP to call with an included extra parameter ... the packagename or the selfref.

    just try ->name on a unblessed ref ...

    ...and log in again ;)

    perlop

    Otherwise, the right side is a method name or a simple scalar variable containing either the method name or a subroutine reference, and the left side must be either an object (a blessed reference) or a class name (that is, a package name).

    Cheers Rolf