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

This error is driving me nuts, I cannot seem to find what it means:
[Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] Bareword foun +d where operator expected at (eval 59) line 1, near "//www" [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] \t(Missing op +erator before www?) [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] Bareword foun +d where operator expected at (eval 60) line 1, near "//www" [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] \t(Missing op +erator before www?) [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] Bareword foun +d where operator expected at (eval 61) line 1, near "//www" [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] \t(Missing op +erator before www?) [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] Bareword foun +d where operator expected at (eval 62) line 1, near "//www" [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] \t(Missing op +erator before www?) [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] Bareword foun +d where operator expected at (eval 63) line 1, near "//www" [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] \t(Missing op +erator before www?) [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] Bareword foun +d where operator expected at (eval 64) line 1, near "//www" [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] \t(Missing op +erator before www?) [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] Bareword foun +d where operator expected at (eval 65) line 1, near "//www" [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] \t(Missing op +erator before www?) [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] Bareword foun +d where operator expected at (eval 66) line 1, near "//www" [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] \t(Missing op +erator before www?) [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] Bareword foun +d where operator expected at (eval 67) line 1, near "//www" [Tue Sep 21 06:38:05 2010] [error] [client 61.942.17.87] \t(Missing op +erator before www?)
line 1 is the shebang line:
#!/usr/bin/perl -a
there is no www anywhere near that line. the only two places in the index.cgi script are these two:
# First location with www in it my $_tdomain = $ENV{SERVER_NAME}; my @_tdom = split(/\./, $_tdomain); if(length($_tdom[2]) > 1 && $_tdom[0] ne "www") { $_username = $_tdom[0]; $_username = $dbh->selectrow_array(qq{select `username` from `reg_ +members` where `subName` = ? and `subNameStatus` = "1"}, undef, $_use +rname); if($_username && $ENV{SCRIPT_URL} eq '/') { window_redirect("http://www.domain.net/index.cgi?page=home&use +rname=$_username&rdf=sub$sess_id"); } }
# Second location with www in it: if (!$in{page}) {# Path or page was NOT defined so now go redirect the +m to the home page, carry the member username... add &l=0 so if it is + us, we know what happened. window_redirect("http://www.$_co_domain/index.cgi?page=home&userna +me=$regmem->{username}&l=0$sess_id"); exit; } else { $_page = $in{page}; }
those are the only places with www and I don't see a problem with any operators.

Also why is their eval and a higher number every time?

I appreciate any advice you have on this, this is filling up my error logs very fast. I cannot find the culprit.

Thanks in advance.

Mack

Replies are listed 'Best First'.
Re: Help with error;
by Corion (Patriarch) on Sep 21, 2010 at 13:53 UTC

    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.

      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?

Re: Help with error;
by TomDLux (Vicar) on Sep 21, 2010 at 16:57 UTC

    Your shebang line, perl -a, enables autosplit mode when used with -n or -p, according to perldoc perlrun. What do you suppose it does without the additional flags?

    -w is limited compared to use warnings within the file, and anyway, you also need use strict.

    If you use vi or emacs or some other coding editor, even if it doesn't specifically understand Perl, it will understand mis-matched quotes, and you'll see a chunk of code the wrong colour / font. If the main program looks allright, look at the modules and config files.

    Have you run perltidy? The formatting helps indicate where it thinks syntax errors begin. Have you used perlcritic?

    Have you tried running the program in the debugger, so you can go line by line ... you might notice a 20 line jump that bypasses the command you were expecting to see invoked.

    As Occam said: Entia non sunt multiplicanda praeter necessitatem.