in reply to How do I tell if strict, taint, etc are on?

You might could weasel it out of one of the special variables ($^H looks remotely promising; see perlvar), but then the question that springs to mind is: Why? Tainting I could see possibly (you want to not run unless it's enabled), but a use for runtime checking of strict-ness eludes me.

Replies are listed 'Best First'.
Re^2: How do I tell if strict, taint, etc are on?
by barrachois (Pilgrim) on Mar 16, 2006 at 20:01 UTC
    Yeah, I see $^H, thanks, but since the docs say explicitly "WARNING: This variable is strictly for internal use only", it doesn't sound exactly like a supported API. :)

    As to why, well, I'm working on a diagnostic/debugging page for some mod_perl web stuff, that shows me the environment, database handles, process status, and so on. As part of that, I wanted it to report as much as it could about the state of the running perl environment - including the various pragmas and what-not.

      Ahh. OK I can see that. :)

      A problem that comes to mind right off is that strict is lexically scoped so you're probably not going to be able to tell from outside a given scope if it's on or off inside, at least as far as I can think of. You might be able to do some deep magic with one of the B modules, but I wouldn't count on it. If no one else here comes up with anything you might run this by p5p and see if anyone there can offer pointers.