Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Unusual Syntax

Quote Reply
Unusual Syntax
I just noticed this in nph-build.cgi

Code:
if (chmod ($build_dir_per, "$build_root_path$path")) {;
print "Done.";
}
Is the red bit a typo?
I've never seen that type of syntax before.

Should it not be:

Code:
if (chmod ($build_dir_per, "$build_root_path$path")) {
print "Done.";
}
??

Installs:http://wiredon.net/gt
FAQ:http://www.perlmad.com

Quote Reply
Re: Unusual Syntax In reply to
Does it work without the ; ?

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: Unusual Syntax In reply to
Dunno not tried.

Installs:http://wiredon.net/gt
FAQ:http://www.perlmad.com

Quote Reply
Re: Unusual Syntax In reply to
Yeah, I found something like that a few months back in the same file I believe, except that it was a ':' instead of a ';'.

Later,
Paul

http://www.fullmoonshining.com for Pearl Jam Fans
Quote Reply
Re: Unusual Syntax In reply to
If you can find that code again I'd be interested to see that also.

Installs:http://wiredon.net/gt
FAQ:http://www.perlmad.com

Quote Reply
Re: Unusual Syntax In reply to
Actually now that I look at it I'm not sure that it's an error. I'm not in Linux right now so I can't test it. This section of nph-build and the build_all sub

$use_html ?
print qq|<html><head><tittle>Links Manager: Building Pages</title></head>
<BASE TARGET="_top">
<BODY BGCOLOR=#FFFFFF><H2><TT>Building Pages</TT></H2>
<PRE>| :
print qq|Building Pages\n|;


I'm not sure if a semicolon is needed after the | because this section is using the conditional operator ? :. I don't know picky perl is at it's syntax. Basically what I originally thought was that a semicolon was needed before the : (marked in red), but now I don't think it matters. It's been a long time since I looked at it so I probably didn't take into account the conditional operator back then. Sorry for the confusion.

Later,
Paul



http://www.fullmoonshining.com for Pearl Jam Fans
Quote Reply
Re: Unusual Syntax In reply to
Hi,

Yes that part is correct.

Installs:http://wiredon.net/gt
FAQ:http://www.perlmad.com

Quote Reply
Re: Unusual Syntax In reply to
Yeah, back when I first noticed it I didn't relize it was a tenary operator so that's why I thought it was wrong in the first place. Glad you brought it up because it made me go back and look at it. Thanks, I thought it was correct. Perl is funny sometimes.

Later,
Paul

http://www.fullmoonshining.com for Pearl Jam Fans