Previous Thread
Next Thread
Print Thread
Rate Thread
#103636 03/25/2002 3:10 PM
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 wink at the moment - but expanding all the time....)
Sponsored Links
Joined: Nov 2000
Posts: 2,759
Pooh-Bah
Pooh-Bah
Offline
Joined: Nov 2000
Posts: 2,759
try word wrap in your text editor laugh

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 frown

Ian


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Aug 2000
Posts: 335
Member
Member
Offline
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
Offline
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
Sponsored Links
Joined: Aug 2000
Posts: 335
Member
Member
Offline
Joined: Aug 2000
Posts: 335
This is probably the utility I was thinking of: PerlTidy .

Joined: Mar 2002
Posts: 8
Junior Member
Junior Member
Offline
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 tipsy

#103643 03/30/2002 10:40 AM
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
It might be 3 seconds to you wink - but I haven't a clue how to do that - any clues? smile

Ian


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
#103644 03/30/2002 11:11 AM
Joined: Mar 2002
Posts: 8
Junior Member
Junior Member
Offline
Joined: Mar 2002
Posts: 8
[code][/code]man im forgetting perl shocked too much php lately
script.cgi has to be chmodded to 777 or has to be writeable and readable(666) at least

#103645 03/30/2002 12:24 PM
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 wink at the moment - but expanding all the time....)
Sponsored Links
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.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

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.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)