Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: Re: Some suggestions on coding style - a chance to critique

by Juerd (Abbot)
on Jun 26, 2002 at 23:03 UTC ( #177579=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Some suggestions on coding style - a chance to critique
in thread Some suggestions on coding style - a chance to critique

Is this one of those awkward ways to write an if statement as in old-style C? What is the purpose of the ? 1 : 0?

It's the tenary operator. Very C-ish, yes.
The ? 1 : 0 isn't really needed here, as set() is only used in boolean context, but this clarifies the return value: true or false. Sometimes I write  !! $foo (double boolean negation), sometimes I write  $foo ? 1 : 0 , and sometimes just  $foo .

Finally, what do you have against CGI.pm? I'm looking for both reasons to use it and reasons not to use it. You obvioulsy have a strong opinion in one direction.

The short version:
It is slow (huge), has awful parsing (I just don't like it), a very annoying hybrid interface and too much junk code that is there for (backwards) compatibility. And it doesn't use strict, and has many globals.

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.


Comment on Re: Re: Re: Some suggestions on coding style - a chance to critique
Select or Download Code
Re: Re: Re: Re: Some suggestions on coding style - a chance to critique
by Fastolfe (Vicar) on Jun 30, 2002 at 04:55 UTC
    CGI::Lite is a speedier version you may find useful. Reinventing the wheel is fine if there's a need to do so. An awful lot of work and testing went into that wheel in the first place, though, so keep that in mind when you write your replacement. And please release it so the rest of us can take advantage of what you've done.

      An awful lot of work and testing went into that wheel in the first place, though, so keep that in mind when you write your replacement. And please release it so the rest of us can take advantage of what you've done.

      PLP is the result, and it's available for everyone to take advantage of (Note: it's an Apache handler - often not very useful in normal scripts). If you look at how parsing is done, you'll see why I re-invented this wheel. Not that CGI::Lite is bad or anything, I just wanted the data a bit different. I used CGI.pm in my reply because it was already used, and it was the only module I had installed at that machine, at that time.

      - Yes, I reinvent wheels.
      - Spam: Visit eurotraQ.
      

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://177579]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-12-27 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls