NAME
DBIx::Class::QueryLog::NotifyOnMax
VERSION
version 1.005001
SYNOPSIS
my $schema = ... # Get your schema!
my $ql = DBIx::Class::QueryLog::NotifyOnMax->new(
max_count => 100,
);
$schema->storage->debugobj($ql);
$schema->storage->debug(1);
... # get warning when you do more than 100 queries
DESCRIPTION
More than once I've run into memory leaks that are caused by the user using DBIx::Class::QueryLog and forgetting to call "reset" in DBIx::Class::QueryLog. This subclass of DBIx::Class::QueryLog
simply warns after 1_000
queries have gone through it. If you want to do something more complex, subclasses which override the "notify" method are a good idea.
METHODS
new
Overridden version of "new" in DBIx::Class::QueryLog, simply adds an optional max_count
parameter which defaults to 1_000
.
notify
This is the method that runs when the max_count
has been exceeded. Takes no parameters. Make sure to call $self->notified(1)
if you want the event to only take place once after the threshold has been exceeded.
AUTHORS
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
Cory G Watson <gphat at cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Cory G Watson <gphat at cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.