NAME
Devel::Events::Match - Event matching, splicing and dicing.
VERSION
version 0.10
SYNOPSIS
use Devel::Events::Match;
my $matcher = Devel::Events::Match->new;
my @matching = $matcher->grep( match => $cond, events => \@events );
DESCRIPTION
This class provides event list filtering, chunking etc based on a simple match format.
This class is used by Devel::Events::Handler::Log::Memory in order to ease access into the event log.
METHODS
- compile_cond
-
Used to compile condition values into code references.
Scalars become equality tests on the first element (event type/name matches this).
Hashes become recursive conditions, where each key is matched on the field. The 'type' pseudofield is the first element of the event. Every value in the hash gets
compile_condcalled on it recursively.Code references are returned verbatim.
The output is a code reference that can be used to match events.
- first %args
-
Return the first event that matches a certain condition.
Requires the
matchandeventsparameters. - grep %args
-
Return the list of events that match a certain condition.
Requires the
matchandeventsparameters. - limit from => $cond, to => $cond, %args
-
Return events between two events. If
fromortois omitted then it returns all the events up to or from the other filter (fromdefaults tosub { 1 }andtodefaults tosub { 0 }).If either the
from_inclusiveandto_inclusiveparameters are provided and set to false then the range will only begin on the event after thefrommatch and end on the event before thetomatch respectively.Requires the
eventsparameter. - chunk %args
-
Cuts the event log into chunks. When
$markermatches a new chunk is opened.Requires the
markerandeventsparameters.The
firstandlastparameters, when provided and false will cause the first and last chunks to be dropped, respectively.The first chunk contains all the events up to the first matching one.
- take_while %args
- take_until %args
- drop_while %args
- drop_until %args
-
Require the
matchandeventsparameters.
SUPPORT
Bugs may be submitted through the RT bug tracker (or bug-Devel-Events@rt.cpan.org).
AUTHOR
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
COPYRIGHT AND LICENCE
This software is copyright (c) 2007 by יובל קוג'מן (Yuval Kogman).
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.