sub new { my ( $class %args ) = @_; bless {_name=> %args {name}, _alias=> $args {moniker}, _langs=> $args {langauges} } , ref ($class) ¦¦ $class; }
What does the code ref ($class) ¦¦ $class; part of the code mean?
phranque
9:25 pm on Sep 29, 2008 (gmt 0)
if $class is a reference, ref ($class) returns the type of object it refers to. otherwise it returns an empty string which is FALSE in scalar context, so ref ($class) ¦¦ $class returns the value of $class in this case.
the purpose of the entire bless statement is to create an anonymous hash and tell it that it is now an object of the package named or referred to by the $class variable.