in reply to Timer::Runtime proposed

Due to the use of END, the program will not display a parting message on either a serious error (preventing END blocks to be run), or when doing an exec (which doesn't run END blocks).

Personally, I prefer the time(1) utility, which doesn't suffer from the problems mentioned above, shows more detailed output (defaults to real/user/sys times, but can be show (much) more, specially GNU time), and doesn't actually change the program run.

Replies are listed 'Best First'.
Re^2: Timer::Runtime proposed
by awohld (Hermit) on Mar 28, 2011 at 23:31 UTC
    The END block error with 'exec' is pretty serious and explains some of the problems I've been having. Looks like the implementation of my module is not a very good idea.
Re^2: Timer::Runtime proposed
by awohld (Hermit) on Mar 29, 2011 at 08:14 UTC
    What if in the START block I started a OO timer and then in it's destroy method, calculated the stop time and printed it?

    I think that would get around the END problems.
      Did you try whether it works? Seems easier than asking here whether it does.
      $ perl -wE 'sub DESTROY {say "ping"} my $x = bless [];' ping $ perl -wE 'sub DESTROY {say "ping"} my $x = bless []; exec "echo"' $
      Alternatively, one could have consulted the manual page:
      Note that "exec" will not call your "END" blocks, nor will it invoke "DESTROY" methods on your objects.