Yes, there is. It's an unfortunate hangover from Perl 5 (like the ".=" wart).
NiceSlice actually changes the syntax of the parser. "How", I hear you not asking, "does it do that, when Perl 5 doesn't give you access to the parser?". When you "Use NiceSlice", the remainder of your code gets preprocessed via an executable text filter (in the NiceSlice.pm module), which detects NiceSlice constructs and turns them into more generic method calls. Perl codewalkers are notoriously hard to write -- Christian did a nice job with this one. The source filter mechanism in perl5 was originally intended to enable compression and/or encryption of scripts, so it only has file scope. That is why you have to explicitly invoke "use PDL::NiceSlice" at the top of every file you want preprocessed. Sad but true. We did get the AutoLoader to do some fancy footwork to automagically preprocess .pdl files with NiceSlice, so you don't have to remember to put it in every single file -- but there's no easy way to do that with scripts. I suppose one could make a PDLNS bundle that both loaded PDL and ran the NiceSlice source filter, so you could just "use PDLNS;" in a Perl script... On May 4, 2010, at 11:34 AM, Daniel Carrera wrote: > > Is there a reason why PDL::NiceSlice is in a separate module rather > than being included automatically in PDL? > > Somehow I can't see Matlab, IDL or any "professional" software to get > users to load a separate module in order to get nice syntax. > > Daniel. > > _______________________________________________ > 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
