[CDBI] Updating data automatically after a search (trigger)

[prev] [thread] [next] [Date index for 2006/02/01]

From: Kjell Arne
Subject: [CDBI] Updating data automatically after a search (trigger)
Date: 14:12 on 01 Feb 2006
Hiya.

I've just started using Class::DBI in my project and I want to update a
timestamp every time an object has been search()'ed for.
That way I can see the last time an object was searched for.

Example with a session object:
my $session = My::Session->search(pin => $pin) if $pin;

I basically want something like this to happen in session.pm:
sub search {
    my ($self, $DATA) = shift;

    $self->SUPER::search($DATA);

    // This will fail as $self is not blessed
    $self->last_active(time);
    $self->update();
    // **
}

In theory triggers would be my friend here but there is no support for
an "after_search" trigger.
Any hints or tips are greatly appreciated as I'm totally new to the
wonderful world of Class::DBI.

- Kjell Arne

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] Updating data automatically after a search (trigger)
Kjell Arne 14:12 on 01 Feb 2006

Generated at 17:59 on 03 Feb 2006 by mariachi v0.52