* On Mon, Nov 17 2008, Amiri Barksdale wrote: > I am a new user of Catalyst, and from reading the documents and > reading blogs posts I have been able to set up my schema, my authz/ > authen, sessions, and my Mason view. I have a very simple question, > though. > > This in a controller > > $c->stash->{elements} = [$c->model('DB::Elements')->all]; > > Requires this in a view: > > <% $element->{_column_data}->{title} %>
To expand on the other reply to this message, I'd like to point out that you should never access the hash values backing an object directly. Although sometimes you might get the right data this way, it's not guaranteed -- you need to call the documented accessor methods. (For example, sometimes the hash data is populated lazily; meaning that the first time you call $object->foo, foo is calculated, stashed in $object->{foo}, and returned. Until you call the method, though, the hash value doesn't exist.) Anyway, I assume you arrived at $element->{_column_data}->{title} by looking at the output of Data::Dumper. That's a fine strategy, but you should also add Class::Inspector to your debugging arsenal. You can find what methods you can call on an object with code like: use Class::Inspector; say join "\n", @{Class::Inspector->methods(ref $object, 'public')}; I also recommend that you try out Devel::REPL if you haven't already. At the very least, it will save you from typing the 'say join "\n", @{...}' part. Regards, Jonathan Rockway -- print just => another => perl => hacker => if $,=$" _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/