in reply to Re^2: How to retrieve the name of a variable ?
in thread How to retrieve the name of a variable ?

The main reason not to use Smart::Comments is that it's a source filter: it changes the code of your program between when perl loads and when your program compiles. (Or while your program compiles.) This can introduce bugs or unintended effects which would be very hard to debug.

Of course, it's a well-written module and has been used by many without that happening, but the possibility still exists. Your choice if you want to take the risk.

  • Comment on Re^3: How to retrieve the name of a variable ?

Replies are listed 'Best First'.
Re^4: How to retrieve the name of a variable ?
by mascip (Pilgrim) on Jul 19, 2012 at 15:38 UTC

    Thank you !
    I decided to not use any source filters unless if really needed, as i wouldn't know how to debug it. I guess that you'd need to use B::Deparse? (which re-builds perl code, form the compiled code, so you can see what has been effectively executed). I prefer just not taking the risk right now.

    Smart::Comments also redirects all the information it provides to STDERR, which is not displayed on the standard output, under Test::NoWarnings.
    See there why i use Test::NoWarnings : 0==undef, that's annoying. Is it?.

Re^4: How to retrieve the name of a variable ?
by clueless newbie (Curate) on Jul 20, 2012 at 11:12 UTC
    One could follow the "use Smart::Comments;" with something like "Filter::tee __PACKAGE__.'.tee';" and examine the results in the event that something funky happens.