On Fri, Jul 30, 2010 at 09:17:30AM -0500, Ted Zlatanov wrote: > I have a Perl 5 module called Every which provides, simply, > > every(5); # true on invocation 5, 10, etc. > every(seconds => 5); # true at 5, 10, etc. seconds > > It's really nice in endless loops, logging, etc. I'd like to translate > it to Perl 6 (using Rakudo specifically). > > Its current implementation requires Devel::Opcode because it needs to > know what location is getting called again and again. > > Generally for Perl 6, is there a simple way to make Every obsolete by > using built-ins? I'd love that but haven't seen anything in the > language that would help.
I suspect something like CALLER::<$?FILE> and CALLER::<$?LINE> might eventually do what you want -- they would at least get to a unique line within the calling. CALLER:: and $?FILE and $?LINE are not yet implemented in Rakudo, but I suspect the language specification has sufficient features to eventually make a clean implementation a possibility. Pm