Why isn't there a Perl6::Caller on the CPAN? See the caller function in Synopsis 6 for an idea of what I want:
use Perl6::Caller; print "In ", Caller->sub, " called from ", Caller->file, " line ", Caller->line, "\n";
Of course, you'd want to support everything that caller does, including support for how many levels back you want to go. Shouldn't be too hard to write.
You should even be able to optionally override CORE::caller:
$ perl -le 'print prototype "CORE::caller"' ;$
(prototype returns 'undef' if the builtin is not overrideable.)
Re:Time::Piece-like would work well...
Ovid on 2007-04-16T13:30:54
Hmm, in scalar context, caller returns the package name. I suppose you could overload stringification and no one would ever notice (I think).
Re:Time::Piece-like would work well...
Matts on 2007-04-16T13:46:13
That's what Time::Piece does.