Why X:: namespace for exceptions?
To prevent namespace conflicts with other classes and make exceptions easy to spot in code. X:: is a prefix already documented and used several places include Perl Best Practices. The ‘X’ allows it to stand for conteXt as well as eXception. Exceptions are not always errors. § The following, or equivalent, vim syntax hilighting macro makes spotting exceptions even easier. Add it to your ~/.vim/syntax/perl.vim: § syn match perlOperator “X\:\:[a-zA-Z:_0-9]*” § • Should I override new or initialize? That depends. Most will override new, but initialize is better when objects are going to be recycled and re-initialized rather than thrown away. § • Isn’t CLASS slower than __PACKAGE__ since it is a method? No because Perl optimizes it into a constant, just like __PACKAGE__. § • Can I just change the DECL or MIXIN hashes? No. Although perl will allow you do make changes to the DECL hash. It is a really bad idea.