| MooseX::Role::Timer(3pm) | User Contributed Perl Documentation | MooseX::Role::Timer(3pm) |
MooseX::Role::Timer - Measure times with your object.
package Demo;
use Moose; # or Any::Moose
with 'MooseX::Role::Timer';
sub BUILD {
shift->start_timer("build");
}
sub do_something {
my $self = shift;
$self->start_timer("something");
# do something...
$self->stop_timer("something");
}
package main;
my $demo = Demo->new;
$demo->do_something;
$demo->do_something;
printf "%3.6fs\n", $demo->elapsed_timer("build"); # time spent since BUILD
printf "%3.6fs\n", $demo->elapsed_timer("something"); # time spent in sub do_something
This Role provides your object with timers, making it easier to keep track of how long whatever actions take.
Michael Langner, "<mila at cpan.org>"
Please report any bugs or feature requests to "bug-moosex-role-timer at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Role-Timer>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
Copyright 2015 Michael Langner, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| 2022-06-15 | perl v5.34.0 |