Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^9: Weird error log message

by ikegami (Pope)
on Jun 15, 2009 at 14:47 UTC ( #771672=note: print w/replies, xml ) Need Help??

in reply to Re^8: Weird error log message
in thread Weird error log message

The problem was that your edited is adding a BOM before the shebang line, so your web server didn't accurately detect the shebang line. "#!" must appear at the very top of the file and it wasn't. The following will remove the UTF-8 BOM from a file:

perl -i.bak -ple"s/^\xEF\xBB\xBF// if $.==1" script.cgi

Note that if your source is UTF-8, you should probably use use utf8;.

Replies are listed 'Best First'.
Re^10: Weird error log message
by Nik on Jun 16, 2009 at 07:47 UTC
    Thank you for this info and as you saw in the other forum i was the one that accidentally found this out, after noticing the encoding of the file the helper upload it for mw that worked. Thanks celaring this out for me though.

    I didnt knew that before the shebang line i should have used '#!'. Isnt it enough that it has it in the shebang line as well '#!/usr/bin/perl' ? i tried clciking the link with BOM but it wont load so i still dont know what BOM is and why the webserver on the remote server won't understand it since it runs apche while locally my apache web server does not care as to what encoding i save the file. Works with/withoiut BOM utf8 or as ansi.

    You say that if my script is UTF-8 i probablt have to use use utf8; What do you mena by that? When a script source is considered to be utf-8? I must tell you though that inside my perl scripts i use greek text.

      Isnt it enough that it has it in the shebang line as well '#!/usr/bin/perl' ?

      What's "it"?, the "#!"? No. When I said it has to be the very first thing in the file, I meant it has to be the very first thing in the file.

      $ od -c 0000000 357 273 277 # ! / u s r / b i n / p +e 0000020 r l \n p r i n t ( " H e l l o 0000040 W o r l d \ n " ) ; \n \n 0000054 $ -bash: ./ cannot execute binary file $ perl -i.bak -ple"s/^\xEF\xBB\xBF// if $.==1" $ od -c 0000000 # ! / u s r / b i n / p e r l \ +n 0000020 p r i n t ( " H e l l o W o +r 0000040 l d \ n " ) ; \n \n 0000051 $ perl Hello World

      i tried clciking the link with BOM but it wont load

      It's the Wikipedia page on "byte-order mark". I don't see why you couldn't load it.

      When a script source is considered to be utf-8?

      Either it is or it isn't. There's no "considered" about it. If you saved it using UTF-8 as the encoding, it's UTF-8. If you used another encoding, it isnt.

      But yes, I meant when the source is UTF-8.

      Perl will assume the source is encoded using iso-8859-1 unless use utf8; is used.

        Thanks i can see the 1st 3 bytes if BOM is used. Still the link is disfunctional and i dont know why BOM is used.

        i try using
        #! #!/usr/bin/perl -w
        #!/usr/bin/perl -w use utf8;
        and save my script with the use of Notepad++ with utf8 encoding, but when i upload it wont run. why?

        Also in my scripts aprt from the perl syntax i use greek characatets. does that mean that i have to save my scripts in utf8 encoding or ansi? What iam trying to say here is based on what criteria should i choose as to what encoding i must pick for saving my perl scripts? Why ut8? why utf8 without Bom? why ansi? is there a reason? Why locally all encodings work and remotely only ansi does?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://771672]
[Corion]: ambrus: Yeah - we're in that situation too, except that there is no time to do the reorganizing :-/
[LanX]: ... so my boss started a project with the newest sun servers and invited the traders to come on weekend to test it... and they were so pleased, that they forced him to keep it in production...
[ambrus]: Corion: sure, this is the long-term plan. The short term is that I have to run this ungodly mess to get results from the new input data today.
[Corion]: ambrus: Most of our "automation" is tied to process exit codes and a shell pipeline :-\
[LanX]: ... a week later they realized that one of the databases - which recorded how much the other banks due to this bank - was not correctly plugged
[ambrus]: Corion: I have no problem with exit codes and shell pipeline. My problem is that the current process requires a lot of manual intervention from me, including editing the source codes.
[ambrus]: (Also a lot of manual intervention by two or three other co-workers, who do other parts of the process.)
[ambrus]: Some of the manual part is unavoidable, but not all.
[choroba]: LanX was there a way to recover the numbers from the remaining information?
[Corion]: LanX: Ow ;)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (12)
As of 2017-03-29 11:55 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (350 votes). Check out past polls.