Devel::Events::Handler::Log::Memory - An optional base role for event generators.


        use Devel::Events::Handler::Log::Memory;

        my $log = Devel::Events::Handler::Log::Memory->new();

        Some::Geneator->new( handler => $log );


This convenience role provides a basic send_event method, useful for implementing generators.



The list of events.

Auto derefs.


The Devel::Events::Match instance used for event matching.



Remove all events from the log.

Provided by MooseX::AttributeHelpers.

first $cond
first %args

Return the first event that matches a certain condition.

Delegates to Devel::Events::Match.

grep $cond
grep %args

Return the list of events that match a certain condition.

Delegates to Devel::Events::Match.

limit from => $cond, to => $cond, %args

Return events between two events. If if from or to is omitted then it returns all the events up to or from the other filter.

Delegates to Devel::Events::Match.

chunk $marker
chunk %args

Cuts the event log into chunks. When $marker matches a new chunk is opened.

Delegates to Devel::Events::Match.

new_event @event

Log the event to the events list by calling add_event.

add_event \@event

Provided by MooseX::AttributeHelpers.

replay $handler

Replay all the events in the log to $handler.

Useful if $handler does heavy analysis that you want to delay.

There isn't much to it:

        $handler->new_event(@$_) for $self->events;

So obviously you can replay subsets of events manually.


If any references are present in the event data then they will be preserved till the log is clear. This may cause leaks.

To overcome this problem use Devel::Events::Filter::Stringify. It will not allow overloading unless asked to, so it's safe to use without side effects.


Add an option to always hash all the event data for convenience.

Make grep and limit into exportable functions, too.