!0
mirod
mirod at xmltwig.com
Fri Feb 13 09:53:09 GMT 2009
Nicholas Clark wrote:
> Also, said authors like the style q{}.
>
> I don't see what the advantages of it are. I can see two disadvantages
>
> 1: It's one more character of typing over the "obvious" ''
> 2: My brain triggers on "q" constructs, and treats them as something
> interesting, exceptional, and worthy of note. It's annoyed when it turns
> out that it's nothing more than a non-interpolating string, and regards
> such use of q{} as an irritating distraction, which may cause it to miss
> something nearby that is worthy of note.
I actually like that style, especially when dealing with code that deals with
strings that include quotes, like HTML/XML tags.
compare (real code, not mine):
print "<meta name=\"robots\" content=\"noindex,nofollow\"$endtag\n";
with
print qq{<meta name="robots" content="noindex,nofollow"$endtag\n};
I find the second form much easier on the eye, and if the program includes a few
of those I will happily use qq{} on all strings.
And before the clean code police arrests me, that would only be if there are not
enough of those to warrant factoring out tag generation into separate functions.
Pfew! that was close...
--
mirod
More information about the london.pm
mailing list