I often hear perl programmers say stuff like " We name private methods with a leading underscore, and we don't care what happens to people who call them from outside." and other stuff relating to not enforcing privateness in objects. I used to think this was a good thing, a benefit of perl, after all, if he really wants to do that, shouldn't he be able?
Thats completely missing the point though. The point of private methods and data *isn't* to enforce your "one true shape" on any programmer that tries to use it, the point is so that you can inherit from it without worrying about what the hell your parent class did.
Perl's object instance data is the main part that suffers from lack of privateness, anything you do in the child class with specifically affect the parent class, so if you want to use a specific key in your child hash, you'd better hope the parent doesn't, at any time, want to use this key! Sure theres some work arounds, but this is perl, we aren't supposed to have to take the long, unwieldy, verbose way to do stuff. It's supposed to be short, succint and to do what we mean.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|