[Melbourne-pm] nearly there...

Craig Sanders cas at taz.net.au
Wed Dec 19 23:26:58 PST 2007

On Thu, Dec 20, 2007 at 05:28:06PM +1100, Mathew Robertson wrote:
> > only if they can't read perl.
> >   
> nobody can read Perl... :)

lots of people can.  it's kind of a requirement for writing it well.

> except that using your http example, you can't parse url arguments
> (without escaping) 

1. i wouldn't. using regexps to parse CGI args is a bad idea. that's
what CGI or any one of several other CGI arg parsing modules are for.

2. for the sake of the argument, if i were to be writing a Q&D hack
to do that, i would (as i mentioned in my previous msg) use another
separator. '|', perhaps. or maybe '-'.  or something.

depends.  my personal aesthetic says if i have to escape a character
more than once or twice then use a different separator.

> and the ugliness-factor would but much worse.  Perl
> POD often uses '!'... maybe that is a good character to use?

or '!', even if it does feel a bit over-excited.  B1FF-mode regexps.

> >> Use curly braces instead:
> >
> > i find that ugly inside regexps, and don't/won't do it. curly braces
> > are for hashes or code blocks etc, not for uglifying regexps.
> >
> > i'll use pretty nearly anything else before i'll use them.

also, curly braces have a meaning inside regexps - they're for
specifying the number of times to match.  

    {n}?   Match exactly n times
    {n,}?  Match at least n times
    {n,m}? Match at least n but not more than m times

i use them all the time, especially the latter two forms.

> > YMMV, but to me, that is significantly less readable.
> The POD contains many references where using balanced brackets is a
> good thing - it would be only you that considers them ugly.

1. what can i say?  i have good taste where some others don't :-)

(and i don't consider all curly braces ugly - just using them as regexp

2. POD has such examples inside regexps?


craig sanders <cas at taz.net.au>

I could never learn to like her -- except on a raft at sea with no
other provisions in sight.
		-- Mark Twain

More information about the Melbourne-pm mailing list