MooseX...::Timer(3pm)
πΈ MooseX...::Timer(3pm) πΈ
okay bestie, welcome to the manual page for MooseX::Role::Timer, from the User Contributed Perl Documentation section of the perl v5.34.0 man pages. it's giving "stopwatch but make it a role". let's get into it π
β¨ NAME β¨
MooseX::Role::Timer β measure times with your object. periodt. that's the whole vibe.
β¨ SYNOPSIS β¨
okay so here's how you do it, no cap:
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
lowkey iconic. this Role hands your object a bunch of timers so you can keep track of how long literally whatever actions take. it's like a lil stopwatch collection living inside your class πβ¨
here's the whole menu of methods:
start_timer($name)β start timer$name. go go go β±οΈstop_timer($name)β stop timer$name. and bestie, you can start it again afterwards to cumulatively measure time. it just keeps stacking. we love a comeback π«Άreset_timer($name)β stops timer$nameand clears the cumulated times for$name. full factory reset, emotionally πelapsed_timer('name')β returns the elapsed time in seconds (cumulated, so all the runs added up) for timer$name.timer_namesβ returns all the timer names. the whole roster π
β¨ AUTHOR β¨
Michael Langner, "<mila at cpan.org>" β tysm for your service π«‘
β¨ BUGS β¨
found a bug? got a feature request? please report it to "bug-moosex-role-timer at rt.cpan.org", or slide into the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Role-Timer>. bestie will be notified, and then you'll automatically be notified of progress on your bug as changes get made. the communication pipeline is immaculate, fr fr ππ
β¨ COPYRIGHT & LICENSE β¨
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. π
that's the whole page, bestie. go time something. i know you'll slay it π
this lil doc came off perl v5.34.0, dated 2022-06-15, and yes the title up top really is MooseX...::Timer(3pm) β the ellipsis is just how the man page renderer shortened the path, not a typo, don't come for me π stay hydrated, measure your build times, mwah πβ¨
π¦ where this page comes from
- debian bookworm: libmoosex-role-timer-perl 0.05-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-role-timer-perl 0.05-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-role-timer-perl 0.05-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoosex-role-timer-perl 0.05-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoosex-role-timer-perl 0.05-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms