in reply to Finding what args were passed to the perl interpretter ?

Well, you'd have to map the code that gets displayed back to the relevant commandline args, but you could use B::Deparse:

ben@Tyr:~$ perl -MO=Deparse -wle# BEGIN { $^W = 1; } BEGIN { $/ = "\n"; $\ = "\n"; } -e syntax OK

Note that the above 'BEGIN' statements differ from actual 'BEGIN' blocks: those are shown as 'sub BEGIN'.

"Language shapes the way we think, and determines what we can think about."
-- B. L. Whorf

Replies are listed 'Best First'.
Re^2: Finding what args were passed to the perl interpretter ?
by dpuu (Chaplain) on Nov 19, 2008 at 23:24 UTC
    Thanks for the reply. Unfortunately, that doesn't seem applicable to the problem I was trying to solve (which I guess I didn't state in my original post): the ultimate goal was for a script to detect that it was being run under -d:NYTProf, and to add that option (and other similar things) to various child perl-scripts that it runs.
    Opinions my own; statements of fact may be in error.
      I don't think there's a general way to get the arguments to perl from with Perl. However, an XS routine may be able to access argv and argc (although I've no idea whether perl itself leaves them as is).

      As for your specific request, detecting -d:NYTProf, it may be done. One of the effects of -d:foo is that it loads Devel::foo, and calls Devel::foo -> import. You may want to try to mask Devel::NYTProf::import.