Devel::Events::Handler::Log::Memory(3)

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

VERSION
version 0.10

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

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

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

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

ATTRIBUTES

events
    The list of events.

    Auto derefs.

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

METHODS

clear
    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.

CAVEATS
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.

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

Make "grep" and "limit" into exportable functions, too.

SUPPORT
Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-Events> (or bug-Devel-Events@rt.cpan.org <mailto: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.