in reply to Real private methods using lexical subs in Perl 5.18.
And while there certainly are ways around that, anybody playing those games deserves whatever they get: they’re breaking the law, and it isn’t worth trying to stop them. You’re just trying to stop accidents not nefarious break-ins, for which this is plenty good enough.if (caller ne __PACKAGE__) { confess "private method invoked" }
It also requires nothing more recent that v5.0 when Carp was introduced, nor lengthening the toolchain at all. There’s a lot to be said for simplicity.
|
|---|