PDL::NiceSlice is very convenient in that it allows a more
natural array-style pdl element and slice addressing
syntax. The downside is that it's use of a perl source
filter makes "NiceSlice Perl" not valid Perl.
This can cause problems in two ways: (1) the NiceSlice
filter might modify a detect a plain perl construct as a
slicing one and filter the code instead of allowing it to
pass, and (2) perl runtime environments might not support
the use of source filters as indicated in the following
report below to the perldl mailing list.
For portability and robustness of PDL, it is needed
that the PDL core modules be as much portable perl
as possible. One possibility would be to remove
NiceSlice constructs from the PDL core sources in
preference for the ->slice() ones. That can be done
in the near term.
In the longer term, I propose that we add a
build-time NiceSlice processing step to the PDL
install process. The result of this would be the
same module files as currently, just that the
PDL::NiceSlice constructs would already be
source-filtered leaving "pure perl" only for the
blib/ install files.
On 9/23/2010 9:00 AM, Sacha Fouchard wrote:
> Hello everybody,
> This is my problem that could be interesting for many of you.
> When I try to use PDL in a prog source and create an executable with
> Activestate perlapp, I 've got the following error after compilation, at
> run time (The exe is correctly created).
> When I launch the prog, it says:
> syntax error at /<C:\prog.exe>PDL/MatrixOps.pm line 444, near "0:"
> syntax error at /<C:\prog.exe>PDL/MatrixOps.pm line 449, near "1:"
> syntax error at /<C:\prog.exe>PDL/MatrixOps.pm line 450, near "0:"
> syntax error at /<C:\prog.exe>PDL/MatrixOps.pm line 827, near "2:"
> For example, line 443 in MatrixOps.pm is :
> determinant( $a->(0:$i-1,1:-1)->append( $a->($i+1:-1,1:-1 ) ) );
> The pb seems to come from niceslicing syntax.
> But, if I run the prog directly under the shell, it works perfectly.
> What's happening?
> Try a prog with nothing but only "use PDL", compile it run, and see.
> I found 12 lines with problems in MatrixOps.pm.
> I use perl 5.10 x86 and the lastest PDL from CPAN (2.4.7) on win 7 x64.
> The problem was the same under vista 32 with perl 5.10 and PDL 2.4.6.
> Thank you all,