Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What concerns should I have if I use Smart::Comments in development code?

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>
like image 249
Christopher Bottoms Avatar asked Nov 23 '09 19:11

Christopher Bottoms


2 Answers

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.

like image 188
Sinan Ünür Avatar answered Oct 03 '22 15:10

Sinan Ünür


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.

like image 20
RET Avatar answered Oct 03 '22 13:10

RET