Perl on egon

software development

#1

I’m having major problems with all my perl scripts on egon?

Has anything changed to the perl installation?

The server can’t write to the error log file either. It keeps writing:

failed to open log file
fopen: Permission denied

in my error logs.

Cheers

Wil


#2

Hey, wil…

You might have already checked this, but I got the same “permission denied” thing earlier today… and realized mine was from pilot error.

I’d been uploading a mix of CGIs, HTML and images, and had forgotten to switch back to ASCII mode before uploading the last CGI.

I still do that sometimes.

…Bob W.


#3

No, it’s not that Bob. Thanks for the reply, anyway! :slight_smile:


#4

My pleasure…

I just know that I hate it when stuff like that happens!

I’d be interested to know what the final diagnosis is…

…Bob W.


#5

OMG! You know what the problem was in the end? Took me two solid days to find this one! I had incorrectly written the unix shebang line as:

#/usr/local/bin/perl

instead of

#!/usr/local/bin/perl

I forgot the ! mark and of course the system didn’t have a clue what kind of file I was trying to execute. .

That took me absolutely ages to find thaat one! I was convinced it was a perl error because the script was simple enough. :-\

Wil


#6

Wil -

Don’t feel bad. I’ve been there before. Exact same issue, in fact. Made me realize it was time to get out and do something other than code for a few hours. :>

Did you send that one to tech support? I used to train some of our earlier support techs, and that’s one of the problems I usually told them to check for (it happens more often than you’d think).

  • Jeff @ DreamHost
  • DH Discussion Forum Admin

#7

ERGH!!

Like I said, I hate it when I do stuff like that!

I know how klutzy I can be-- that’s why I always copy and paste lines like those from my older scripts.

chuckle

…Bob W.


#8

Hiya Jeff

I didn’t send that exact script, no. I pointed Tech Support towards a few on egon which I thought were problematic.

I’ve never encountered that problem before, though! Really funny looking back at it. It was only 13 lines of code that script! .

You’re right, it is amazing that. I was stuck to my computer for 10-14 hours coding the other day and could not crack that. I went out to the gym, came back with a clear head and bingo!

Cheers

Wil


#9

10-14 hours will do it.

What I generally do when debugging Perl scripts is this:

  1. Run it from the command line.

  2. If it works, it’s usually a permissions issue, the script is outputting malformed HTTP headers, or that first line is wrong.

  3. If it doesn’t, it usually prints out the line the error is on. In which case, slap your forehead, fix the bug, and proceed.

Repeat, ad infinitum… :>

Sometimes when you become an accomplished coder, you skip the most obvious stuff and assume it’s something more nefarious. I know I do.

As they say in the medical field, when you hear hoofbeats, think horses and not zebras. :>

  • Jeff @ DreamHost
  • DH Discussion Forum Admin

#10

Jeff

Yes, that’s exactly my problem. I usually think it’s much more of a complex error where I’ve written my regex wrong. But it’s usually just a missing parthenses or the lack of a semi-colon at the end of line.

.

To debug, I usually run them through the command line too. I usually try and execute the file, via

./script.pl

and I run it through the Perl syntax checker,

perl -c script.pl

I always run my code using -W or (-w for more complex ones ) and use strict;.

To figure this one out… I downloaded ActivePerl for Win32 which forced me to change the shebang line to c:/perl/bin/perl and then the code executed fine. I then manually re-wrote the shebang and moved it back to my linux box and then that’s where that little dog jumped up and barked “bingo”! .

I’ll know from now on. I’ve just never encoutered such an error in years of programming, because I usually just cut and paste the first few lines of code containing copyright information and what-not anyway.

Ah well, back to work. I’ve ordered myself a brand spanking new machine today - well the parts anyway. Have to go out and buy a miditower and a motherboard to put the thing together over the weekend. :-))

Cheers

Wil