Well, I've read up a little on Python (easy, easy... I didn't come here to start a langauge war), and one thing I've noticed a lot in their teachings, is in files that are meant for including in other files have a little something at the bottom of the code that goes something like:
(elaboration '(the young monk is easily excited) '(I would like to be able to do this with perl as well as Python. The solution...)) I would guess it would be one of:if __package__ eq __main__: # do stuff to test to see if package is working.
However, I am sure all of those are flawed. I am also sure t here is a better way to "emulate" what Python programmers do in perl. For those of you unfamilure with this proramming practice, it is done so each portion of a project can be tested indepedandtly. However the same code that tests it, does not get ran when it is included. Now, as far as I am concerned running:if($main == "hardcoded::package::name") { } if($main == $PROGRAM_NAME) { } if($main->isa("hardcoded::package::name")) { }
As that is just messy. This would make debugging my stuff a lot easier. Thank you kindly$debug && print "some code"; $debug && print "some more code"
In reply to Self Testing Modules by Sheol
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |