in reply to mod_perl seems to have disappeared the open function

I'm not a mod_perl internals expert to any degree, but it wouldn't surprise me at all if STDOUT and STDERR were actually tied variables to an Apache subclass. In which case, the error message might start to make a bit more sense.

In fact, the docs say just that. See http://perl.apache.org/docs/1.0/guide/porting.html#STDIN__STDOUT_and_STDERR_streams for the nitty-gritty. That whole section might be interesting.

BTW, I'm having a hard time parsing your node title. Are you sure things can disappear things in English?

  • Comment on Re: mod_perl seems to have disappeared the open function

Replies are listed 'Best First'.
Re^2: mod_perl seems to have disappeared the open function
by ikegami (Patriarch) on Nov 27, 2006 at 23:44 UTC

    If so, I think that means the problem should be solved by using proper scoping.

    { local *STDOUT; local *STDERR; open(STDOUT, ">/dev/null") or $log->die("Unable to redirect STDOUT to dev null: $!"); open(STDERR, ">/dev/null") or $log->die("Unable to redirect STDERR to dev null: $!"); ... }

    Why are you redirecting to null (slow!) rather than just closing the file handle?

    { local *STDOUT; local *STDERR; ... }
        Why are you redirecting to null (slow!) rather than just closing the file handle?

      Huh. Good question. Well, to quote a movie I saw recently, "It's complicated" (I think that was MI:3).

      I actually want to run Ghostscript within mod_perl and pipe commands to it, but unfortunately Ghostscript is quite chatty, so to keep things clean, I want to disable the output streams. I'm also thinking it might be useful to re-direct the output streams to temporary files until I get all this stuff figured out.

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Re^2: mod_perl seems to have disappeared the open function
by talexb (Chancellor) on Nov 28, 2006 at 04:23 UTC
      I'm not a mod_perl internals expert to any degree, but it wouldn't surprise me at all if STDOUT and STDERR were actually tied variables to an Apache subclass. In which case, the error message might start to make a bit more sense.

    Of course, you are right. It has been too long since I programmed using mod_perl, and I've forgotten a lot. Thanks for the link to the Apache docs.

      BTW, I'm having a hard time parsing your node title. Are you sure things can disappear things in English?

    Sorry -- Saturday I had a show in Peterborough, abuot 90 minutes away, and I drove back to Toronto after the show, getting home at 2am. I ran around doing errands and cooking supper during the afternoon, then spent hours that night watching Tom Hanks in the DaVinci Code -- both the movie and all of the extras -- so had square eyeballs by the time I finally went to bed at 1am. Then I was paged at 415am because we had a Production problem that took me an hour to resolve and clean up after.

    So when I wrote this at the end of the day I wasn't making much sense. The title should probably be something like mod_perl seems to have caused open to disappear.

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds