That increases the surprise factor in the intersection cases: many
NiceSlice constructs are actually valid perl.
A more-needed approach is to implement better string handling --
currently the sourcefilter just punts on strings; this still causes
hilarity in my code from time to time.
The problem to be faced is that the perldl shell is meant to provide a
convenient extended-perl environment, while the PDL module is just
that - a perl module. So .pdl files are assumed to be, well, PDL
(NiceSliced) -- as a sop to Perl purists it is possible to turn off
NiceSlice on autoloaded files. If you wanted pure perl, you wouldn't
be using a kludge like perldl's autoload (which is meant to imitate
IDL/MatLab/you-name-it).
The problem here is that there is no one solution that will make
everyone happy. The status quo (of NiceSlicing autoloaded files iff
your command line is NiceSliced) seems to be the best (albeit uneasy)
compromise.
Real Perl modules and .pl files, of course, are not auto-NiceSliced.
On Jun 20, 2010, at 1:19 PM, Chris Marshall wrote:
> Another thought to enhance the NiceSlice processing
> would be to have a "conservative" mode option where
> the NiceSlice filter would not be used if the code
> being modified was already valid perl code.
>
> It would be more expensive to implement but might be
> a good trade-off. PPI could be the engine to drive
> this. It is being used in Devel::REPL on which the
> Perldl2 shell is built. I'll add it to the list of
> possible enhancements.
>
> --Chris
>
> On 6/19/2010 6:19 PM, P Kishor wrote:
>> I got the following funky error
>>
>> DBD::Pg::st execute failed: ERROR: syntax error at or near "->"
>> LINE 2: CREATE TABLE test.foo ->nslice(CHECK(yr=...
>> ^ at build_db.pl
>> line 452.
>>
>> The offending line in my script is
>>
>> 451>
>> 452> $sth = $dbh->prepare(qq{
>> 453> CREATE TABLE $table (
>> 454> CHECK ( yr = $yr )
>> 455> ) INHERITS ($schema.master_table)
>> 456> });
>> 457>
>>
>> Seems like PDL::NiceSlice is polluting the namespace and interfering
>> where it shouldn't. Adding 'no PDL::NiceSlice;' before the code, and
>> then toggling it back with 'use PDL::NiceSlice;' after the code does
>> the trick, but, to me, this reeks of danger. Shouldn't nslice only
>> work its magic when explicitly called? Otherwise, shouldn't it stay
>> out of the way?
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl