It's a contract. And you should write the contract.
When you build your class, and if you expect anyone elses application to ever instantiate objects of your class, you must provide the proper documentation. (Having said that, it's always good to provide the docs, even if it's only to simplify your own life n months later. ;-)
The contract is your own POD. Provide a POD for the module, inside your module and also deliver it together with the module.
Anyone that is going to use your module should follow your contract. In your contract you state that "If you use this method, that will be the result". For those that do not respect the contract (and some will try to violate it) the only thing you can say to them is "tough luck" when they complain that your latest release of your module brakes their application. (Assuming that you stick to your own contract. ;-)
OTOH, if you do provide what I call a contract, you are free to make any changes to the internals of your object, as long as the module interface (that you promised in your contract) doesn't change. If you need to change the interface, you might need to re-negotiate it, all depending on your situation. For instance, is this an in-house module where youre business relies on it's behavior, etc.
There's no way you can make sure that no one can access the internals of your module. Not in Perl, neither any other programming language that I'm aware of. Produce a class in C++, compiled and distributed in it's binary form, and anyone with enough skills can manipulate the properties of your object. Crackers do it all day long with a binary editor/debugger.
Everything went worng, just as foreseen.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||