Re: Calculation of non-database columns

[prev] [thread] [next] [Date index for 2005/06/03]

From: Uwe Voelker
Subject: Re: Calculation of non-database columns
Date: 09:57 on 03 Jun 2005
Hello Cees,

> how about something simple like this:
> 
> sub duration {
>   my $self = shift;
>   return $self->to - $self->from;
> }

Thanks, this solves my problem.

But just for curiosity: Is there a way to accomplish this in CDBI? Maybe 
with a TEMP column and has_a? The problem I see there is the missing 
class. Also to and from must already be deflated...

__PACKAGE__->has_a(duration => '???',
                    deflate  => sub { $obj->to - $obj->from },
                   );

Good bye,
Uwe

Calculation of non-database columns
Uwe Voelker 21:21 on 02 Jun 2005

Re: Calculation of non-database columns
Cees Hek 23:02 on 02 Jun 2005

Re: Calculation of non-database columns
Uwe Voelker 09:57 on 03 Jun 2005

Re: Calculation of non-database columns
Cees Hek 15:46 on 03 Jun 2005

Re: Calculation of non-database columns
Uwe Voelker 11:56 on 04 Jun 2005

Generated at 16:36 on 28 Jul 2005 by mariachi v0.52