[Omaha.pm] Fwd: potential pitfall with "return undef"

Jay Hannah jay at jays.net
Tue May 30 17:54:48 PDT 2006


Oops! I "return undef;" ALL THE TIME...

Ponder,

j


-------- Original Message --------
Subject: [Bioperl-l] For CVS developers - potential pitfall with "return	undef"
Date: Tue, 30 May 2006 18:18:45 +1000
From: Torsten Seemann <torsten.seemann at infotech.monash.edu.au>
Organization: Victorian Bioinformatics Consortium, Monash University
To: bioperl-l at lists.open-bio.org

FYI Bioperl developers:

I just audited the bioperl-live CVS and found about 450 occurrences of 
"return undef".

Page 199 of "Perl Best Practices" by Damian Conway, and this URL
http://www.perl.com/lpt/a/2006/02/23/advanced_subroutines.html suggest:

"Use return; instead of return undef; if you want to return nothing. If 
someone assigns the return value to an array, the latter creates an 
array of one value (undef), which evaluates to true. The former will 
correctly handle all contexts."

So I'm guessing at least some of these 450 occurrences *could* result in 
bugs and should probably be changed.

Your opinion may differ :-)

-- 
Dr Torsten Seemann               http://www.vicbioinformatics.com
Victorian Bioinformatics Consortium, Monash University, Australia

_______________________________________________
Bioperl-l mailing list
Bioperl-l at lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/bioperl-l


More information about the Omaha-pm mailing list