in reply to Perl to CGI

#!/usr/bin/perl -w BEGIN {#outputs al errors to $logfile my $logfile = "logfile.log"; use CGI::Carp qw(carpout); open(LOG, ">$logfile") or die "Unable to write to $logfile: $!"; carpout(*LOG); }#
The above code should take care of not being able to access the error log by providing you with your own.

The above code error log will overwrite ( > ) the log each time your cgi is run. If you want to append just add another > (open ( LOG, ">>$logfile" ) ).

However you're still using sprite, and like athomason and merlyn suggested in your previoius post sprite is ancient and there's better solutions.

"cRaZy is co01, but sometimes cRaZy is cRaZy".
                                                      - crazyinsomniac

Replies are listed 'Best First'.
RE: RE: Perl to CGI
by She-wolf (Sexton) on Aug 17, 2000 at 23:56 UTC
    It took me two weeks to get our sys admin to install Sprite. That's one module. Getting DBI and the necessary stuff for that will take longer than my internship. Thanks for the code

    She-wolf
    "Wha? I don't get it."

      Have you consisdered simply installing modules in your home directory - if you have one. At least it would be under your control and you'd have permissions to install there.

      Then you need to make sure that you include something like
      use /path/to/module/module::name;
      or push the library path to the @INC variable
      push (@INC,/path/to/module/module.pm);

      in the top of your scripts.

      MadraghRua

        That push won't work unless you wrap it in a BEGIN block since it isn't seen in time. Two other solutions are to "use lib" and to set the PERL5LIB environment variable as documented in perlrun.
RE: RE: Perl to CGI
by She-wolf (Sexton) on Aug 18, 2000 at 18:58 UTC
    I put in the code you gave above and it taught me one thing. When I manually run the program from the command line, it gives me a log of the errors, but the errors it gives are irrelevant ones that don't effect the rest of the program(e.g. $webmaster is not referenced later in program).
    But, when I try to access it through the form, it doesn't even activate the program, but it knows it's there. That brings me back to thinking it's permissions. But I've already tried various permissions, including the one listed in repsonse to my original post and the result is the same.
    I don't get it.

    She-wolf
    "Wha? I don't get it."

      Anytime text (via std or err output) is returned from a cgi it goes back to the browser.
      If any text precedes(it usually does) the header ("Content-type: text/html\n\n" in the case of an html page) then the browser will think something is wrong. (It will think it is receiving a bad header.)

      On the possibility of permissions problems. I have a few hosted sites that prevents any cgi from executing if the directory the script is in has potentially insecure permissions. (group/other read/write needed to be turned off, this might apply to the script too)
      It may help, it's caught me several times.