Perl At Underscore

So I am doing some work taking a lot of boilerplate code and moving it into a static or class subroutine.  And when I say boilerplate, I mean boilerplate to the extreme.  I'd say 99% of the subs in this code base have the same kind of code at the beginning.  (Function entry logging, arg counting, arg hash key verification, validation that $self is a ref)

One thing I learned along the way:

$self or (this in java) is not implicit in a Class like it is in java.  That means if you call a method from Class a within Class a, you still need to prefix it with $self->method().

Hmmmmmmmmmm.

See also http://www.netalive.org/tinkering/serious-perl/.

One other thing.  I ended up sending @_ to my new sub as a reference like this \@_.

Comments

Popular Posts