[Dbix-class] using overload in a resultset object
Andrew Main
andrew.main at gmail.com
Thu Mar 2 02:10:06 CET 2006
The DBIx::Class::Manual::Cookbook has a brief note:
http://search.cpan.org/~mstrout/DBIx-Class-0.05007/lib/DBIx/Class/Manual/Cookbook.pod#Stringification
I do something like this, but there could be a better way:
####################
package Foo::DBIC::SalesRep;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/ PK::Auto::SQLite Core/);
__PACKAGE__->table('sales_rep');
__PACKAGE__->add_columns(qw( id first_name last_name active));
__PACKAGE__->set_primary_key('id');
sub full_name
{
my ($self) = @_;
return $self->last_name . ', ' . $self->first_name;
}
use overload '""' => 'full_name', fallback => 1;
1;
-Andrew
On 3/1/06, Jonas Alves <jonas.alves at co.clix.pt> wrote:
> How can i use overload to stringify a resultset object?
> I can't find anything in the docs.
>
> Thanks
> --Jonas
>
> _______________________________________________
> 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/
>
More information about the Dbix-class
mailing list