in reply to User Feedback for Subroutines with Long Execution Time

take a look at the POE_Cookbook/Looping section. you might be able to break your calculations into N discrete steps. then you could do something like:

my $N = setupSub( %myParameters ); while (defined( my $at = stepSub())) { printf "%d percent done\n", $at/$N; } my $results = resultsSub();

or, you could have your subroutine take an optional callback and granularity.

my $granularity = 5; sub showProgress { # will be called $granularity+1 times my $at = shift; if ($at == 0) { print "starting\n"; } elsif ($at == $granularity) { print "done\n"; } else { print "$at/$granularity done\n"; } } my $results = mySub(%myParam, progress => { callback => \&showProgress, granularity => $granularity } );