How do I make private functions in a Perl module?

前端 未结 9 965
后悔当初
后悔当初 2020-12-23 20:43

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,

9条回答
  •  甜味超标
    2020-12-23 21:02

    What are you trying to do? Maybe there is a better Perl way of doing whatever you are trying to accomplish.

    For instance, if you don't want people mucking around in your objects because you want to enforce encapsulation, you can use something like Class::InsideOut. That module has a Class::InsideOut::About documentation module that explains the concept. There is also Object::InsideOut, which Brian Phillips already mentioned.

提交回复
热议问题