[Catalyst] putting an object in the stash
Octavian Rasnita
orasnita at gmail.com
Tue Mar 13 12:42:12 GMT 2007
From: "Simon Wilcox" <simonw at digitalcraftsmen.net>
> You will have to iterate over the accessors individually to put them into
> the stash (I think) but you should be able to use DBIC to do most of the
> thinking. Something like (untested):
>
> my $model = $c->model("Database::Table");
> foreach my $column (@{$model->columns}) {
> $column =~ s{me\.}{}; # strip the prefix DBIC adds
> $c->stash->{$column} = $obj->$column;
> }
Ok, thank you. This is what I needed.
> You may need to adjust some of the above to get it to recognise $column as
> an accessor.
I hope I won't have any problem, or I think I can use
$obj->get_column($column).
Thank you all.
Octavian
More information about the Catalyst
mailing list