On Tue, 3 Jul 2007, Steve Francia wrote:
I am trying to write a function for a result set that will be available
like an accessor...
Here is the scenario and goal:
I have a object of which there are two columns in the table, full_name
and alias.
I want to use $obj->name to access the name for which there would be
logic saying return full_name unless alias has a value, then return alias.
What is the best way to go about doing this? Am I on the right track?
Your class is just a perl class, nothing fancy. So just create:
sub name
{
my ($self) = @_;
.. check $self->full_name || $self->alias as appropriate, and return ..
}
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/