in reply to Re^2: Finding the name of the target of a coderef
in thread Finding the name of the target of a coderef
I would solve that by passing a label along with the coderef when I added the timed event to the queue. Something along the lines of:
add_to_queue(foo => \&foo, [ @fooargs ], $footime); add_to_queue(bar => \&bar, [ @barargs ], $bartime); dump_queue(); { my @queue; sub add_to_queue { my ($label, $code, $args, $time) = @_; push @queue, [ $label, $code, $args, $time ]; } sub dump_queue { for (@queue) { my ($label, $code, $args, $time) = @$_; print "Will execute $label with @$args at $time\n"; } } }
Of course, your exact calling conventions will likely be different, but this is just to give you the general idea.
|
|---|