in reply to Class confusion when testing using ref()

You're blessing a reference to the same hash. The blessing gets attached to the hash, not the reference. Bless the same hash again and you'll replace the previous blessing.


Improve your skills with Modern Perl: the free book.

  • Comment on Re: Class confusion when testing using ref()

Replies are listed 'Best First'.
Re^2: Class confusion when testing using ref()
by tobyink (Canon) on Jan 04, 2014 at 23:57 UTC

    To clarify, our %param above sub new should be my %param inside sub new.

    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name