ropey has asked for the wisdom of the Perl Monks concerning the following question:

Hi All

Probably a simple question, have a mod_perl application and wish to be able to print to a log file which isn't STDERR, is there a simple way to open a global filehandle like STDERR which will be accessible by all the mod_perl processes?

So inside a package could do print NEWHANDLE "Test";

am i missing a directive in the httpd.conf or the startup script ?

Replies are listed 'Best First'.
Re: mod_perl alternative filehandles
by Joost (Canon) on Mar 29, 2005 at 01:37 UTC
      Hi Joost,

      But if I say do open(F, "> /tmp/mylog.log"); in my startup script

      Then F isnt going to be accessible by another package by print main::F ? or am I being stupid ?

Re: mod_perl alternative filehandles
by ghenry (Vicar) on Mar 29, 2005 at 14:47 UTC

    I think I may have misunderstood, but to open STDERR to a log file, you can use:

    # Send errors to my private error log open STDERR, ">>/home/ghenry/.error_log" or die "Can't open error log for append: $!"

    Then close it later.

    Gavin.

    Walking the road to enlightenment... I found a penguin and a camel on the way..... Fancy a yourname@perl.me.uk? Just ask!!!