in reply to Macro in perl code?
perl -MO=Deparse,-x,-p -e 'sub verbose() { 0 } print "guggug!\n" if ve +rbose;' sub verbose () { 0 } '???'; -e syntax OK
perl -MO=Deparse,-x,-p -e 'sub verbose() { 0 } if(verbose){ print "gug +gug!\n"};' sub verbose () { 0 } '???'; -e syntax OK
The '???'; statements stand for bits of code that have been optimized away; those will have no impact on performance. If the compiler sees such a constant returning sub it can perform optimizations, eliminating code blocks whose execution is bound to the value of that constant.
Besides, before shoehorning a perl script through m4, I'd rather look - though discouraged - at perl's -P switch. See perlrun.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Macro in perl code?
by pileofrogs (Priest) on Oct 16, 2007 at 20:32 UTC | |
by shmem (Chancellor) on Oct 16, 2007 at 20:58 UTC | |
by pileofrogs (Priest) on Oct 16, 2007 at 23:45 UTC | |
by Krambambuli (Curate) on Oct 17, 2007 at 07:18 UTC | |
by shmem (Chancellor) on Oct 17, 2007 at 08:53 UTC | |
by Krambambuli (Curate) on Oct 17, 2007 at 09:21 UTC | |
by pileofrogs (Priest) on Oct 17, 2007 at 16:01 UTC | |
|