[Catalyst] putting an object in the stash

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Tue Mar 13 12:44:44 GMT 2007


Daniel McBrearty wrote:
> basically : an object IS a (blessed) hash.
> 
> http://perldoc.perl.org/perlboot.html
> 
> You kind of need to understand this, if you don't already. It's worth
> having a read through the tutorials.

As others have pointed out, objects can also be created by blessing
other references.

In the context of the original question, it's also worth remembering
that an object is not the same as a hash as far as TT is concerned. It
unifies the syntax to call accessors and to access the members of a
hash. But it does *not* let you access arbitrary elements in a blessed
hash as Perl does. In TT, you can only use the methods.

Which is generally a Good Thing, but occasionally can be surprising.

Cheers, Dave



More information about the Catalyst mailing list