<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Plack::Middleware::Debug::TrackObjects;
use strict;
use parent qw(Plack::Middleware::Debug::Base);

sub run {
    my($self, $env, $panel) = @_;

    unless ($INC{"Devel/TrackObjects.pm"}) {
        return $panel-&gt;disable;
    }

    return sub {
        my $res = shift;

        my $track = Devel::TrackObjects-&gt;show_tracked_detailed;
        my @content;

        foreach (@$track){
            if (length($_-&gt;[0]) &gt; 100){
                $_-&gt;[0] = substr($_-&gt;[0],0,100);
            }
            push @content, $_-&gt;[0], $_-&gt;[1].' - '.$_-&gt;[2];
        }

        $panel-&gt;nav_subtitle('Number:'.scalar(@content)/2);

        $panel-&gt;content(
            $self-&gt;render_list_pairs([@content])
        );
    };

}

1;

__END__

=head1 NAME

Plack::Middleware::Debug::TrackObjects - Track Objects panel

=head1 SYNOPSIS

  enable "Debug";
  enable "Debug::TrackObjects";

And when you load the application with plackup or other launcher:

  # track everything
  plackup -MDevel::TrackObjects=/^/ myapp.psgi

You can specify the namespace with a regular expression. See
L&lt;Devel::TrackObjects&gt; for details.

=head1 DESCRIPTION

This debug panel captures objects created in a request cycle by using
L&lt;Devel::TrackObjects&gt;. You can run your applications multiple times
(i.e. refreshing the page) to see if the count of tracked objects
increases, in which case there are leaked objects.

=head1 SEE ALSO

L&lt;Plack::Middleware::Debug&gt; L&lt;Devel::TrackObjects&gt;

=cut
</pre></body></html>