Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Documenting non-public OO components

by petdance (Parson)
on Sep 09, 2005 at 00:44 UTC ( [id://490383]=note: print w/replies, xml ) Need Help??


in reply to Documenting non-public OO components

Pod::Coverage gives you ways to specify that certain methods are internal (and Test::Pod::Coverage will pass them in, too). The easiest way, and the one I wholeheartedly endorse, is to simply prepend your internal methods with an underscore. Then you don't have to do ANYTHING.

There is no clearer way to tell the caller "hands off this method!"

xoxo,
Andy

  • Comment on Re: Documenting non-public OO components

Replies are listed 'Best First'.
Re^2: Documenting non-public OO components
by creamygoodness (Curate) on Sep 09, 2005 at 01:29 UTC
    What about methods, typically called "package" or "protected", which are not part of the public API, but must be called by other classes that are part of the distro? Those should not have leading underscores, IMO, because it contradicts standard practice. From perlstyle:

    You can use a leading underscore to indicate that a variable or function should not be used outside the package that defined it.

    The Pod::Coverage problem is solvable with minimal effort, as both you and xdg have pointed out (thanks). However, there is still the need to document these methods while indicating clearly that they are not available to users.

    There seems to be a range of opinion on as to the best solution. The ones that I like best for this project at least are the ones closest to javadoc, but I can appreciate the merits of the document-by-test and the bury-private-docs-deeply schools as well.

    --
    Marvin Humphrey
    Rectangular Research ― http://www.rectangular.com
      =head1 Public methods =head2 $obj->wango =head2 $obj->doofus =head1 Internal-only methods =head2 $obj->whatever

      xoxo,
      Andy

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://490383]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-18 07:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found