go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I actually ran into a similar need a little while ago, when I joined a project that had similar problems, only in php. Here is the program I wrote, adapted (poorly) for perl files. It's pretty apparent you'll never be able to accurately find all varibles and subs due to perl's free and easy syntax. The story follows below.
I joined this project that my friends (bad move number one) were working on. When they sat down to show me the code the familiar 'cold feeling of dread' swept over me. There were no comments. "Oh, that's OK", said friend #1, "the code is self explanatory" (ouch). "But you must have some comments in the code!" I exclaimed in a horrified voice. "Oh yes, we do. Look, just before each function declaration, there's a comment" (twitch). "And what about the variables?" "Oh, they're self explanatory" (whimper). I returned the next day armed with the program I linked to above, and ran it over their code. It revealed, amoung other horrors, that they were declaring the same function in different scripts (which worked together to run the website). "Guys, why do you declare the same function in different parts of the program?" "Well, when we were doing the new parts, we just cut and pasted the old functions, cause it was easier than worrying about making function libraries" (blackout) "but it's OK, when we change one we go through and change the rest" (suppresed scream) "How did you find out about the functions so fast?". "Oh, I wrote this program to go through your source and pull out all the functions and variables" "Oh excellent! Now we don't need a code map, we can just use your program!" --- Sorry to put you all through that, I just had to get that off my chest. It's actually the abridged conversation, since he spent half an hour trying to convince me that you didn't need documentation if you used descriptive names for the functions and variables, while I got more and more 'worked up'. This rant probably gives the wrong impression too, because he is my friend and I do like him, but I could find no way to convince him that documentation might be a good idea. I eventually volunteered for webmaster and spent the next three months updating the library's closing hours. I suppose the real joke is that that was his first job after graduating as a COMPUTER SCIENCE MAJOR.
____________________ In reply to What you want and perl advocacy gone way wrong
by jepri
|
|