Conditional Compile like C

Posted by on 2016-07-29 06:01
Forums: PDK Support | OS: All / Any

I cannot find any thing like conditional compile.

In C you can define a parm like -DTEST, and in the program use

#if defined #TEST
use FB::CommonDefs
use CommonDefs

Is this kind of thing supported in PerlApp?

I may have the syntax wrong as it has been years working with C.

ActiveState Staff
Fri, 2016-07-29 08:23

Perl scripts can be "aware" of conditions set inside the Perl C binary, as above, but PerlApp/Wrapping must work above the Perl layer, so it's a lot harder for the script to be aware of being wrapped. (In general that's a bad outcome since it's undesirable for a script to behave differently when wrapped.)

It's also a lot harder to script special behavior for a wrapped condition since the wrapped condition can't exist until after you finish coding.

There are a few special variables that are available only when a script is wrapped:
and some things which are normally available, that are not available when wrapped:
That's about the limit of what you can use, so you have to be creative.