in reply to Print Current Program Source Code

As promised by my earlier reply, Acme::Echo has just been uploaded to cpan:
use Acme::Echo 'after', src_fmt=>"Source of just-executed code:\n%s"; use strict; use warnings; print "hello world\n";
Produces the output:
hello world Source of just-executed code: use strict; use warnings; print "hello world\n";

Replies are listed 'Best First'.
Re^2: Print Current Program Source Code
by GrandFather (Saint) on Aug 28, 2006 at 01:40 UTC

    But that only prints part of the source. :)


    DWIM is Perl's answer to Gödel
      well, yeah :) .. well, prints the enitre thing between the 'use Acme::Echo' statement and the end or a 'no use Acme::Echo' .. which could be handy .. and could turn on,off,on,off as desired..

      And in lines mode you'll lose some whitespace ... though it provided a challenging Filter::Simple and PPI task -- you can see i had trouble recursing into compound statements .. it's on my project list to revist ;)