From: Nicholas Clark [mailto:[EMAIL PROTECTED]]
> On Thu, Aug 30, 2001, Brent Dax wrote:
> > From: Michael G Schwern [mailto:[EMAIL PROTECTED]]
> > # On Fri, Aug 31, 2001, Bryan C. Warnock wrote:
> > # > Access to the source code.
> > #
> > # Already got that.
> > #
> > #     use Fcntl qw(:seek);
> > #     seek DATA, 0, SEEK_SET;
> > #     @code = <DATA>;
> > 
> > IMHO, that's too hackish--just reading that doesn't make
> > what you're doing obvious.  An explicit $*CODE filehandle
> > would make more sense to the uninitiated.
> 
> perl -we 'print q(use Fcntl qw(:seek); seek DATA, 0, SEEK_SET 
> or warn $!; @code = <DATA>; print qq(Here is my source 
> code\n), @code;), "\n__DATA__\n"' | perl 
> Illegal seek at - line 1.
> Here is my source code
> 
> Who said that my source file handle was seekable?
> Particularly if it's coming in via an interesting PerlIO 
> layer (and not just a pipe as in my contrived example.)

This gets a little closer... but BEGIN, INIT, CHECK, END blocks are lost
except for subroutine definitions. Anyone know a way to get at them using
B::Deparse?

perl -we '$a++; BEGIN{$a=1} use B::Deparse; B::Deparse::compile()->(); my
$var=q{here}; sub hello {print qq{hello\n}}'

Reply via email to