CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Re: [ChopperCharles] private and protected methods: Edit Log


Apr 7, 2012, 7:56 AM

Views: 5540
Re: [ChopperCharles] private and protected methods

So you do not want this to be inherited or used by anything else.

# create a class attribute 
my @myFriends = ( __PACKAGE__, "TacoBell" );

# change the unless statement in __foo to:
( my $object = (caller)[0] ) =~ s/.*:://;
unless ( grep { $object } @myFriends ) {
$m_LastError = "Access to private method denied. $object";
return -1;

Strange though, @ISA is pretty safe with inheritance.

Experienced Perl programmers have a lot of respect for each others logic and implementations. They know the limitations of the language and respect it and make it work. Just because objects can be accessed, or jail-breaked, or whatever, a majority if not all try to follow the best practice guidelines.

(This post was edited by budman on Apr 7, 2012, 8:05 AM)

Edit Log:
Post edited by budman (User) on Apr 7, 2012, 8:05 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives