Greetings, all.
I just read through the sections of PDL::Book and PDL::Tutorial that cover
PP, but I didn't see an example of conditional compilation of a pp_def. Is
this even possible using PP::Inline given the way the __END__ and __Pdlpp__
macros work? Is there a way to do this just using PDL::PP? I am uncertain
how to use 'raw' PDL::PP since the examples from PDL::Book and
PDL::Tutorial all use PDL::PP::Inline (unless I missed it!).
[code]
use PDL;
use Inline qw(Pdlpp);
my $cond = 0;
my $pdl = null();
# sometime later
if ($cond)
{
$pdl->say_hi();
}
# at the end of the script
if ($cond) # Perl generates an error here since it can't see the
closing brace
{
__END__
__Pdlpp__
pp_def('say_hi',
'Pars' => 'a(n)',
'Code' => q{ printf("%s\n", "Hello, world!"); }
);
} <--- The Perl parser can't see this brace, and PP generates an error
for unclosed brace.
[/code]
The principle reason I am looking for this functionality is to remove the
overhead of generating/compiling/linking the xs definition of say_hi unless
the function is actually needed at runtime.
Many thanks.
- Tim
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl