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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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



budman
User

Apr 7, 2012, 7:56 AM


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

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


Code
# 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