Hi,
I have just been given a long script that for some reason is all in one line.
It makes reading of it almost impossible.
Is there any way to change this to be over many lines?
I am not that familiar with cgi scripting, but will I break the script if I break the lines in the wrong place.
Regards,
Ian
try word wrap in your text editor
I tried that - and whilst it improves things it is by no means any easier to read
Ian
Line breaks in Perl are ignored (unless they're in the middle of a quoted string, identifier, etc.), so you shouldn't have any problems splitting it up onto multiple lines.
A script I downloaded was formatted the same way. I suspect the author did it intentionally to discourage people from making changes to it.
I thought I saw a utility for automatically reformatting a Perl script, but can't remember where.
[edit]
Hmmmm ...
When you say it's one line, are there embedded line feed characters visible? That could happen if you try to view a Unix-formatted text file in Notepad on windows. If that's the case, try using Wordpad or another text editor which handles the different line terminators correctly.
You could always try a REALLY hackish thing like loading the script into a variable then have perl parse to add linefeeds after each semicolon
This is probably the utility I was thinking of:
PerlTidy .
It might be 3 seconds to you
- but I haven't a clue how to do that - any clues?
Ian
[code][/code]man im forgetting perl
too much php lately
script.cgi has to be chmodded to 777 or has to be writeable and readable(666) at least
Thanks - I will give it a go....
I would do as Dave suggested and use Perltidy -- it'll do what you need.