perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ludwig <mil...@gmx.de>
Subject Re: Getting a / when regex should produce nothing
Date Mon, 26 Apr 2010 18:58:41 GMT
André Warnier schrieb am 26.04.2010 um 10:22:18 (+0200):

> $article_file = $q->param("articlefilename");

> $article_file = $q->param("articlefilename") || '';
> does not add much technically

True, but no benefit either, other than telling the reader that the
empty string is your default value, which would have also been Perl's
default value. It could also be something differing from the Perl
default:

  $article_file = $q->param("articlefilename") || get_dflt_article_name;

> But it makes *explicit* what you are doing, which makes the difference
> to someone maybe not as fluent in perl and who has to look at that
> code in a year's time.

Okay, that's right. On the other hand, PHP works just like Perl without
explicit 'uninitialized' warnings, and I guess this PHP trait is mostly
thought of as a feature. (Which it is.)

> It is on the other hand perfectly ok in my view for a perl guru to
> write perl modules using whatever clever techniques and idioms suit
> him, as long as the module does what it claims to do.  And as long as
> (preferably) any section of such code comes with ample internal
> documentation explaining what it does and what it relies on.

I think that's the important part: document the intent.

-- 
Michael Ludwig

Mime
View raw message