Author Topic: perl interpreter question  (Read 5429 times)

0 Members and 1 Guest are viewing this topic.

Offline frister

  • album.pl Donor
  • album.pl Hacker
  • ****
  • Posts: 230
  • Karma: +42/-0
  • half baked ideas are better than none
    • fristersoft travelogue
perl interpreter question
« on: August 28, 2004, 21:16:40 »
Can anyone give me a clue on this?

I have to run all my perl and cgi scripts with
Code: [Select]
#!/usr/bin/perl -- or
Code: [Select]
#!/usr/bin/perl -w instead of simply
Code: [Select]
#!/usr/bin/perl
If I use the plain invocation (last example), I get "500 Internal Server Error"  :(

Thanks,
J.J.

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: perl interpreter question
« Reply #1 on: August 29, 2004, 16:45:07 »
That's weird... The -- means no more arguments, and the -w means enable warnings, but neither one should cause the program to work or stop working when removed...

Is it possible to run the script from a command shell without the arguments? That'll show what output there is...

Offline frister

  • album.pl Donor
  • album.pl Hacker
  • ****
  • Posts: 230
  • Karma: +42/-0
  • half baked ideas are better than none
    • fristersoft travelogue
Re: perl interpreter question
« Reply #2 on: August 29, 2004, 19:32:08 »
This is what happens when I remove the switches from the end of the interpreter invocation:

album_test.pl gives me all the expected html output on stdout.

wget http://fristersoft.mine.nu/cgi-bin/album_test.pl gives
Quote
--19:53:16--  http://fristersoft.mine.nu/cgi-bin/album_test.pl
           => `album_test.pl'
Resolving testweb.fristersoft.mine.nu... 192.168.0.5
Connecting to testweb.fristersoft.mine.nu[192.168.0.5]:80... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
19:53:16 ERROR 500: Internal Server Error.
Then I look in the server's error_log and see
Quote
[Sun Aug 29 20:21:43 2004] [error] [client 192.168.0.5] (2)No such file or directory: exec of '/var/www/cgi-bin/album_test.pl' failed
[Sun Aug 29 20:21:43 2004] [error] [client 192.168.0.5] Premature end of script headers: album_test.pl

It's almost as if perl is by default running with a -e switch. Could that be?

J.J.

Offline frister

  • album.pl Donor
  • album.pl Hacker
  • ****
  • Posts: 230
  • Karma: +42/-0
  • half baked ideas are better than none
    • fristersoft travelogue
Re: perl interpreter question
« Reply #3 on: August 30, 2004, 06:42:17 »
Never mind.  ::) It was a dos2unix problem. I'd been writing all my scripts on a wintel machine and then copying them to the web server via a samba share. I figured this out after downloading and installing perldigger directly on the server and noticing that it worked whether I used switches or not.

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: perl interpreter question
« Reply #4 on: September 02, 2004, 06:43:34 »
Heheh, glad it was sorted out... :D