The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Devel::Events::Filter::Size - Add Devel::Size info to event data.

SYNOPSIS

        my $f = Devel::Events::Filter::Size->new(
                handler => $h,
                fields => [qw/foo bar gorch/], # calculate the size of these fields
        );

        # OR

        my $f = Devel::Events::Filter::Size->new(
                handler => $h,
                fields => "object", # just one field
        );

DESCRIPTION

This class uses Devel::Size and optionally Devel::Size::Report to provide size information for data found inside events.

Typical usage would be to apply it to the object field in conjunction with Devel::Events::Objects.

ATTRIBUTES

fields

The fields whose size to check.

Can be a single string, or an array reference.

When undefined all fields will be computed.

one_field

This parameter controls the placement of the results (top level, or under the sizes field).

It defaults to true when fields is a scalar, and false in any other situation.

no_total

When true, "total_size" in Devel::Size will not be used.

Defaults to false.

no_report

When true, Devel::Size::Report will not be used.

Defaults to true.

METHODS

filter_event

When is_one_field returns a true value, this method will add a size, and optionally a total_size and size_report field to the event. Otherwise it will add several of these to the sizes field, keyed by the refaddr of the value.

Only reference types will have their sizes computed.

is_one_field

Internal method. Used by filter_event

get_field

Returns the fields whose sizes need computing. This is either all fields if fields is undef, or the specified fields.

get_fields

Returns only one field. Used when is_one_field is true.

calculate_sizes

Return an entry with the size, total_size and size_report results.

calculate_size

See "size" in Devel::Size

calculate_total_size

Optionally uses "total_size" in Devel::Size, depending on the value of no_total.

calculate_size_report

Optionally loads Devel::Size::Report and uses uses "report_size" in Devel::Size::Report, depending on the value of no_report.

SEE ALSO

Devel::Events, Devel::Size, Devel::Events::Filter

AUTHOR

Yuval Kogman <nothingmuch@woobling.org>

COPYRIGHT & LICENSE

        Copyright (c) 2007 Yuval Kogman. All rights reserved
        This program is free software; you can redistribute it and/or modify it
        under the terms of the MIT license or the same terms as Perl itself.