I was trying to implement a private class method in a little project I was working on. After thinking about the problem, I came up with the following solution:

package MyClass; use Exporter; use strict; use vars qw/ @EXPORT @EXPORT_FAIL /; @EXPORT = qw/ public_method /; @EXPORT_FAIL = qw/ private_method /; sub new { # bless reference ... } sub public_method { # ... do public stuff including calling private_method } sub private_method { # ... do stuff only class things should know }
Will the Exporter prevent someone from calling my private_method but still allow them to call the public_method?