|
Joined: Feb 2002
Posts: 2,286
Veteran
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
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
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
Joined: Nov 2000
Posts: 2,759
Pooh-Bah
|
Pooh-Bah
Joined: Nov 2000
Posts: 2,759 |
try word wrap in your text editor
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
I tried that - and whilst it improves things it is by no means any easier to read Ian
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
Joined: Aug 2000
Posts: 335 |
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.
|
|
|
|
Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
|
P.I.T.A. / Programmer
Joined: Sep 2000
Posts: 755 |
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
"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
|
|
|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
Joined: Aug 2000
Posts: 335 |
This is probably the utility I was thinking of: PerlTidy .
|
|
|
|
Joined: Mar 2002
Posts: 8
Junior Member
|
Junior Member
Joined: Mar 2002
Posts: 8 |
quote: Originally posted by Mark Badolato: 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
thats not REALLY hackish, more like 3 seconds
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
It might be 3 seconds to you - but I haven't a clue how to do that - any clues? Ian
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
Joined: Mar 2002
Posts: 8
Junior Member
|
Junior Member
Joined: Mar 2002
Posts: 8 |
[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
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
Thanks - I will give it a go....
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
Joined: Sep 2000
Posts: 4,211
Master Hacker
|
Master Hacker
Joined: Sep 2000
Posts: 4,211 |
I would do as Dave suggested and use Perltidy -- it'll do what you need.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 1,157
Joined: July 2001
|
|
Forums63
Topics37,573
Posts293,925
Members13,849
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|