note
tobyink
<blockquote><p><i>"In Perl it is not possible to create a private function like in Java or C++."</i></p></blockquote>
<p>It's not especially difficult...</p>
<code>
sub my_function {
croak "my_function is private" unless caller(0) eq __PACKAGE__;
# body of function goes here
}
</code>
<p>[mod://MooseX::Privacy] makes creating private and protected methods really easy (if you're already using Moose).</p>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-757127">
<small><small>
<tt>perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
</tt></small></small>
</div></div>
989115
989115