Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: POD using __END__ with function commentsby zerohero (Monk) |
on Feb 24, 2009 at 21:14 UTC ( [id://746105]=note: print w/replies, xml ) | Need Help?? |
>> Approach with auto-copying looks somehow strange for me. Do you suggest to move function descriptions to the end of the file before closing and move them back just after opening? It doesn't make sense. If you do not plan to move descriptions back, then why not to place them in the end of the file since beginning? No, rather that one can run an autogenerate function which would produce "=item somefunctionname (arg1, arg2) in the correct place (METHODS) in the __END__ POD section. There is no need to move anything back. The problem I'm trying to solve is to have a simple editing trick that helps me keep the now two areas synchronized (METHOD and actual functions). A split screen helps, but is no longer helpful when you have a ton of functions. For example, try finding the new one that has no documentation...again, you must scroll through things. This is one of the benefits of colocating function and documentation, because it's obvious when you haven't documented. However, when you have a lot of documentation intermixed with the code, it interrupts your looking at the logic. Comments do nothing to enhance the running of the code. While they help you to understand the code, there are "in code" comments and comments that are safely left elsewhere. Putting the bulk of comments with the code just makes it harder to debug. Regardless of which editor you use and which approach, you incur some amount of busiwork while editing when you have lots of inline comments. Folding requires clicking on +/-. Searching requires jumping over false hits in the docs. Again I find _most_ of the long documentation that I write is for other people, and I only need the briefest of reminders (perhaps _no_ docs) in with the functions. If a comment _is_ amongst the code, I've put it there to explain something obvious, or to help split up the logic of a big function (e.g. describe what happens in this stage). But these are _internal_ comments (about the implementation, for the maintainer), not _external_ comments (for the user of the library). Also I wasn't thinking of making this an editor script (emacs, vim), but that does make some sense. I was thinking of something you executed (perhaps during build), which altered the POD. The simplest example might be auto generated function signature in the METHODS section in the __END__ POD. Imagine code that could iterate through the methods, and then intelligently put at least the function name, and argument names at the end. The issue is really maintenance. Of course you can split the editor and look at both places, but wouldn't you rather something tell you you need to fill in info for a new function (this is essentially what pod-coverage.t in Module::Install does...it finds functions you don't have descriptions for). So I'm really looking for some sort of perl-ish forward generator of part of the POD. Note that pmtools has something that finds all the functions in a module (but if you do "use" which everyone does, then it "pollutes" the namespace, and makes it hard to tell what is a native function and what is not. So there are tools that do some types of auto-inspection, which could be looked at to see how this is done. But note you'd have to adhere to some conventions for it to work.
In Section
Seekers of Perl Wisdom
|
|