The lazy man's way out is: use DateTime; use DateTime::Duration;
my @users = $rs->search({state=>$state}); for my $user (@users) { my $duration = DateTime::Duration->new(DateTime->now - $user->last_modified); $user->delete if ($duration->seconds > $limit); } Probably more generic rather than hard-coding SQL stuff. On Sun, 2010-01-24 at 11:21 -0500, Rob Kinyon wrote: > On Sun, Jan 24, 2010 at 02:44, Octavian Rasnita <octav...@fcc.ro> wrote: > > From: "Rob Kinyon" <rob.kin...@gmail.com> > >> $rs->search({ > >> state => $state, > >> last_modified => [ "< TIMEDIFF( NOW(), ? SECONDS", $seconds ], > >> })->delete_all; > >> > >> Standard SQL::Abstract stuff, described in both the DBIC cookbook and > >> the SQL::Abstract docs. > > > > Is the following SQL > > > > < TIMEDIFF( NOW(), ? SECONDS > > > > a standard SQL code supported by more databases? > > The point I was trying to make is that the stuff in the quotes is > literal SQL. So, whatever your DBMS needs to determine a difference > between two times. I used MySQL-specific syntax, but the concept > transfers. > > Rob > > _______________________________________________ > List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class > IRC: irc.perl.org#dbix-class > SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ > Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk -- Kiffin Gish <kiffin.g...@planet.nl> Gouda, The Netherlands _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk