in reply to Two argument bless syntax

I suppose the author of that decided to be a little pedantic about what he defines to be the object named self i.e. The blessed reference as opposed to the anonymous hash or in otherwords, a member of a class as opposed to a plain old data-structure.

You might come across a very simple constructor like the following if all that is needed is to return an instantiated object.
sub new { return bless {}, shift; }
What I don't see is why the author supposes $class might be a reference in ref $class || $class. The first argument to a constructor is usually always a literal string representing the class name and i'm betting that ref $class is redundant there as it evaluates to false.

Replies are listed 'Best First'.
Re^2: Two argument bless syntax
by johngg (Canon) on Nov 22, 2006 at 18:55 UTC
    and i'm betting that ref $class is redundant there as it evaluates to false

    Not necessarily. See davorg's and themage's replies here and here.

    Cheers,

    JohnGG