Coding Guidelines/Perl Pitfalls

From wiki.zmanda.com
Jump to navigation Jump to search

Perl is great, and perl is wonderful, but it will drive you mad.

Perl-5.6.0 is old!

The features you're used to may not be present in Perl-5.6.0. Check before you use something new.

BigInt's stringification used to be terrible

Somehow, this only seems to affect tests, but it affects them seriously, since almost every SWIGged function returns a BigInt. You'll usually want to cast bigints into strings and then on to integers in unit tests, especially when using is_deeply.

Don't use IO::Socket or Socket

These modules have a documented thread-safety problem in their handling of file descriptors on Solaris 8, which can lead to nasty race conditions and obscure failures. Usually, the transfer architecture can do what you need. If not, you'll need to avoid working with filehandles and SWIG whatever socket-related functions you need.