in reply to Help with error;

I would assume that it is a stray double quote sign somewhere not shown by you that throws Perl off. Imagine the following:

print "Hello";" <-- # Stray double quote sign here ... window_redirect("http://

This will make Perl see the text up to http:// as one (large) string. What then follows to Perl looks like a label (http:) and the "repeat last regex match" operator (//) and then a bareword that Perl doesn't know (www).

In the end, as always, try reducing your script to the minimum amount of lines so that it still reproduces the problem. Without seeing the complete code, we can only throw out wild guesses.

Also, you might want to use perl directly to check your scripts for syntax errors:

perl -wc myscript

This will tell you about where Perl finds errors and will also be explicit in the line number.

Replies are listed 'Best First'.
Re^2: Help with error;
by Anonymous Monk on Sep 21, 2010 at 14:04 UTC
    Ok, this system does have tons and tons of code, but most of which are put in different files and pulled in based on the $in{page} value passed.

    I see this on every page in the error logs so almost like it is in in the index.cgi script, if it was in a required file that I call in, would it still just say index.cgi instead of the name of the file?

    I did run it with -wc: perl -wc index.cgi and it said the syntax is ok.

    I checked every line of the index.cgi script only to find no unclosed " marks. so I don't know what could cause it.

    could this be a problem in a config file I use?(based on what I said above)?

    Thanks,
    Mack

      How would I know what "config file" you use? You haven't told us anything about your setup.

      I can only recommend that you look at your webserver access logs and determine what URL causes the errors to be thrown and then look at how to fix the things.

      If the bulk of your code is not in the index.cgi but elsewhere, maybe you will need to look at this "elsewhere".

      Have you tried changing (a copy of) your index.cgi to see what parts you can remove until the error disappears?

        Yes, I just made a duplicate: index2a.cgi

        then I changed the shebang to this:

        #!/usr/bin/perl -a
        to
        #!/usr/bin/perl
        so just removed the -a now I get an 500 error on the webscript but not from shell, and the error log has this:
        Premature end of script headers
        however, it does not have that if I put either -a or -w after the shebang line.

        so I do not know why that would happen. I never print anything without first printing: print header(-charset=>"UTF-8");

        except if I am printing to a file:
        open(FILE,">/path/to/file") or die "could not open file: $!"; print FILE qq~Hello this is just a test to see if it works.~; close(FILE);
        I do that for debugging sometimes.

        The config file I use is a file called: vars.conf and it just has a bunch of subroutines in it that are standard and a bunch of code that is standard.

        I call it by using require.

        That file was over 7k lines long so I broke it down into two:
        vars.conf and varsEsubs.conf which vars.conf calls the other using require. Only did that because when I first did that file I was on a slow internet so while I uploaded the file it took a while and since we were always live I was always worried someone on the site would get a software error from the file not being available while it was being over-wrote. So I broke it down into smaller files.

        Anyhow, It is very odd that if the -w or -a is in the shebang then there is no error in the browser.

        I guess I'll duplicate everything then start playing with it to see if I can find the problem.

        Thanks for any more help you can be and for the help you've already been.

        Mack