NAME

Guard::Timer - a scope guard that keeps time

VERSION

version 1.0.1

SYNOPSIS

sub foo {
    my $guard = timer_guard { say "it took $_[0] seconds" };
    do_a_thing;
}

FUNCTIONS

timer_guard

my $timer1 = timer_guard { ... };
my $timer2 = timer_guard \&logger, $precision;

Returns an object. When the object is destroyed, the given coderef is invoked with a single argument: the time elapsed between creation and destruction, to $precision decimals (defaults to 3).

AUTHORS

  • Johan Lindstrom <Johan.Lindstrom@broadbean.com>

  • Gianni Ceccarelli <gianni.ceccarelli@broadbean.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 by BroadBean UK, a CareerBuilder Company.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.