Bugs item #3018731, was opened at 2010-06-20 10:21
Message generated for change (Comment added) made by marshallch
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100612&aid=3018731&group_id=612

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: other
Group: feature request
Status: Open
Resolution: None
Priority: 3
Private: No
Submitted By: punkish (punkish)
>Assigned to: Chris Marshall (marshallch)
Summary: NiceSlice affects code where it should not

Initial Comment:
I got the following 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>

I was creating several tables where $table would be filled in before executing 
the statement, but NiceSlice's source filter changed the code causing the 
error. The error goes away if I precede the above code with 

no PDL::NiceSlice

The solution is well-documented, but given that I have several different 
fragments of code that both use NiceSlice and get adversely affected by it, to 
me NiceSlice doesn't seem worth the trouble. I have to learn a syntax no matter 
what -- I may as well learn the regular slicing syntax instead of tinkering 
with NiceSlice, as my program is now littered with pairs of 'no 
PDL::NiceSlice/use PDL::NiceSlice'.

My env.

Mac OS X 10.6.4
perl 5.12.1
PDL 2.4.6

----------------------------------------------------------------------

>Comment By: Chris Marshall (marshallch)
Date: 2011-07-16 16:15

Message:
Assigning to myself since I've started work.  Contributions and testing
welcome.

----------------------------------------------------------------------

Comment By: Chris Marshall (marshallch)
Date: 2011-06-07 22:04

Message:
This is to document progress towards improving PDL::NiceSlice.
I've refactored PDL::NiceSlice to use Filter::Simple which supports
ignoring POD, comments, and string contents for filtering.
After tracking down a bug in Text::Balanced and one in Filter::Simple,
the refactored PDL::NiceSlice passes tests as the original code but
now ignores POD, comments, and strings.

Once the bugs are resolved upstream, we can consider migrating
to the Filter::Simple based code.  In the meantime, the new code
is in pdl git in the file Basic/SourceFilter/NiceSlice2.pm in case
anyone wishes to give it a try.  You'll need to refer to the perl bug
reports at:

  http://rt.perl.org/rt3/Ticket/Display.html?id=92436
  http://rt.perl.org/rt3/Ticket/Display.html?id=92438

to see the changes needed to the current Text::Balanced and
Filter::Simple modules to get this to work.  It looks promising
so far....!


----------------------------------------------------------------------

Comment By: Chris Marshall (marshallch)
Date: 2010-10-07 10:04

Message:
NiceSlice also fails to ignore POD sections in code
and results in nslice() constructs appearing in POD.

----------------------------------------------------------------------

Comment By: Chris Marshall (marshallch)
Date: 2010-08-01 11:57

Message:
Lowering the priority of this ticket since  the feature
requested is not on the critical path for the upcoming
PDL-2.4.7 release.  Deferring further enhancements
in the NiceSlice source filter until after then.

----------------------------------------------------------------------

Comment By: Chris Marshall (marshallch)
Date: 2010-06-20 10:46

Message:
Thanks for the bug report.   Maybe something as simple as having a method
call which would indicate that the arguments are to be NiceSlice filtered
could help.  e.g.,

  $a(1:10) could be written as $a->safeslice(1:10)

It might even be useful as an option to preprocess arguments for the
slice()
method.  Then the syntax with and without NiceSlice running globally could
be the same.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100612&aid=3018731&group_id=612

_______________________________________________
PDL-porters mailing list
PDL-porters@jach.hawaii.edu
http://mailman.jach.hawaii.edu/mailman/listinfo/pdl-porters

Reply via email to