I understand that Smart::Comments should not be used in production code, since it is a source filter.
However, I have been using Smart::Comments
in my development code and then commenting out the "use" line before sending the code to production.
Given that I'm going to use it in my development code, what I should specifically be concerned about? I've searched the Internet and not found any reasons that I should be worried except that source filters are "a bad idea" or "evil" or that they should never be used in production code.
UPDATE: I'm now using a key binding in vim to implement Sinan Ünür's approach:
map <Leader>c <Esc>:!perl -MSmart::Comments %<CR>
I prefer not to put:
use Smart::Comments;
in my code. When I do indeed use Smart::Comments
, I invoke the script using:
$ perl -MSmart::Comments test.pl
This way, there is no chance Smart::Comments
will be used in production code.
I'm a huge fan of Smart::Comments, and it is called throughout our code, development and production copies. I rarely use it for progress-bars, mostly for assertions and debug output.
However, the practice is to pull it in using the form:
use Smart::Comments -ENV;
If the environment variable Smart_Comments is not set, Smart::Comments is completely inert.
Best of both worlds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With