Miscellaneous > Programming & Networking

perl training wheels

<< < (8/8)

beltorak0:
here's a little tip to help when you don't have access to the server logs:

--- Code: ---
--- End code ---

this will (as indicated) send fatal server errors to the browser as well as the error logs (provided they have the CGI/Carp module installed).

hope this helps with future troubleshooting.

-t.

Calum:
useful information indeed. i will be remembering that.

Voidmain i am a bit clueless as to why this might be happening because i am writing my text file using emacs in linux! i haven't performed that operation that you suggest, i really need to brush up on the use of things like od and tr!

As i write this i am testing this out at home, and still do not have apache configured right. However my question really is, that the tutorial i am doing does not say that apache must be installed and has not in fact mentioned anything of this sort. edit:- sorry, just getting confused, i am attempting to make it work without needing to call perl, not attempting to serve it over the net.

Still, i'm not stumped yet, i'll keep fiddling and see what happens...

edit: thank the gods for shell accounts! i just typed the above <STDIN> file in my Grex account, did a chmod +x, and ran it using ./1stperlscript.pl and hey presto it does exactly what it is supposed to do! without needing to invoke 'perl' on the commandline. Now i just need to get it to work at home. i must be overlooking something simple...

[ September 30, 2002: Message edited by: Calum ]

Master of Reality:

quote:Originally posted by void main:
The best solution is not to use that nasty icky Windows to write your Perl code. But you can strip the CRs by:

$ tr -d '\r' < sample.pl > unixsample.pl
$ mv unixsample.pl sample.pl
$ chmod +x sample.pl
$ ./sample.pl

You may also have a utility called "dos2unix" installed on your system that does the same thing, or you can download that utility and install it. It's just a tiny utility which will strip the CRs from a file. With my example using the "tr" command you need to make sure the file you are redirecting to is a new file and don't use the same file name for both input and output, then of course you will have to set the executable bit on that new file before you run it and replace the original file with it. The dos2unix utility does all of this automatically.
--- End quote ---

dos2unix works great. I had to use it onmy messageboard scripts.

voidmain:
Calum, the only thing that bugs me is the bash error message "not a directory" that you claim to be getting. If you are trying to run a DOS formatted Perl script you should get a bash error that looks like this:


--- Code: ---
--- End code ---

But your "bad interpreter" message definately indicates that the first line in your Perl script is f00ked.  It either doesn't match the location of your perl executable or you have a '\r\n' where there should be a '\n' as I mentioned in the previous post.  Did you follow my message step by step and do the "which perl" and do the "od" commands?  If so I want to see the output from both of those commands.

Navigation

[0] Message Index

[*] Previous page

Go to full version