Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Here's one I deal with at my present job. This isn't a mistake by an intern, but production code relied on by many people. Instead of writing a module that you include into your code, system X was implemented as a program which reads in your code! You invoke it as system_X my_customization_code.pl Then system X reads in your file and evals it. But compilers don't know about comments, so comment lines are skipped:
Besides the foolishness of having things backwards, using eval on a string instead of on a file name means that when I debug code ( M-x perldb in emacs ), the system doesn't know where the source code is located and so cannot display it. But that wasn't enough for the villain who wrote this .... by skipping comment lines, the line number displayed by the debugger bears no relation to the actual line in the file. But I have found a way to beat the system, considering I cannot change the basic system X files. My include file is short, and requires other files, which contain my actual code. So the eval reads in the files which contain my real code, and the debugger works. For debugging purposes, I have my own copy of system X which does not skip over comments, since the Perl compiler can handle that without my help. -- In reply to Re: The joys of bad code
by TomDLux
|
|