MooseX...::Timer(3pm)

πŸ“¦
version 0.05 Β· 2 versions
  • 0.05 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.05 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

🌸 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 $name and 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 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