[Catalyst] Custom fields in a model

Tobias Kremer list at funkreich.de
Wed Jan 21 18:49:32 GMT 2009


On 21.01.2009, at 19:24, Greg Coates wrote:

> Could I get some suggestion on the best way to add code to the model  
> (or the schema) to allow me to add a custom field to the resultset  
> without having an actual column in the database table?  I want to

Just add them as methods to your ResultSource classes:

package MyApp::Schema::Contacts;

[...]

sub common_name {
     my $self = shift;
     return $self->first_name . " " . $self->last_name;
}

--Tobias



More information about the Catalyst mailing list