I am working on a little Perl module and for some reason I had the test driver script that was using my new module call one of the functions that I thought would be private,
We can write some thing below in the perl private function to check whehter the call from the same obj as caller[0] gives package.
caller[0]
sub foo { my ($s, %args) = @_; die "Error: Private method called" unless (caller)[0]->isa( ref($s) ); }