develooper Front page | perl.perl5.porters | Postings from October 2008

@{"_<$filename"} is unreasonably tied to use of DB::DB ($^P & 0x2)

Thread Next
Tim Bunce
October 28, 2008 08:28
@{"_<$filename"} is unreasonably tied to use of DB::DB ($^P & 0x2)
Message ID:
The perldebguts pod says that @{"_<$filename"} holds the lines of
source code of $filename. That's implemented by a call in pp_ctl.c
to save_lines().

The call to save_lines() is only made if PERLDB_LINE is true ($^P & 0x2).
PERLDB_LINE is used primarily to enable single-stepping or profiling
by calling the DB::DB() for every statement.

So currently you can't introspect the source code of files (or evals,
and "perl -" or "perl -e '...'") without enabling single-stepping!

This is an issue for NYTProf because it would like to be able to save
the source code of evals etc. but would like to avoid using the slow
expensive DB::DB style of profiling.

The attached basic patch enables a separate bit to control saving source

Any chance this, or something like it, could go into 5.10.1?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About