Re: Pagers and Iterators

[prev] [thread] [next] [Date index for 2005/02/25]

From: Matt S Trout
Subject: Re: Pagers and Iterators
Date: 14:35 on 25 Feb 2005
On Fri, Feb 25, 2005 at 06:55:30AM -0500, Sean Davis wrote:
> 
> On Feb 25, 2005, at 6:47 AM, Simon Wistow wrote:
> 
> >	sub foo {
> >		my $self = shift;
> >		some_munging($self->actual_column);
> >	}
> >
> >
> >i.e the operation done in some_munging() cannot be done in SQL
> >
> 
> 
> It looks like the some_munging is done per-row?  If that is the case, 
> could you apply a trigger when you insert or update the table to 
> compute the value of some_munging(row) and store it in the database so 
> that you can later sort on it?

See my Class::MethodFilter for a way of doing this easily in (what I hope
is) a Class::DBI-ish way - e.g.

__PACKAGE__->add_method_filter('column', sub { .... } );

...

$obj->column_filtered;

If column_filtered does not exist, it'll calculate the value each time; if
column_filtered already exists (e.g. due to a ->columns call) the value is
calculated each time 'column' is updated and automatically stored.

If there's any way I could improve this to work better for the use cases
being discussed here, drop me a line or reply to list and I'll see about
adding it when I get time.

        -- 
            Matt S Trout            Brag sheet:    http://trout.me.uk/services.html
LAMP, Infrastructure        Contact:       services@xxxxx.xx.xx
   and Automation
     specialist                                       Do it once. Do it right.

(message missing)

Pagers and Iterators
Simon Wistow 11:30 on 25 Feb 2005

Re: Pagers and Iterators
Daniel Wijnands 11:34 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 11:47 on 25 Feb 2005

Re: Pagers and Iterators
Sean Davis 11:55 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 12:14 on 25 Feb 2005

Re: Pagers and Iterators
Carl Johnstone 13:23 on 25 Feb 2005

Re: Pagers and Iterators
Cees Hek 14:18 on 25 Feb 2005

Re: Pagers and Iterators
Matt S Trout 14:35 on 25 Feb 2005

Re: Pagers and Iterators
William Ross 12:15 on 25 Feb 2005

Re: Pagers and Iterators
William Ross 14:04 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 15:37 on 25 Feb 2005

Re: Pagers and Iterators
Simon Wistow 16:34 on 25 Feb 2005

Re: Pagers and Iterators
Ofer Nave 20:52 on 25 Feb 2005

Re: Pagers and Iterators
Cees Hek 16:41 on 25 Feb 2005

Re: Pagers and Iterators
Carl Johnstone 17:09 on 25 Feb 2005

Generated at 17:56 on 01 Mar 2005 by mariachi v0.52