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:
Will the Exporter prevent someone from calling my private_method but still allow them to call the public_method?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 }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Private Class Methods
by dragonchild (Archbishop) on Apr 05, 2002 at 18:50 UTC | |
by perrin (Chancellor) on Apr 05, 2002 at 21:43 UTC | |
by RMGir (Prior) on Apr 06, 2002 at 14:27 UTC | |
(tye)Re: Private Class Methods
by tye (Sage) on Apr 05, 2002 at 22:32 UTC | |
Re: Private Class Methods
by japhy (Canon) on Apr 05, 2002 at 19:12 UTC | |
Re: Private Class Methods
by premchai21 (Curate) on Apr 05, 2002 at 18:46 UTC | |
Re: Private Class Methods
by Kanji (Parson) on Apr 05, 2002 at 19:22 UTC | |
Re: Private Class Methods
by ehdonhon (Curate) on Apr 05, 2002 at 18:52 UTC | |
Re: Private Class Methods
by pdcawley (Hermit) on Apr 06, 2002 at 18:55 UTC |
Back to
Meditations