NAME

Inline::Pdlpp - Write PDL Subroutines inline with PDL::PP

DESCRIPTION

Inline::Pdlpp is a module that allows you to write PDL subroutines in the PDL::PP style. The big benefit compared to plain PDL::PP is that you can write these definitions inline in any old perl script (without the normal hassle of creating Makefiles, building, etc). Since version 0.30 the Inline module supports multiple programming languages and each language has its own support module. This document describes how to use Inline with PDL::PP (or rather, it will once these docs are complete ;).

Usage of Inline::Pdlpp in general is similar to Inline::C. In the absence of full docs for Inline::Pdlpp you might want to compare Inline::C.

Code that uses external libraries, etc

The script below is somewhat more complicated in that it uses code from an external library (here from Numerical Recipes). All the relevant information regarding include files, libraries and boot code is specified in a config call to Inline. For more experienced Perl hackers it might be helpful to know that the format is similar to that used with ExtUtils::MakeMaker. The keywords are largely equivalent to those used with Inline::C. Please see below for further details on the usage of INC, LIBS, AUTO_INCLUDE and BOOT.

Pdlpp Configuration Options

For information on how to specify Inline configuration options, see Inline. This section describes each of the configuration options available for Pdlpp. Most of the options correspond either to MakeMaker or XS options of the same name. See ExtUtils::MakeMaker and perlxs.

AUTO_INCLUDE

Specifies extra statements to automatically included. They will be added onto the defaults. A newline char will be automatically added. Does essentially the same as a call to pp_addhdr. For short bits of code AUTO_INCLUDE is probably syntactically nicer.

BLESS

Same as pp_bless command. Specifies the package (i.e. class) to which your new pp_defed methods will be added. Defaults to PDL if omitted.

use Inline Pdlpp => Config => BLESS => 'PDL::Complex';

BOOT

Specifies C code to be executed in the XS BOOT section. Corresponds to the XS parameter. Does the same as the pp_add_boot command. Often used to execute code only once at load time of the module, e.g. a library initialization call.

CC

Specify which compiler to use.

CCFLAGS

Specify extra compiler flags.

INC

Specifies an include path to use. Corresponds to the MakeMaker parameter.

use Inline Pdlpp => Config => INC => '-I/inc/path';

LD

Specify which linker to use.

LDDLFLAGS

Specify which linker flags to use.

NOTE: These flags will completely override the existing flags, instead of just adding to them. So if you need to use those too, you must respecify them here.

LIBS

Specifies external libraries that should be linked into your code. Corresponds to the MakeMaker parameter.

use Inline Pdlpp => Config => LIBS => '-lyourlib';

or

use Inline Pdlpp => Config => LIBS => '-L/your/path -lyourlib';

MAKE

Specify the name of the 'make' utility to use.

MYEXTLIB

Specifies a user compiled object that should be linked in. Corresponds to the MakeMaker parameter.

use Inline Pdlpp => Config => MYEXTLIB => '/your/path/yourmodule.so';

OPTIMIZE

This controls the MakeMaker OPTIMIZE setting. By setting this value to '-g', you can turn on debugging support for your Inline extensions. This will allow you to be able to set breakpoints in your C code using a debugger like gdb.

PDL::NiceSlice and Inline::Pdlpp

There is currently an undesired interaction between PDL::NiceSlice and Inline::Pdlpp. Since PP code generally contains expressions of the type $var() (to access piddles, etc) PDL::NiceSlice recognizes those incorrectly as slice expressions and does its substitutions. For the moment (until hopefully the parser can deal with that) it is best to explicitly switch PDL::NiceSlice off before the section of inlined Pdlpp code. For example: