The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
BUGS 990
Basic/Bad/bad.pd 328357
Basic/Complex/complex.pd 1668
Basic/Constants.pm 12
Basic/Core/Basic.pm 1315
Basic/Core/Core.pm.PL 258421
Basic/Core/Core.xs.PL 5236
Basic/Core/Dev.pm 02
Basic/Core/Makefile.PL 814
Basic/Core/Types.pm.PL 439
Basic/Core/pdl.h.PL 4849
Basic/Core/pdl_hfiles.p 17
Basic/Core/pdlapi.c 1819
Basic/Core/pdlconv.c.PL 12
Basic/Core/pdlcore.c.PL 138122
Basic/Core/pdlcore.h.PL 4244
Basic/Core/pdlhash.c 33
Basic/Core/pdlmagic.c 68
Basic/Core/pdlsections.g 2125
Basic/Core/pdlsimple.h.PL 55
Basic/Core/pdlthread.c 2223
Basic/Core/pdlthread.h 66
Basic/Core/typemap 01
Basic/Core/typemap.pdl 010
Basic/Gen/Makefile.PL 01
Basic/Gen/PP/Dims.pm 11
Basic/Gen/PP/PDLCode.pm 7474
Basic/Gen/PP/PdlParObj.pm 5225
Basic/Gen/PP.pm 75327
Basic/Lvalue.pm 34
Basic/Makefile.PL 01
Basic/Math/math.pd 2948
Basic/Matrix.pm 12
Basic/Ops/ops.pd 64
Basic/Options.pm 12
Basic/PDL.pm 218
Basic/Pod/API.pod 1015
Basic/Pod/BadValues.pod 53
Basic/Pod/FAQ.pod 1817
Basic/Pod/Index.pod 0615
Basic/Pod/Internals.pod 1516
Basic/Pod/MATLAB.pod 1019
Basic/Pod/Makefile.PL 13
Basic/Pod/Modules.pod 12
Basic/Pod/PP.pod 2167
Basic/Pod/QuickStart.pod 910
Basic/Pod/Scilab.pod 33
Basic/Primitive/primitive.pd 3145
Basic/Slices/slices.pd 12202062
Basic/SourceFilter/FilterSimple.pm 23
Basic/SourceFilter/Makefile.PL 12
Basic/SourceFilter/ModuleCompile.pm 011
Basic/SourceFilter/NiceSlice.pm 2530
Basic/Test/tests.pd 03
Basic/Ufunc/ufunc.pd 67111
Bugs.pod 0177
Changes 195137
DEPENDENCIES 3616
DEVELOPMENT 22
Demos/Gnuplot_demo.pm 0332
Demos/Makefile.PL 14
Demos/Prima.pm 0618
Doc/Doc/Perldl.pm 23
Doc/Doc.pm 76117
Doc/Makefile.PL 01
Doc/Pod/Makefile.PL 170
Doc/Pod/Parser.pm 11120
Doc/Pod/README 2060
Doc/Pod/Select.pm 1280
Doc/Pod/Usage.pm 2440
Doc/mkhtmldoc.pl 022
Doc/scantree.pl 01
Graphics/Graphics2D.pm 57
Graphics/LUT/Makefile.PL 01
Graphics/LUT/ramps/Makefile.PL 12
Graphics/LUT/tables/Makefile.PL 12
Graphics/Limits/Limits.pm 01
Graphics/Limits/Makefile.PL 01
Graphics/Makefile.PL 01
Graphics/PGPLOT/Makefile.PL 12
Graphics/PGPLOT/Window/Makefile.PL 12
Graphics/PGPLOT/Window/Window.pm 185
Graphics/PLplot/Makefile.PL 25
Graphics/PLplot/plplot.pd 1823
Graphics/TriD/Makefile.PL 01
Graphics/TriD/POGL/Makefile.PL 99
Graphics/TriD/POGL/OpenGL.pm 01
Graphics/TriD/VRML/Makefile.PL 01
IO/Dicom/Dicom.pm 01
IO/Dicom/Makefile.PL 01
IO/FITS/FITS.pm 346416
IO/FITS/Makefile.PL 01
IO/FastRaw/FastRaw.pm 25
IO/FastRaw/Makefile.PL 01
IO/FlexRaw/FlexRaw.pm 38
IO/FlexRaw/Makefile.PL 01
IO/GD/GD.pd 5373
IO/GD/Makefile.PL 22
IO/HDF/HDF.pm 12
IO/HDF/Makefile.PL 01
IO/HDF/SD/Makefile.PL 01
IO/HDF/VS/Makefile.PL 12
IO/IDL/IDL.pm 0870
IO/IDL/Makefile.PL 014
IO/IDL/README 1356
IO/IO.pod 12
IO/Makefile.PL 12
IO/Misc/misc.pd 03
IO/NDF/Makefile.PL 210
IO/NDF/NDF.pm.PL 16340
IO/Pnm/Pic.pm 1722
IO/Pnm/pnm.pd 1430
IO/Storable/storable.pd 11
Known_problems 5744
Lib/CallExt/CallExt.pm 24
Lib/CallExt/Makefile.PL 11
Lib/FFT/fft.pd 723
Lib/FFTW/Makefile.PL 1990
Lib/FFTW/Readme 80
Lib/FFTW/fftw.pd 11090
Lib/Filter/Makefile.PL 12
Lib/Fit/Makefile.PL 01
Lib/Func.pm 83
Lib/GIS/Makefile.PL 01
Lib/GIS/Proj/Makefile.PL 727
Lib/GIS/Proj/Proj.pd 2814
Lib/GIS/Proj/include/projects.h 0476
Lib/GSL/DIFF/gsl_diff.pd 11
Lib/GSL/INTEG/gsl_integ.pd 11
Lib/GSL/INTERP/gsl_interp.pd 11
Lib/GSL/MROOT/FUNC.c 11
Lib/GSL/MROOT/gsl_mroot.pd 11
Lib/GSL/Makefile.PL 01
Lib/GSL/RNG/gsl_random.pd 1639
Lib/GSL/SF/Makefile.PL 01
Lib/Image2D/image2d.pd 225380
Lib/ImageND/imagend.pd 2324
Lib/Makefile.PL 12
Lib/Minuit/FCN.c 55
Lib/Minuit/minuit.pd 11
Lib/Opt/Makefile.PL 01
Lib/Opt/Simplex/Makefile.PL 12
Lib/Slatec/slatec.pd 28118
Lib/Transform/Cartography/Cartography.pm 4066
Lib/Transform/Cartography/Makefile.PL 12
Lib/Transform/Proj4/Makefile.PL 1742
Lib/Transform/transform.pd 178310
MANIFEST 1620
MANIFEST.SKIP 03
META.json 1920
META.yml 811
Makefile.PL 1540
Perldl2/Makefile.PL 02
Perldl2/Plugin/CleanErrors.pm 11
Perldl2/Plugin/Makefile.PL 01
Perldl2/Plugin/PDLCommands.pm 38
Perldl2/Profile/Makefile.PL 01
Perldl2/Profile/Perldl2.pm 712
Perldl2/README 812
Perldl2/TODO 1313
README 33
Release_Notes 3603584
TODO 5179
cygwin/INSTALL 11
cygwin/README 017
debian/README.source 140
debian/changelog 173
debian/compat 11
debian/control 547
debian/copyright 11
debian/dh_pdl 0127
debian/f77conf.pl 28
debian/patches/00list 00
debian/patches/series 01
debian/pdl.docs 11
debian/pdl.install 01
debian/pdl.lintian-overrides 05
debian/pdl.manpages 01
debian/perldl.conf 4632
debian/rules 1524
debian/source/format 01
debian/write_config_debian.pl 023
inc/Carp/Heavy.pm 010
inc/Carp.pm 0581
inc/Devel/CheckLib.pm 1633
pdl.PL 33
pdldoc.PL 11
perldl.PL 2081
perldl.conf 1512
t/argtest.t 510
t/basic.t 1339
t/callext.c 11
t/callext.t 26
t/complex.t 222
t/core.t 111
t/croak.t 11
t/fastraw.t 20
t/fftw.t 1370
t/fits.t 229
t/flexraw.t 20
t/flexraw_fortran.t 811
t/gd_oo_tests.t 193231
t/gsl_mroot.t 12
t/hdrs.t 15
t/image2d.t 325
t/inline-comment-test.t 0110
t/iotypes.t 59
t/lgamma.t 049
t/limits_ulimits.t 11
t/minuit.t 1016
t/misc.t 4056
t/ndf.t 840
t/niceslice.t 29
t/ops.t 26
t/pdl_from_string.t 45134
t/picrgb.t 13
t/plplot.t 2120
t/pp_croaking.t 11
t/pptest.t 210
t/proj_transform.t 36
t/rim.t 044
t/slatec.t 2020
t/slice-exceptions.t 048
t/slice.t 4844
t/subclass.t 179
t/subclass2.t 2517
t/subclass3.t 2512
t/subclass4.t 164
t/transform.t 447
t/ufunc.t 360
t/unpdl.t 018
win32/INSTALL 9120
232 files changed (This is a version diff) 1346017587
@@ -1,99 +0,0 @@
-REPORTING BUGS
---------------
-
-Please submit bug reports via the sourceforge bug tracker
-interface at
-
-   http://sourceforge.net/tracker/?group_id=612&atid=100612
-
-where you can review the previously submitted bug reports.
-Click on "Add new" to generate a bug report.  If you do not
-already have a sourceforge.net account, you will need to
-get one to submit the report:
-
-   http://sourceforge.net/account/registration/
-
-Please provide a way for the PDL developers to contact you
-regarding the problem.
-
-Try to include any information you think might help someone
-isolate, reproduce, and fix your problem.
-
-At a *minimum*, include the following information:
-
-    * PDL version number (e.g. PDL-2.4.7)
-
-    * Perl version information
-      (output from "perl -v" or "perl -V", even better!)
-
-    * Operating System
-      (run the "uname -a" command on many unix systems)
-
-    * If you are reporting a bug with an installed PDL,
-      please include the full output of "perldl -V"
-
-      If the PDL has compiled and built but not been
-      installed, you may run "perl -Mblib perldl -V"
-      from the top level of the PDL build directory.
-
-    * The bug description and how to reproduce it.
-      Short examples using the PDL shell, pdl2 (or
-      perldl), are excellent!
-
-
-Other things that are often helpful:
-
-    * Details about your operating environment
-      that might be related to the problem
-
-    * Exact cut and pasted error or warning messages
-
-    * The shortest, clearest code you can manage
-      to write which reproduces the bug described.
-
-    * A patch against the latest released version
-      of this distribution which fixes this bug.
-
-
-Alternatively, send an e-mail report with the above
-information (including the output of 'perldl -V')
-to pdl-porters@jach.hawaii.edu . See
-
-   http://pdl.sourceforge.net/maillists/
-
-for info on how to subscribe to this list.
-
-
-
-BEFORE YOU SEND A REPORT
-------------------------
-
-BEFORE you report a bug make sure you got the latest
-release version of PDL (always available from CPAN,
-check http://search.cpan.org/search?dist=PDL). Also
-check the FAQ (http://pdl.sourceforge.net/FAQ) and
-the mailing list archives for hints. You can find
-links to the searchable archives at
-
-   http://pdl.sourceforge.net/maillists/
-
-
-
-PATCHES
--------
-
-Patches can be sent to the pdl-porters mailing list
-(see above) or can be directly submitted to the
-patch manager
-
-   http://sourceforge.net/tracker/?atid=300612&group_id=612
-
-Patches should be made against the latest released
-PDL or, ideally, against the current git sources
-which you can browse and check out at
-
-   git://pdl.git.sourceforge.net/gitroot/pdl/pdl
-
-
-Thanks,
-The pdl-porters team.
@@ -1,3 +1,7 @@
+' # Needed for CPAN indexing?
+package PDL::Bad;
+';
+
 =pod
 
 =head1 bad.pd
@@ -20,11 +24,6 @@ contains a set of methods which essentially do nothing
 (they may return 0 or undef or a copy of the input
 piddle [thankfully PDL::copy handles inplace ops])
 
-Up to, and including, v2.3.4 of PDL, this module
-added the badvalue and orig_badvalue routines to
-the PDL::Type package. They have now been moved to
-Basic/Core/Types.pm.PL where they belong.
-
 =cut
 
 
@@ -282,23 +281,6 @@ use PDL::Primitive;
 
 !WITH!SUBS!
 
-## Footer
-pp_addpm({At=>'Bot'},<<"!WITH!SUBS!");
-
-=head1 CHANGES
-
-The I<experimental> C<BADVAL_PER_PDL> configuration option,
-which - when set - allows per-piddle bad values, was added
-after the 2.4.2 release of PDL.
-The C<$PDL::Bad::PerPdl> variable can be
-inspected to see if this feature is available.
-
-=cut
-
-!WITH!SUBS!
-
-#'
-
 # we want the following to be in PDL, not PDL::Bad, hence
 my $xshdr = "MODULE = PDL::Bad PACKAGE = PDL";
 
@@ -307,10 +289,6 @@ my $xshdr = "MODULE = PDL::Bad PACKAGE = PDL";
 # since it has to recurse through all the children of a piddle
 #
 
-=head1 FUNCTIONS
-
-=cut
-
 pp_addxs( <<"!WITH!SUBS!");
 $xshdr
 
@@ -352,7 +330,7 @@ pp_addpm(<<'!NO!SUBS!');
 
 =for ref
 
-switch on/off/examine bad data flag
+getter/setter for the bad data flag
 
 =for example
 
@@ -362,6 +340,10 @@ switch on/off/examine bad data flag
   $a->badflag(1);      # set bad data flag
   $a->badflag(0);      # unset bad data flag
 
+When called as a setter, this modifies the piddle on which
+it is called. This always returns a Perl scalar with the
+final value of the bad flag.
+
 A return value of 1 does not guarantee the presence of
 bad data in a piddle; all it does is say that we need to
 I<check> for the presence of such beasties. To actually
@@ -370,7 +352,8 @@ use the L<check_badflag|/check_badflag> method.
 
 =for bad
 
-Does support bad values.
+This function works with piddles that have bad values. It
+always returns a Perl scalar, so it never returns bad values.
 
 =head2 badvalue
 
@@ -387,15 +370,14 @@ a PDL::Type object, or one of C<$PDL_B>, C<$PDL_S>, etc.
    print "The bad data value for ushort is: ",
       $a->badvalue(), "\n";
 
-If a new value is supplied via a piddle (e.g. C<$a-E<gt>badvalue(23)>),
-then the data in the supplied piddle is converted to use the new
-bad value as well if the data type is an integer
-or C<$PDL::Bad::UseNaN == 0>.
-
-Currently there is no way of automatically converting the bad
-values of already existing piddles. This could be supported - e.g.
-by having a per-piddle bad value or by storing a time index in the piddle
-structure - if required.
+This can act as a setter (e.g. C<< $a->badvalue(23) >>)
+if the data type is an integer or C<$PDL::Bad::UseNaN == 0>.
+Note that this B<never touches the data in the piddle>.
+That is, if C<$a> already has bad values, they will not
+be changed to use the given number and if any elements of
+C<$a> have that value, they will unceremoniously be marked
+as bad data. See L</setvaltobad>, L</setbadtoval>, and
+L</setbadif> for ways to actually modify the data in piddles
 
 If the C<$PDL::Bad::PerPdl> flag is set then it is possible to
 change the bad value on a per-piddle basis, so
@@ -409,11 +391,14 @@ will set $a to be C<[0 1 2 BAD 4 5 6 7 8 9]> and $b to be
 C<[0 1 2 3 BAD 5 6 7 8 9]>. If the flag is not set then both
 $a and $b will be set to C<[0 1 2 3 BAD 5 6 7 8 9]>. Please
 note that the code to support per-piddle bad values is
-I<experimental> in the current release.
+I<experimental> in the current release, and it requires that
+you modify the settings under which PDL is compiled.
 
 =for bad
 
-Does support bad values.
+This method does not care if you call it on an input piddle
+that has bad values. It always returns a Perl scalar
+with the current or new bad value.
 
 =head2 orig_badvalue
 
@@ -436,13 +421,15 @@ It also has an I<awful> name.
 
 =for bad
 
-Does support bad values.
+This method does not care if you call it on an input piddle
+that has bad values. It always returns a Perl scalar
+with the original bad value for the associated type.
 
 =head2 check_badflag
 
 =for ref
 
-clear the bad-value flag of a piddle if it does not
+Clear the bad-value flag of a piddle if it does not
 contain any bad values
 
 Given a piddle whose bad flag is set, check whether it
@@ -455,7 +442,9 @@ It returns the final state of the bad-value flag.
 
 =for bad
 
-Does support bad values.
+This method accepts piddles with or without bad values. It
+returns a Perl scalar with the final bad-value flag, so it
+never returns bad values itself.
 
 =cut
 
@@ -642,28 +631,21 @@ sub PDL::orig_badvalue {
 
 !NO!SUBS!
 
-=head2 isbad
+pp_def('isbad' . <<'=cut',
 
-=cut
+=head2 isbad
 
+=for sig
 
-pp_def(
-       'isbad',
-       HandleBad => 1,
-       Pars => 'a(); int [o]b();',
-       Code => 
-       '$b() = 0;',
-       BadCode => 
-       '$b() = $ISBAD(a());',
-       CopyBadStatusCode => '',
-       Doc => '
+  Signature: (a(); int [o]b())
 
 =for ref
 
-Is a value bad?
+Returns a binary mask indicating which values of
+the input are bad values
 
 Returns a 1 if the value is bad, 0 otherwise.
-Also see L<isfinite|PDL::Math/isfinite>.
+Similar to L<isfinite|PDL::Math/isfinite>.
 
 =for example
 
@@ -674,26 +656,30 @@ Also see L<isfinite|PDL::Math/isfinite>.
  print $b, "\n";
  [0 1 0]
 
-=cut
-
-',
-
-       );
+=for bad
 
-=head2 isgood
+This method works with input piddles that are bad. The ouptut piddle
+will never contain bad values, but its bad value flag will be the
+same as the input piddle's flag.
 
 =cut
 
-pp_def(
-       'isgood',
        HandleBad => 1,
-       Pars => 'a(); int [o]b();',
        Code => 
-       '$b() = 1;',
+       '$b() = 0;',
        BadCode => 
-       '$b() = $ISGOOD(a());',
+       '$b() = $ISBAD(a());',
        CopyBadStatusCode => '',
-       Doc => '
+
+       );
+
+pp_def('isgood' . <<'=cut',
+
+=head2 isgood
+
+=for sig
+
+  Signature: (a(); int [o]b())
 
 =for ref
 
@@ -711,42 +697,42 @@ Also see L<isfinite|PDL::Math/isfinite>.
  print $b, "\n";
  [1 0 1]
 
+=for bad
+
+This method works with input piddles that are bad. The ouptut piddle
+will never contain bad values, but its bad value flag will be the
+same as the input piddle's flag.
+
 =cut
 
-',
+       HandleBad => 1,
+       Code => 
+       '$b() = 1;',
+       BadCode => 
+       '$b() = $ISGOOD(a());',
+       CopyBadStatusCode => '',
        );
 
 
+# perhaps these should have pm code which returns the
+# answer if the bad flag is not set
+pp_def('nbadover' . <<'=cut',
+
 =head2 nbadover
 
-=cut
+=for sig
 
-# perhaps these should have pm code which returns the
-# answer if the bad flag is not set
-pp_def(
-       'nbadover',
-       HandleBad => 1,
-       Pars => 'a(n); int+ [o]b();',
-       Code => 
-       '$b() = 0;',
-       BadCode => 
-       '$GENERIC(b) cnt = 0;
-	loop(n) %{ 
-           if ( $ISBAD(a()) ) { cnt++; }
-        %}
-        $b() = cnt;',
-       Doc => <<'EOD',
+  Signature: (a(n); int+ [o] b())
 
 =for ref
 
 Find the number of bad elements along the 1st dimension.
 
-This function reduces the dimensionality of a piddle
-by one by finding the number of bad elements
-along the 1st dimension.
-
-By using L<xchg|PDL::Slices/xchg> etc. it is possible to use
-I<any> dimension.
+This function reduces the dimensionality of a piddle by one by finding the
+number of bad elements along the 1st dimension. In this sense it shares
+much in common with the functions defined in L<PDL::Ufunc>. In particular,
+by using L<xchg|PDL::Slices/xchg> and similar dimension rearranging methods,
+it is possible to perform this calculation over I<any> dimension.
 
 =for usage
 
@@ -756,28 +742,32 @@ I<any> dimension.
 
  $spectrum = nbadover $image->xchg(0,1)
 
+=for bad
+
+nbadover processes input values that are bad. The ouput piddle will not have
+any bad values, but the bad flag will be set if the input piddle had its bad
+flag set.
+
 =cut
 
-EOD
-       );
+    HandleBad => 1,
+    Code => '$b() = 0;',
+    BadCode => q{
+        $GENERIC(b) cnt = 0;
+        loop(n) %{ 
+            if ( $ISBAD(a()) ) { cnt++; }
+        %}
+        $b() = cnt;
+    },
+);
+
+pp_def('ngoodover' . <<'=cut',
 
 =head2 ngoodover
 
-=cut
+=for sig
 
-pp_def(
-       'ngoodover',
-       HandleBad => 1,
-       Pars => 'a(n); int+ [o]b();',
-       Code => 
-       '$b() = ($GENERIC(b)) $SIZE(n);',
-       BadCode => 
-       '$GENERIC(b) cnt = 0;
-	loop(n) %{ 
-           if ( $ISGOOD(a()) ) { cnt++; }
-        %}
-        $b() = cnt;',
-       Doc => <<'EOD',
+  Signature: (a(n); int+ [o] b())
 
 =for ref
 
@@ -798,11 +788,43 @@ I<any> dimension.
 
  $spectrum = ngoodover $image->xchg(0,1)
 
+=for bad
+
+ngoodover processes input values that are bad. The ouput piddle will not have
+any bad values, but the bad flag will be set if the input piddle had its bad
+flag set.
+
 =cut
 
-EOD
+       HandleBad => 1,
+       Code => 
+       '$b() = ($GENERIC(b)) $SIZE(n);',
+       BadCode => 
+       '$GENERIC(b) cnt = 0;
+	loop(n) %{ 
+           if ( $ISGOOD(a()) ) { cnt++; }
+        %}
+        $b() = cnt;',
        );
 
+# Generate small ops functions to do entire array
+foreach my $op ( 
+	  ['nbad','nbadover'],
+	  ['ngood','ngoodover'],
+	  ) {
+    pp_addpm(<<"EOD");
+
+*$op->[0] = \\&PDL::$op->[0];
+sub PDL::$op->[0] {
+	my(\$x) = \@_; my \$tmp;
+	\$x->clump(-1)->$op->[1](\$tmp=PDL->nullcreate(\$x) );
+	return \$tmp->at();
+}
+EOD
+
+} # for $op
+
+pp_addpm(<<'!NO!SUBS!');
 
 =head2 nbad
 
@@ -816,7 +838,8 @@ Returns the number of bad values in a piddle
 
 =for bad
 
-Does support bad values.
+Accepts good and bad input piddles; output is a Perl scalar
+and therefore is always good.
 
 =head2 ngood
 
@@ -830,29 +853,8 @@ Returns the number of good values in a piddle
 
 =for bad
 
-Does support bad values.
-
-=cut
-
-
-# Generate small ops functions to do entire array
-foreach my $op ( 
-	  ['nbad','nbadover'],
-	  ['ngood','ngoodover'],
-	  ) {
-    pp_addpm(<<"EOD");
-
-*$op->[0] = \\&PDL::$op->[0];
-sub PDL::$op->[0] {
-	my(\$x) = \@_; my \$tmp;
-	\$x->clump(-1)->$op->[1](\$tmp=PDL->nullcreate(\$x) );
-	return \$tmp->at();
-}
-EOD
-
-} # for $op
-
-pp_addpm(<<'!NO!SUBS!');
+Accepts good and bad input piddles; output is a Perl scalar
+and therefore is always good.
 
 =head2 setbadat
 
@@ -883,7 +885,10 @@ probably mainly useful in test scripts!
 
 =for bad
 
-Supports badvalues.
+This method can be called on piddles that have bad values.
+The remainder of the arguments should be Perl scalars indicating
+the position to set as bad. The ouptut piddle will have bad values
+and will have its badflag turned on.
 
 =cut
 
@@ -924,31 +929,15 @@ if ( 0 ) {
     '$SETPDLSTATEBAD(b);';
 }
 
+# note: have made the mask be an integer
+pp_def('setbadif' . <<'=cut',
+
 =head2 setbadif
 
-=cut
+=for sig
+
+  Signature: (a(); int mask(); [o]b())
 
-# note: have made the mask be an integer
-pp_def(
-    'setbadif',
-    HandleBad => 1,
-    Pars => 'a(); int mask(); [o]b();',
-    %setbadif_extra,
-    Code =>
-    'if ( $mask() ) {
-        $SETBAD(b());
-     } else {
-        $b() = $a();
-     }',
-    BadCode =>
-    '/* if the bad value == 0 then all points are going to be selected ... */
-     if ( $ISBAD(mask()) || $mask() ) {
-        $SETBAD(b());
-     } else {
-        $b() = $a();
-     }',
-    Doc =>
-'
 =for ref
 
 Set elements bad based on the supplied mask, otherwise
@@ -956,33 +945,52 @@ copy across the data.
 
 =for example
 
- $a = sequence(5,5);
- $a = $a->setbadif( $a % 2 );
- print "a badflag: ", $a->badflag, "\n";
+ pdl> $a = sequence(5,5)
+ pdl> $a = $a->setbadif( $a % 2 )
+ pdl> p "a badflag: ", $a->badflag, "\n"
  a badflag: 1
+ pdl> p "a is\n$a"
+ [
+  [  0 BAD   2 BAD   4]
+  [BAD   6 BAD   8 BAD]
+  [ 10 BAD  12 BAD  14]
+  [BAD  16 BAD  18 BAD]
+  [ 20 BAD  22 BAD  24]
+ ]
 
 Unfortunately, this routine can I<not> be run inplace, since the
 current implementation can not handle the same piddle used as
-C<a> and C<mask> (eg C<$a-E<gt>inplace-E<gt>setbadif($a%2)> fails).
-
-Also see L<setvaltobad|/setvaltobad> and L<setnantobad|/setnantobad>.
-
-=cut
+C<a> and C<mask> (eg C<< $a->inplace->setbadif($a%2) >> fails).
+Even more unfortunate: we can't catch this error and tell you.
 
-',
-       BadDoc =>
-'
-=pod
+=for bad
 
 The output always has its bad flag set, even if it does not contain
 any bad values (use L<check_badflag|/check_badflag> to check
 whether there are any bad values in the output). 
-Any bad values in the input piddles are copied across to the output piddle.
+The input piddle can have bad values: any bad values in the input piddles
+are copied across to the output piddle.
+
+Also see L<setvaltobad|/setvaltobad> and L<setnantobad|/setnantobad>.
 
 =cut
 
-',
-       ); # pp_def: setbadif
+    HandleBad => 1,
+    %setbadif_extra,
+    Code =>
+    'if ( $mask() ) {
+        $SETBAD(b());
+     } else {
+        $b() = $a();
+     }',
+    BadCode =>
+    '/* if the bad value == 0 then all points are going to be selected ... */
+     if ( $ISBAD(mask()) || $mask() ) {
+        $SETBAD(b());
+     } else {
+        $b() = $a();
+     }',
+); # pp_def: setbadif
 
 # this is useful because $a->setbadif( $a == 23 )
 # is common and that can't be done inplace
@@ -998,34 +1006,14 @@ pp_addhdr('
 ');
 }
 
+pp_def('setvaltobad' . <<'=cut',
+
 =head2 setvaltobad
 
-=cut
+=for sig
+
+  Signature: (a(); [o]b(); double value)
 
-pp_def(
-    'setvaltobad',
-    HandleBad => 1,
-    Pars => 'a(); [o]b();',
-    OtherPars => 'double value;',
-    Inplace => 1,
-    CopyBadStatusCode => 
-    'if ( a == b && $ISPDLSTATEGOOD(a) )
-       PDL->propogate_badflag( b, 1 ); /* propogate badflag if inplace */
-     $SETPDLSTATEBAD(b);          /* always make sure the output is "bad" */
-    ',
-    Code =>
-    '#if defined _MSC_VER && _MSC_VER < 1400
-$GENERIC(a) dummy1 = ($GENERIC(a)) $COMP(value);
-if ( $a() == dummy1 ) {
-#else
-if ( $a() == ($GENERIC(a)) $COMP(value) ) {
-#endif
-        $SETBAD(b());
-     } else {
-        $b() = $a();
-     }',
-    Doc => 
-'
 =for ref
 
 Set bad all those elements which equal the supplied value.
@@ -1041,12 +1029,7 @@ This is a simpler version of L<setbadif|/setbadif>, but this
 function can be done inplace.  See L<setnantobad|/setnantobad>
 if you want to convert NaN/Inf to the bad value.
 
-=cut
-
-',
-       BadDoc =>
-'
-=pod
+=for bad
 
 The output always has its bad flag set, even if it does not contain
 any bad values (use L<check_badflag|/check_badflag> to check
@@ -1055,8 +1038,27 @@ Any bad values in the input piddles are copied across to the output piddle.
 
 =cut
 
-',
-       ); # pp_def: setvaltobad
+    HandleBad => 1,
+    Inplace => 1,
+    CopyBadStatusCode => q{
+        if ( a == b && $ISPDLSTATEGOOD(a) )
+            PDL->propogate_badflag( b, 1 ); /* propogate badflag if inplace */
+        $SETPDLSTATEBAD(b);          /* always make sure the output is "bad" */
+    },
+    Code => q[
+        #if defined _MSC_VER && _MSC_VER < 1400
+            $GENERIC(a) dummy1 = ($GENERIC(a)) $COMP(value);
+            if ( $a() == dummy1 ) {
+        #else
+            if ( $a() == ($GENERIC(a)) $COMP(value) ) {
+        #endif
+            $SETBAD(b());
+        } else {
+            $b() = $a();
+        }
+    ],
+
+); # pp_def: setvaltobad
 
 if ($^O =~ /MSWin/) {
 pp_addhdr('
@@ -1071,8 +1073,7 @@ pp_addhdr('
 
 The behavior of these functions depend on whether C<PDL::Bad::UseNaN>
 is set to a true value. For PDL as currently distributed, this is
-typically not the case, so the documentation for that case is subdivided
-out here:
+typically not the case. That documentation is show first:
 
 =cut
 
@@ -1083,7 +1084,7 @@ if ( $usenan ) {
     pp_add_exported( '', 'setnantobad setbadtonan' );
 	my $stuff_to_add_to_the_pm = <<'!NO!SUBS!';
 
-=head3 setnantobad
+=head2 setnantobad
 
 =for ref
 
@@ -1122,7 +1123,7 @@ sub PDL::setnantobad{
     return $b; 
 }
 
-=head3 setbadtonan
+=head2 setbadtonan
 
 =for ref
 
@@ -1175,34 +1176,17 @@ On the other hand, if usenan is not true, then any number can be used
 to designate a bad value, and this must be handled with greater care.
 This is the usual case, and the documentation in that case is this:
 
-=head2 setnantobad
-
 =cut
 
     # usenan is not true, so we need to do something
-pp_def(
-    'setnantobad',
-    HandleBad => 1,
-    Pars => 'a(); [o]b();',
-    GenericTypes => [ 'F', 'D' ],
-    Inplace => 1,
-    CopyBadStatusCode => 
-    '/* note: not quite the normal check since set b bad within Code */
-     /* we propogate the bad flag even if a was originally bad since */
-     /* there is no easy way to pass this information around */
-     if ( a == b && $ISPDLSTATEBAD(b) )
-       PDL->propogate_badflag( b, 1 ); /* propogate badflag if inplace */
-    ',
-    Code =>
-    'int flag = 0;
-     threadloop %{
-        if ( ! finite($a()) ) { $SETBAD(b()); flag = 1; }
-        else                  { $b() = $a(); }
-     %}
-     if ( flag ) { $PDLSTATESETBAD(b); }
-     ',
-    Doc => 
-'
+pp_def('setnantobad' . <<'=cut',
+
+=head2 setnantobad
+
+=for sig
+
+  Signature: (a(); [o]b())
+
 =for ref
 
 Sets NaN/Inf values in the input piddle bad
@@ -1214,82 +1198,103 @@ Can be done inplace.
  $b = $a->setnantobad;
  $a->inplace->setnantobad;
 
-=cut
+=for bad
 
-',
-    BadDoc => 'Supports bad values.',
-    ); # pp_def: setnantobad
-
-=head2 setbadtonan
+This method can process piddles with bad values: those bad values
+are propogated into the output piddle. Any value that is not finite
+is also set to bad in the output piddle. If all values from the input
+piddle are good and finite, the output piddle will B<not> have its
+bad flag set. One more caveat: if done inplace, and if the input piddle's
+bad flag is set, it will no
 
 =cut
 
-pp_def(
-    'setbadtonan',
     HandleBad => 1,
-    Pars => 'a(); [o]b();',
     GenericTypes => [ 'F', 'D' ],
     Inplace => 1,
-    CopyBadStatusCode => 
-    'if ( a == b )
-       PDL->propogate_badflag( b, 0 ); /* propogate cleared badflag if inplace */
-     $SETPDLSTATEGOOD(b);          /* always make sure the output is "good" */
-    ',
-    Code =>
-    'if ( $ISBAD(a()) ) { $b() = $TFD(_nan_float,_nan_double); }  /* _nan_xxx set up at top of file */
-     else               { $b() = $a(); }
-     ',
-    Doc => 
-'
+    CopyBadStatusCode => q{
+        /* note: not quite the normal check since set b bad within Code */
+        /* we propogate the bad flag even if a was originally bad since */
+        /* there is no easy way to pass this information around */
+        if ( a == b && $ISPDLSTATEBAD(b) )
+            PDL->propogate_badflag( b, 1 ); /* propogate badflag if inplace */
+    },
+    Code => q{
+        int flag = 0;
+        threadloop %{
+            if ( ! finite($a()) ) {
+                $SETBAD(b());
+                flag = 1;
+            }
+            else {
+                $b() = $a();
+            }
+        %}
+        if ( flag ) $PDLSTATESETBAD(b);
+    },
+); # pp_def: setnantobad
+
+
+pp_def('setbadtonan' . <<'=cut',
+
+=head2 setbadtonan
+
+=for sig
+
+  Signature: (a(); [o] b();)
+
 =for ref
 
 Sets Bad values to NaN
-(only relevant for floating-point piddles).
-Can be done inplace and it clears the bad flag.
+
+This is only relevant for floating-point piddles. The input piddle can be
+of any type, but if done inplace, the input must be floating point.
 
 =for usage
 
  $b = $a->setbadtonan;
  $a->inplace->setbadtonan;
 
-=cut
+=for bad
 
-',
-    BadDoc => 'Supports bad values.',
-    ); # pp_def: setbadtonan
+This method processes input piddles with bad values. The output piddles will
+not contain bad values (insofar as NaN is not Bad as far as PDL is concerned)
+and the output piddle does not have its bad flag set. As an inplace
+operation, it clears the bad flag.
+
+=cut
+    
+    HandleBad => 1,
+    GenericTypes => [ 'F', 'D' ],
+    Inplace => 1,
+    CopyBadStatusCode => q{
+        /* propogate cleared badflag if inplace */
+        if ( a == b ) PDL->propogate_badflag( b, 0 );
+        /* always make sure the output is "good" */
+        $SETPDLSTATEGOOD(b);
+    },
+    Code => q{
+        if ( $ISBAD(a()) ) {
+        	/* _nan_xxx set up at top of file */
+            $b() = $TFD(_nan_float,_nan_double);
+        }
+        else {
+            $b() = $a();
+        }
+    },
+); # pp_def: setbadtonan
 
 } # if: $usenan
 
+# renamed replacebad by setbadtoval
+pp_def('setbadtoval' . <<'=cut',
+
 =head2 setbadtoval
 
-=cut
+=for sig
+
+  Signature: (a(); [o]b(); double newval)
 
-# renamed replacebad by setbadtoval
-pp_def(
-    'setbadtoval',
-    HandleBad => 1,
-    Pars => 'a(); [o]b();',
-    OtherPars => 'double newval;',
-    Inplace => 1,
-    Code => '$b() = $a();',
-    BadCode => 
-    '$GENERIC(b) replace = ($GENERIC(b)) $COMP(newval);
-     $GENERIC(b) a_val;
-     threadloop %{
-        a_val = $a();
-        if ( $ISBADVAR(a_val,a) ) {
-           $b() = replace;
-        } else {
-           $b() = a_val;
-        }
-     %}',
-    CopyBadStatusCode => 
-    'if ( a == b && $ISPDLSTATEBAD(a) )
-       PDL->propogate_badflag( b, 0 );  /* propogate badflag if inplace AND its changed */
-     $SETPDLSTATEGOOD(b);          /* always make sure the output is "good" */
-    ',
-    Doc => 
-'
 =for ref
 
 Replace any bad values by a (non-bad) value. 
@@ -1303,12 +1308,7 @@ L<badmask|PDL::Math/badmask>.
  print "a badflag: ", $a->badflag, "\n";
  a badflag: 0
 
-=cut
-
-',
-       BadDoc =>
-'
-=pod
+=for bad
 
 The output always has its bad flag cleared.
 If the input piddle does not have its bad flag set, then
@@ -1316,35 +1316,37 @@ values are copied with no replacement.
 
 =cut
 
-',
-       ); # pp_def: setbadtoval
+    HandleBad => 1,
+    Inplace => 1,
+    Code => '$b() = $a();',
+    BadCode => q{
+        $GENERIC(b) replace = ($GENERIC(b)) $COMP(newval);
+        $GENERIC(b) a_val;
+        threadloop %{
+            a_val = $a();
+            if ( $ISBADVAR(a_val,a) ) {
+                $b() = replace;
+            } else {
+                $b() = a_val;
+            }
+         %}
+    },
+    CopyBadStatusCode => q{
+        /* propogate badflag if inplace AND its changed */
+        if ( a == b && $ISPDLSTATEBAD(a) ) PDL->propogate_badflag( b, 0 );
+        /* always make sure the output is "good" */
+        $SETPDLSTATEGOOD(b);
+    },
+); # pp_def: setbadtoval
+
+pp_def('copybad'.<<'=cut',
 
 =head2 copybad
 
-=cut
+=for sig
+
+  Signature: (a(); mask(); [o]b())
 
-pp_def(
-    'copybad',
-    HandleBad => 1,
-    Pars => 'a(); mask(); [o]b();',
-    Inplace => [ 'a' ],
-    Code =>
-    '$b() = $a();',
-    BadCode =>
-    'if ( $ISBAD(mask()) ) {
-        $SETBAD(b());
-     } else {
-        $b() = $a();
-     }',
-    CopyBadStatusCode =>
-    'if ( $BADFLAGCACHE() ) {
-        if ( a == b && $ISPDLSTATEGOOD(a) ) {
-           PDL->propogate_badflag( b, 1 ); /* have inplace op AND badflag has changed */
-        }
-        $SETPDLSTATEBAD(b);
-     }',
-    Doc => 
-'
 =for ref
 
 Copies values from one piddle to another, setting them
@@ -1365,17 +1367,48 @@ It is equivalent to:
 
  $c = $a + $mask * 0
 
-=cut
+=for bad
+
+This handles input piddles that are bad. If either C<$a>
+or C<$mask> have bad values, those values will be marked
+as bad in the output piddle and the output piddle will have
+its bad value flag set to true.
 
-',
-    BadDoc =>
-'Handles bad values.',
+=cut
 
-    ); # pp_def: copybad
+    HandleBad => 1,
+    Inplace => [ 'a' ],
+    Code => '$b() = $a();',
+    BadCode => q{
+        if ( $ISBAD(mask()) ) {
+            $SETBAD(b());
+        } else {
+            $b() = $a();
+        }
+    },
+    CopyBadStatusCode => q{
+        if ( $BADFLAGCACHE() ) {
+            if ( a == b && $ISPDLSTATEGOOD(a) ) {
+                /* have inplace op AND badflag has changed */
+                PDL->propogate_badflag( b, 1 );
+            }
+            $SETPDLSTATEBAD(b);
+        }
+    },
+); # pp_def: copybad
 
 #########################################################
 
-pp_addpm({At=>'Bot'},<<'!WITH!SUBS!');
+pp_addpm({At=>'Bot'},<<'!WITHOUT!SUBS!');
+
+=head1 CHANGES
+
+The I<experimental> C<BADVAL_PER_PDL> configuration option,
+which - when set - allows per-piddle bad values, was added
+after the 2.4.2 release of PDL.
+The C<$PDL::Bad::PerPdl> variable can be
+inspected to see if this feature is available.
+
 
 =head1 CONFIGURATION
 
@@ -1412,7 +1445,7 @@ Doug Burke (djburke@cpan.org), 2000, 2001, 2003, 2006.
 
 The per-piddle bad value support is by Heiko Klein (2006).
 
-CPAN documentation fixes by David Mertens (2010).
+CPAN documentation fixes by David Mertens (2010, 2013).
 
 All rights reserved. There is no warranty. You are allowed to
 redistribute this software / documentation under certain conditions. For
@@ -1422,10 +1455,6 @@ included in the file.
 
 =cut
 
-!WITH!SUBS!
-
-
-
-
+!WITHOUT!SUBS!
 
 ## End
@@ -85,12 +85,12 @@ The complex constant five is equal to C<pdl(1,0)>:
    pdl> p $x = r2C 5
    5 +0i
 
-Now calculate the three roots of of five:
+Now calculate the three cubic roots of of five:
 
    pdl> p $r = Croots $x, 3
    [1.70998 +0i  -0.854988 +1.48088i  -0.854988 -1.48088i]
 
-Check that these really are the roots of unity:
+Check that these really are the roots:
 
    pdl> p $r ** 3
    [5 +0i  5 -1.22465e-15i  5 -7.65714e-15i]
@@ -115,13 +115,51 @@ coefficients:
 Now plot the imaginary part, the real part and the magnitude of the sine
 into the same diagram:
 
-   pdl> line im sin $sin; hold
-   pdl> line re sin $sin
-   pdl> line abs sin $sin
-
-Sorry, but I didn't yet try to reproduce the diagram in this
-text. Just run the commands yourself, making sure that you have loaded
-C<PDL::Complex> (and C<PDL::Graphics::PGPLOT>).
+   pdl> use PDL::Graphics::Gnuplot
+   pdl> gplot( with => 'lines',
+              PDL::cat(im ( sin $sin ),
+                       re ( sin $sin ),
+                       abs( sin $sin ) ))
+
+An ASCII version of this plot looks like this:
+
+  30 ++-----+------+------+------+------+------+------+------+------+-----++
+     +      +      +      +      +      +      +      +      +      +      +
+     |                                                                   $$|
+     |                                                                  $  |
+  25 ++                                                               $$  ++
+     |                                                              ***    |
+     |                                                            **   *** |
+     |                                                         $$*        *|
+  20 ++                                                       $**         ++
+     |                                                     $$$*           #|
+     |                                                  $$$   *          # |
+     |                                                $$     *           # |
+  15 ++                                            $$$       *          # ++
+     |                                          $$$        **           #  |
+     |                                      $$$$          *            #   |
+     |                                  $$$$              *            #   |
+  10 ++                            $$$$$                 *            #   ++
+     |                        $$$$$                     *             #    |
+     |                 $$$$$$$                         *             #     |
+   5 ++       $$$############                          *             #    ++
+     |*****$$$###            ###                      *             #      |
+     *    #*****                #                     *             #      |
+     | ###      ***              ###                **              #      |
+   0 ##            ***              #              *               #      ++
+     |                *              #             *              #        |
+     |                 ***            #          **               #        |
+     |                    *            #        *                #         |
+  -5 ++                    **           #      *                 #        ++
+     |                       ***         ##  **                 #          |
+     |                          *          #*                  #           |
+     |                           ****    ***##                #            |
+ -10 ++                              ****     #              #            ++
+     |                                         #             #             |
+     |                                          ##         ##              |
+     +      +      +      +      +      +      +  ### + ###  +      +      +
+ -15 ++-----+------+------+------+------+------+-----###-----+------+-----++
+     0      5      10     15     20     25     30     35     40     45     50
 
 =cut
 
@@ -560,13 +598,27 @@ pp_def 'Cpow',
            double logr, logi, x, y;
            double  s, c;
 
-           CLOG (ar, ai, logr, logi);
-           x = exp (logr*br - logi*bi);
-           y =      logr*bi + logi*br;
+           if(ar == 0 && ai == 0){
+             if(br == 0 && bi == 0) {
+               $c(m=>0) = 1;
+               $c(m=>1) = 0;
+             }
+             else {
+               $c(m=>0) = 0;
+               $c(m=>1) = 0;
+             }
+           }
+           else {
+             CLOG (ar, ai, logr, logi);
+             x = exp (logr*br - logi*bi);
+             y =      logr*bi + logi*br;
 
-           SINCOS (y, s, c);
-           $c(m=>0) = x * c;
-           $c(m=>1) = x * s;
+             SINCOS (y, s, c);
+
+             $c(m=>0) = x * c;
+             if(ai == 0 && bi == 0) $c(m=>1) = 0;
+             else $c(m=>1) = x * s;
+           }
         ^
 ;
 
@@ -716,7 +768,7 @@ pp_def 'Cacosh',
 	Pars => 'a(m=2); [o]c(m=2)',
 	Inplace => 1,
         GenericTypes => [F,D],
-        Doc => '',
+        Doc => 'Works inplace',
         Code => q^
            $GENERIC() ar = $a(m=>0), ai = $a(m=>1);
 
@@ -19,7 +19,8 @@ E seem to be fundamental.
 =cut
 
 package PDL::Constants;
-our $VERSION = 0.02;
+our $VERSION = "0.02";
+$VERSION = eval $VERSION;
 
 require Exporter;
 @ISA = qw(Exporter);
@@ -183,7 +183,7 @@ See L<xlinvals|/xlinvals> for more information.
 
 =for ref
 
-X axis values logarithmicly spaced between endpoints (see L<xvals|/xvals>).
+X axis values logarithmically spaced between endpoints (see L<xvals|/xvals>).
 
 =for usage
 
@@ -195,14 +195,14 @@ X axis values logarithmicly spaced between endpoints (see L<xvals|/xvals>).
  $z = f($x,$y);            
 
 C<xlogvals>, C<ylogvals> and C<zlogvals> return a piddle with the same shape
-as their first argument and logarithmicly scaled values between the two other
+as their first argument and logarithmically scaled values between the two other
 arguments along the given axis.
 
 =head2 ylogvals
 
 =for ref
 
-Y axis values logarithmicly spaced between endpoints (see L<yvals|/yvals>).
+Y axis values logarithmically spaced between endpoints (see L<yvals|/yvals>).
 
 See L<xlogvals|/xlogvals> for more information.
 
@@ -210,7 +210,7 @@ See L<xlogvals|/xlogvals> for more information.
 
 =for ref
 
-Z axis values logarithmicly spaced between endpoints (see L<zvals|/zvals>).
+Z axis values logarithmically spaced between endpoints (see L<zvals|/zvals>).
 
 See L<xlogvals|/xlogvals> for more information.
 
@@ -407,7 +407,8 @@ or
  $hist = hist($data,$min,$max,$step);
  ($xvals,$hist) = hist($data,[$min,$max,$step]);
 
-If C<hist> is run in list context, C<$xvals> gives the computed bin centres
+If C<hist> is run in list context, C<$xvals> gives the
+computed bin centres as double values.
 
 A nice idiom (with 
 L<PDL::Graphics::PGPLOT|PDL::Graphics::PGPLOT>) is
@@ -455,8 +456,9 @@ Create a weighted histogram of a piddle
  $hist = whist($data, $wt, [$min,$max,$step]);
  ($xvals,$hist) = whist($data, $wt, [$min,$max,$step]);
 
-If requested, C<$xvals> gives the computed bin centres.
-C<$data> and C<$wt> should have the same dimensionality and extents.
+If requested, C<$xvals> gives the computed bin centres
+as type double values.  C<$data> and C<$wt> should have
+the same dimensionality and extents.
 
 A nice idiom (with 
 L<PDL::Graphics::PGPLOT|PDL::Graphics::PGPLOT>) is
@@ -496,16 +498,16 @@ sub _hist_bin_calc {
     my $ntype = $pdl->get_datatype;
     barf "empty piddle, no values to work with" if $pdl->nelem == 0;
     unless (defined $step) {
-	my $defbins = 100 < $pdl->nelem ? 100 : $pdl->nelem;
+	my $defbins = sqrt($pdl->nelem);
+	$defbins = ($defbins>100) ? 100 : $defbins;
 	$step = ($max-$min)/$defbins;
-	$step = int($step) > 0 ? int($step) : 1 if $ntype < $PDL_F;
     }
     barf "step is zero (or all data equal to one value)" if $step == 0;
-    my $bins = int(($max-$min)/$step);
+    my $bins = int(($max-$min)/$step+0.5);
     print "hist with step $step, min $min and $bins bins\n"
-      if $PDL::debug;
-    my $xvals = $min + $step/2 + sequence(PDL::Type->new($ntype),$bins)*
-        PDL::convert($step,$ntype) if $wantarray;
+	if $PDL::debug;
+    # Need to use double for $xvals here
+    my $xvals = $min + $step/2 + sequence(PDL::Core::double,$bins)*$step if $wantarray;
 
     return ( $step, $min, $bins, $xvals );
 }
@@ -25,7 +25,7 @@ my $file;
 $file =~ s/\.pl$//
         if ($Config{'osname'} eq 'VMS' or
             $Config{'osname'} eq 'OS2');  # "case-forgiving"
- 
+
 if ( $bvalflag ) {
     print "Extracting $file (WITH bad value support)\n";
 } else {
@@ -80,12 +80,12 @@ Vectorization is called "threading" for historical reasons.
 The threading engine implements simple rules for each operation.
 
 Each PDL object has a "shape" that is a generalized N-dimensional
-rectangle defined by a "dim list" of sizes in an arbitrary 
-set of dimensions.  A PDL with shape 2x3 has 6 elements and is 
-said to be two-dimensional, or may be referred to as a 2x3-PDL. 
-The dimensions are indexed numerically starting at 0, so a 
+rectangle defined by a "dim list" of sizes in an arbitrary
+set of dimensions.  A PDL with shape 2x3 has 6 elements and is
+said to be two-dimensional, or may be referred to as a 2x3-PDL.
+The dimensions are indexed numerically starting at 0, so a
 2x3-PDL has a dimension 0 (or "dim 0") with size 2 and a 1 dimension
-(or "dim 1") with size 3. 
+(or "dim 1") with size 3.
 
 PDL generalizes *all* mathematical operations with the notion of
 "active dims": each operator has zero or more active dims that are
@@ -105,7 +105,7 @@ list of each object.  All additional dims after the active dims are
 "thread dims".  The thread dims do not have to agree exactly: they are
 coerced to agree according to simple rules:
 
-=over 3 
+=over 3
 
 =item * Null PDLs match any dim list (see below).
 
@@ -165,7 +165,7 @@ some cases:
 
 =item * Generalized scalars and computed assignment
 
-If the PDL on the left-hand side of C<.=> has a dim of size 1, it can be 
+If the PDL on the left-hand side of C<.=> has a dim of size 1, it can be
 treated as a generalized scalar, as in:
 
     $a = sequence(2,3);
@@ -185,8 +185,8 @@ a silent no-op:
     print $b;
 
 will print C<[0]>.  In this case, "$a+1" is empty, and "$b" is a generalized
-scalar that is adjusted to be empty, so the assignment is carried out for 
-zero elements (a no-op).  
+scalar that is adjusted to be empty, so the assignment is carried out for
+zero elements (a no-op).
 
 Both of these behaviors are considered harmful and should not be relied upon:
 they may be patched away in a future version of PDL.
@@ -201,8 +201,8 @@ corresponding dim, including 0.  Thus,
     $b = sequence(2,1);
     $c = $a * $b;
     print $c;
- 
-prints C<Empty[2,0]>.  
+
+prints C<Empty[2,0]>.
 
 This behavior is counterintuitive but desirable, and will be preserved
 in future versions of PDL.
@@ -288,21 +288,21 @@ print OUT <<"!WITH!SUBS!";
 
 \@EXPORT_OK = qw( howbig threadids topdl nelem dims shape null
    $convertfuncs
-   convert inplace zeroes zeros ones list listindices
+   convert inplace zeroes zeros ones list listindices unpdl
    set at flows thread_define over reshape dog cat barf type diagonal
-   dummy mslice approx flat sclr squeeze 
-   get_autopthread_targ set_autopthread_targ get_autopthread_actual  
-   get_autopthread_size set_autopthread_size    
+   dummy mslice approx flat sclr squeeze
+   get_autopthread_targ set_autopthread_targ get_autopthread_actual
+   get_autopthread_size set_autopthread_size
    );
 
 \%EXPORT_TAGS = (
    Func=>[qw/nelem dims shape null
     $convertfuncs
-    convert inplace zeroes zeros ones list listindices
+    convert inplace zeroes zeros ones list listindices unpdl
     set at flows thread_define over reshape pdl piddle null dog cat barf type
     diagonal dummy mslice approx flat sclr
-    get_autopthread_targ set_autopthread_targ get_autopthread_actual  
-    get_autopthread_size set_autopthread_size    
+    get_autopthread_targ set_autopthread_targ get_autopthread_actual
+    get_autopthread_size set_autopthread_size
     /],
    Internal=>[qw/howbig threadids topdl/]
 );
@@ -337,7 +337,7 @@ $PDL::toolongtoprint = 10000;  # maximum pdl size to stringify for printing
 
 # log10() is now defined in ops.pd
 
-*howbig       = \&PDL::howbig;	  
+*howbig       = \&PDL::howbig;	  *unpdl	= \&PDL::unpdl;
 *nelem        = \&PDL::nelem;	  *inplace	= \&PDL::inplace;
 *dims	      = \&PDL::dims;	  *list 	= \&PDL::list;
 *threadids    = \&PDL::threadids; *listindices  = \&PDL::listindices;
@@ -435,7 +435,7 @@ You can mix and match arrays, array refs, and PDLs in your argument
 list, and C<pdl> will sort them out.  You get back a PDL whose last
 (slowest running) dim runs across the top level of the list you hand
 in, and whose first (fastest running) dim runs across the deepest
-level that you supply. 
+level that you supply.
 At the moment, you cannot mix and match those arguments with string
 arguments, though we can't imagine a situation in which you would
 really want to do that.
@@ -459,7 +459,7 @@ Throwing a PDL into the mix has the same effect as throwing in a list ref:
 
   pdl(pdl(1,2),[3,4])
 
-is the same as 
+is the same as
 
   pdl([1,2],[3,4]).
 
@@ -468,7 +468,7 @@ meet the widest dim in the list, so (e.g.)
 
   $a = pdl([[1,2,3],[2]])
 
-gives you the same answer as 
+gives you the same answer as
 
   $a = pdl([[1,2,3],[2,undef,undef]]);
 
@@ -493,10 +493,10 @@ For example:
 
 C<$PDL::undefval> defaults to zero.
 
-As a final note, if you include an Empty PDL in the list of objects to 
+As a final note, if you include an Empty PDL in the list of objects to
 construct into a PDL, it is kept as a placeholder pane -- so if you feed
 in (say) 7 objects, you get a size of 7 in the 0th dim of the output PDL.
-The placeholder panes are completely padded out.  But if you feed in only 
+The placeholder panes are completely padded out.  But if you feed in only
 a single Empty PDL, you get back the Empty PDL (no padding).
 
 =cut
@@ -531,7 +531,7 @@ sub PDL::null{
 	my $class = scalar(@_) ? shift : undef; # if this sub called with no
 						#  class ( i.e. like 'null()', instead
 						#  of '$obj->null' or 'CLASS->null', setup
-						
+
 	if( defined($class) ){
 		$class = ref($class) || $class;  # get the class name
 	}
@@ -554,14 +554,14 @@ Returns a 'null' piddle.
  $x = PDL->nullcreate($arg)
 
 This is an routine used by many of the threading primitives
-(i.e. L<sumover|PDL::Ufunc/sumover>, 
+(i.e. L<sumover|PDL::Ufunc/sumover>,
 L<minimum|PDL::Ufunc/minimum>, etc.) to generate a null piddle for the
 function's output that will behave properly for derived (or
 subclassed) PDL objects.
 
 For the above usage:
-If C<$arg> is a PDL, or a derived PDL, then C<$arg-E<gt>null> is returned. 
-If C<$arg> is a scalar (i.e. a zero-dimensional PDL) then C<PDL-E<gt>null> 
+If C<$arg> is a PDL, or a derived PDL, then C<$arg-E<gt>null> is returned.
+If C<$arg> is a scalar (i.e. a zero-dimensional PDL) then C<PDL-E<gt>null>
 is returned.
 
 =for example
@@ -607,11 +607,13 @@ Return piddle dimensions as a perl list
  pdl> p @tmp = dims zeroes 10,3,22
  10 3 22
 
+See also L<shape|shape> which returns a piddle instead.
+
 =head2 shape
 
 =for ref
 
-Return piddle dimensions as a perl list
+Return piddle dimensions as a piddle
 
 =for usage
 
@@ -622,6 +624,8 @@ Return piddle dimensions as a perl list
  pdl> p $shape = shape zeroes 10,3,22
  [10 3 22]
 
+See also L<dims|dims> which returns a perl list.
+
 =head2 ndims
 
 =for ref
@@ -699,11 +703,11 @@ a piddle argument (e.g. for method calls). Using C<topdl()>
 will ensure nothing breaks if passed with '2'.
 
 Note that C<topdl()> is not exported by default (see example
-below for usage). 
+below for usage).
 
 =for example
 
- use PDL::Core ':Internal'; # use the internal routines of 
+ use PDL::Core ':Internal'; # use the internal routines of
                             # the Core module
 
  $a = topdl 43;             # $a is piddle with value '43'
@@ -729,14 +733,14 @@ type object, unlike L<type|/type>.
 
 =for ref
 
-Returns the size of a piddle datatype in bytes.
+Returns the sizeof a piddle datatype in bytes.
 
 Note that C<howbig()> is not exported by default (see example
-below for usage). 
+below for usage).
 
 =for usage
 
- use PDL::Core ':Internal'; # use the internal routines of 
+ use PDL::Core ':Internal'; # use the internal routines of
                             # the Core module
 
  $size = howbig($piddle->get_datatype);
@@ -756,7 +760,7 @@ NOTE: NOT a method! This is because get_datatype returns
 
 =for ref
 
-Return the internal data for a piddle, as a perl SCALAR ref.  
+Return the internal data for a piddle, as a perl SCALAR ref.
 
 Most piddles hold their internal data in a packed perl string, to take
 advantage of perl's memory management.  This gives you direct access
@@ -765,8 +769,8 @@ data directly (e.g. for file I/O).  If you modify the string, you'll
 need to call L<upd_data|upd_data> afterward, to make sure that the
 piddle points to the new location of the underlying perl variable.
 
-You shouldn't mess with the SV unless you've called
-L<make_physical|/PDL::make_physical> or something similar.  You definitely
+Calling C<get_dataref> automatically physicalizes your piddle (see
+L<make_physical|/PDL::make_physical>).  You definitely
 don't want to do anything to the SV to truncate or deallocate the
 string, unless you correspondingly call L<reshape|/reshape> to make the
 PDL match its new data dimension.
@@ -778,7 +782,7 @@ variable.  Here be dragons.
 
 =head2 upd_data
 
-=for ref 
+=for ref
 
 Update the data pointer in a piddle to match its perl SV.
 
@@ -801,7 +805,7 @@ sub topdl {PDL->topdl(@_)}
 		"*"     => \&PDL::mult, # in1, in2
 		"-"     => \&PDL::minus,    # in1, in2, swap if true
 		"/"     => \&PDL::divide,   # in1, in2, swap if true
-		
+
 		"+="    => sub { PDL::plus     ($_[0], $_[1], $_[0], 0); $_[0]; }, # in1, in2, out, swap if true
 		"*="    => sub { PDL::mult ($_[0], $_[1], $_[0], 0); $_[0]; }, # in1, in2, out, swap if true
 		"-="    => sub { PDL::minus    ($_[0], $_[1], $_[0], 0); $_[0]; }, # in1, in2, out, swap if true
@@ -814,13 +818,13 @@ sub topdl {PDL->topdl(@_)}
 		"=="    => \&PDL::eq,       # in1, in2
 		"eq"    => \&PDL::eq,       # in1, in2
 		"!="    => \&PDL::ne,       # in1, in2
-		
+
 		"<<"    => \&PDL::shiftleft,  # in1, in2, swap if true
 		">>"    => \&PDL::shiftright, # in1, in2, swap if true
 		"|"     => \&PDL::or2,        # in1, in2
 		"&"     => \&PDL::and2,       # in1, in2
 		"^"     => \&PDL::xor,        # in1, in2
-		
+
 		"<<="   => sub { PDL::shiftleft ($_[0], $_[1], $_[0], 0); $_[0]; }, # in1, in2, out, swap if true
 		">>="   => sub { PDL::shiftright($_[0], $_[1], $_[0], 0); $_[0]; }, # in1, in2, out, swap if true
 		"|="    => sub { PDL::or2      ($_[0], $_[1], $_[0], 0); $_[0]; }, # in1, in2, out, swap if true
@@ -828,7 +832,7 @@ sub topdl {PDL->topdl(@_)}
 		"^="    => sub { PDL::xor       ($_[0], $_[1], $_[0], 0); $_[0]; }, # in1, in2, out, swap if true
 	        "**="   => sub { PDL::power     ($_[0], $_[1], $_[0], 0); $_[0]; }, # in1, in2, out, swap if true
 	        "%="    => sub { PDL::modulo    ($_[0], $_[1], $_[0], 0); $_[0]; }, # in1, in2, out, swap if true
-		
+
 		"sqrt"  => sub { PDL::sqrt ($_[0]); },
 		"abs"   => sub { PDL::abs  ($_[0]); },
 		"sin"   => sub { PDL::sin  ($_[0]); },
@@ -854,7 +858,7 @@ sub topdl {PDL->topdl(@_)}
 						PDL::Ops::assgn(@args);
 						return $args[1];
 					},
-		 
+
 		'x'     =>  sub{my $foo = $_[0]->null();
 				  PDL::Primitive::matmult(@_[0,1],$foo); $foo;},
 
@@ -883,7 +887,7 @@ sub PDL::shape {  # Return dimensions as a pdl
    my $pdl = PDL->topdl (shift);
    my @dims = ();
    for(0..$pdl->getndims()-1) {push @dims,($pdl->getdim($_))}
-   return pdl(@dims);
+   return pdl(\@dims);
 }
 
 sub PDL::howbig {
@@ -899,11 +903,11 @@ sub PDL::howbig {
 Returns the piddle thread IDs as a perl list
 
 Note that C<threadids()> is not exported by default (see example
-below for usage). 
+below for usage).
 
 =for usage
 
- use PDL::Core ':Internal'; # use the internal routines of 
+ use PDL::Core ':Internal'; # use the internal routines of
                             # the Core module
 
  @ids = threadids $piddle;
@@ -1009,12 +1013,12 @@ use Carp 'carp';        # for carping (warnings in caller's context)
 sub PDL::Core::new_pdl_from_string {
    my ($new, $original_value, $this, $type) = @_;
    my $value = $original_value;
-   
+
    # Check for input that would generate empty piddles as output:
    my @types = PDL::Types::types;
    return zeroes($types[$type], 1)->where(zeroes(1) < 0)
       if ($value eq '' or $value eq '[]');
-   
+
    # I check for invalid characters later, but arbitrary strings of e will
    # pass that check, so I'll check for that here, first.
 #   croak("PDL::Core::new_pdl_from_string: I found consecutive copies of e but\n"
@@ -1022,7 +1026,7 @@ sub PDL::Core::new_pdl_from_string {
 #      if ($value =~ /ee/i);
    croak("PDL::Core::new_pdl_from_string: found 'e' as part of a larger word in $original_value")
       if $value =~ /e\p{IsAlpha}/ or $value =~ /\p{IsAlpha}e/;
-   
+
    # Only a few characters are allowed in the expression, but we want to allow
    # expressions like 'inf' and 'bad'. As such, convert those values to internal
    # representations that will pass the invalid-character check. We'll replace
@@ -1041,9 +1045,9 @@ sub PDL::Core::new_pdl_from_string {
       if $value =~ /\Bnan/ or $value =~ /nan\B/;
    $has_nan++ if ($value =~ s/\bnan\b/ee/gi);
    # Strawberry Perl compatibility:
-   croak("PDL::Core::new_pdl_from_string: found '-1.#IND' as part of a larger word in $original_value")
+   croak("PDL::Core::new_pdl_from_string: found '1.#IND' as part of a larger word in $original_value")
       if $value =~ /IND\B/i;
-   $has_nan++ if ($value =~ s/-1\.\#IND/ee/gi);
+   $has_nan++ if ($value =~ s/1\.\#IND/ee/gi);
    # --( inf )--
    my ($has_inf) = 0;
    # Strawberry Perl compatibility:
@@ -1058,7 +1062,7 @@ sub PDL::Core::new_pdl_from_string {
    croak("PDL::Core::new_pdl_from_string: found 'pi' as part of a larger word in $original_value")
       if $value =~ /pi\B/ or $value =~ /\Bpi/;
    $value =~ s/\bpi\b/eE/gi;
-   
+
    # Some data types do not support nan and inf, so check for and warn or croak,
    # as appropriate:
    if ($has_nan and not $types[$type]->usenan) {
@@ -1069,14 +1073,14 @@ sub PDL::Core::new_pdl_from_string {
    }
    croak("PDL::Core::new_pdl_from_string: type $types[$type] does not support inf")
       if ($has_inf and not $types[$type]->usenan);
-   
+
    # Make the white-space uniform and see if any not-allowed characters are
    # present:
    $value =~ s/\s+/ /g;
    if (my ($disallowed) = ($value =~ /([^\[\]\+\-0-9;,.eE ]+)/)) {
       croak("PDL::Core::new_pdl_from_string: found disallowed character(s) '$disallowed' in $original_value");
    }
-   
+
    # Wrap the string in brackets [], so that the following works:
    # $a = new PDL q[1 2 3];
    # We'll have to check for dimensions of size one after we've parsed
@@ -1101,14 +1105,14 @@ sub PDL::Core::new_pdl_from_string {
 
    # Remove whitspace between signs and the numbers that follow them:
    $value =~ s/([+\-])\s+/$1/g;
-   
+
 #   # make unambiguous addition/subtraction (white-space on both sides
 #   # of operator) by removing white-space from both sides
 #   $value =~ s/([\dEe])\s+([+\-])\s+(?=[Ee\d])/$1$2/g;
 
    # Replace white-space separators with commas:
    $value =~ s/([.\deE])\s+(?=[+\-eE\d])/$1,/g;
-   
+
    # Remove all other white space:
    $value =~ s/\s+//g;
 
@@ -1117,13 +1121,13 @@ sub PDL::Core::new_pdl_from_string {
    # going to disallow that here:
    croak("PDL::Core::new_pdl_from_string: Operations with bad values are not supported")
       if($value =~ /EE[+\-]/ or $value =~ /[+\-]EE/);
-   
+
    # Check for things that will evaluate as functions and croak if found
    if (my ($disallowed) = ($value =~ /((\D+|\A)[eE]\d+)/)) {
       croak("PDL::Core::new_pdl_from_string: syntax error, looks like an improper exponentiation: $disallowed\n"
          . "You originally gave me $original_value\n");
    }
-   
+
    # Replace the place-holder strings with strings that will evaluate to their
    # correct numerical values when we run the eval:
    $value =~ s/\bEE\b/bad/g;
@@ -1131,9 +1135,20 @@ sub PDL::Core::new_pdl_from_string {
    $value =~ s/\bee\b/nan/g;
    my $inf = -pdl(0)->log;
    $value =~ s/\bEe\b/inf/g;
-   my $nan = $inf - $inf;
+   my $nnan = $inf - $inf;
+   my $nan= $this->initialize();
+   $nan->set_datatype(6);
+   $nan->setdims([]);
+
+   # pack("d*", "nan") will work here only on perls that numify the string "nan" to a NaN.
+   # pack( "d*", (-1.0) ** 0.5 ) will hopefully work in more places, though it seems both
+   # pack("d*", "nan") and pack( "d*", (-1.0) ** 0.5 ) fail on *old* MS Compilers (MSVC++ 6.0 and earlier).
+   # sisyphus 4 Jan 2013.
+   ${$nan->get_dataref}     = pack( "d*", (-1.0) ** 0.5 );
+
+   $nan->upd_data();
    $value =~ s/\beE\b/pi/g;
-   
+
    my $val = eval{
       # Install the warnings handler:
       my $old_warn_handler = $SIG{__WARN__};
@@ -1153,18 +1168,21 @@ sub PDL::Core::new_pdl_from_string {
 
       # Let's see if we can parse it as an array-of-arrays:
       local $_ = $value;
-      return PDL::Core::parse_basic_string ($inf, $nan, $bad);
+      return PDL::Core::parse_basic_string ($inf, $nan, $nnan, $bad);
    };
-   
+
    # Respect BADVAL_USENAN
    require PDL::Config;
    $has_bad += $has_inf + $has_nan if $PDL::Config{BADVAL_USENAN};
-   
+
    if (ref $val eq 'ARRAY') {
       my $to_return = PDL::Core::pdl_avref($val,$this,$type);
       # remove potentially spurious last dimension
       $to_return = $to_return->mv(-1,1)->clump(2)
          if $to_return->dims > 1 and $to_return->dim(-1) == 1;
+      # fix scalar values
+      $to_return->setdims([])
+         if $to_return->dims == 1 and $to_return->dim(-1) == 1;
       # Mark bad if appropriate
       $to_return->badflag($has_bad > 0);
       return $to_return;
@@ -1183,21 +1201,21 @@ sub PDL::Core::new_pdl_from_string {
 sub PDL::Core::parse_basic_string {
 	# Assumes $_ holds the string of interest, and modifies that value
 	# in-place.
-	
+
 	use warnings;
-	
+
 	# Takes a string with proper bracketing, etc, and returns an array-of-arrays
 	# filled with numbers, suitable for use with pdl_avref. It uses recursive
 	# descent to handle the nested nature of the data. The string should have
 	# no whitespace and should be something that would evaluate into a Perl
 	# array-of-arrays (except that strings like 'inf', etc, are allowed).
-	
-	my ($inf, $nan, $bad) = @_;
-	
+
+	my ($inf, $nan, $nnan, $bad) = @_;
+
 	# First character should be a bracket:
 	die "Internal error: input string -->$_<-- did not start with an opening bracket\n"
 		unless s/^\[//;
-	
+
 	my @to_return;
 	# Loop until we run into our closing bracket:
 	my $sign = 1;
@@ -1230,7 +1248,11 @@ sub PDL::Core::parse_basic_string {
 			push @to_return, $sign * $inf;
 		}
 		elsif (s/^nan//i or s/^1\.\#IND//i) {
-			push @to_return, $nan;
+                        if ($sign == -1) {
+                          push @to_return, $nnan;
+                        } else {
+                          push @to_return, $nan;
+                        }
 		}
 		elsif (s/^pi//i) {
 			push @to_return, $sign * 4 * atan2(1, 1);
@@ -1253,7 +1275,7 @@ sub PDL::Core::parse_basic_string {
 		$expects_number = 0;
 		s/^,//;
 	}
-	
+
 	return \@to_return;
 }
 
@@ -1383,7 +1405,7 @@ sub PDL::_hdr_copy {
     return undef ;
   }
 
-  if($tobj = tied %$hdr) { # 
+  if($tobj = tied %$hdr) { #
     print "tied..."if($PDL::debug);
     if(UNIVERSAL::can($tobj,"copy")) {
       my %rhdr;
@@ -1391,8 +1413,8 @@ sub PDL::_hdr_copy {
       print "returning\n" if($PDL::debug);
       return \%rhdr;
     }
-    
-    # Astro::FITS::Header is special for now -- no copy method yet 
+
+    # Astro::FITS::Header is special for now -- no copy method yet
     # but it is recognized.  Once it gets a copy method this will become
     # vestigial:
 
@@ -1404,27 +1426,27 @@ sub PDL::_hdr_copy {
       print "returning\n" if($PDL::debug);
       return \%rhdr;
     }
-  } 
+  }
   elsif(UNIVERSAL::can($hdr,"copy")) {
     print "found a copy method\n" if($PDL::debug);
     return $hdr->copy;
-  } 
+  }
 
   # We got here if it's an unrecognized tie or if it's a vanilla hash.
   print "Making a hash copy..." if($PDL::debug);
-      
+
   return PDL::_deep_hdr_copy($hdr);
 
 }
 
-# 
-# Sleazy deep-copier that gets most cases 
+#
+# Sleazy deep-copier that gets most cases
 # --CED 14-April-2003
 #
 
 sub PDL::_deep_hdr_copy {
   my $val = shift;
-  
+
   if(ref $val eq 'HASH') {
     my (%a,$key);
     for $key(keys %$val) {
@@ -1432,8 +1454,8 @@ sub PDL::_deep_hdr_copy {
       $a{$key} = (ref $value) ? PDL::_deep_hdr_copy($value) : $value;
     }
     return \%a;
-  } 
-  
+  }
+
   if(ref $val eq 'ARRAY') {
     my (@a,$z);
     for $z(@$val) {
@@ -1441,17 +1463,17 @@ sub PDL::_deep_hdr_copy {
     }
     return \@a;
   }
-  
+
   if(ref $val eq 'SCALAR') {
     my $a = $$val;
     return \$a;
   }
-  
+
   if(ref $val eq 'REF') {
     my $a = PDL::_deep_hdr_copy($$val);
     return \$a;
   }
-  
+
   # Special case for PDLs avoids potential nasty header recursion...
   if(UNIVERSAL::isa($val,'PDL')) {
     my $h;
@@ -1460,7 +1482,7 @@ sub PDL::_deep_hdr_copy {
     $val->hdrcpy($h) if($h);
     return $out;
   }
-  
+
   if(UNIVERSAL::can($val,'copy')) {
     return $val->copy;
   }
@@ -1468,7 +1490,7 @@ sub PDL::_deep_hdr_copy {
   $val;
 }
 
-    
+
 =head2 PDL::unwind
 
 =for ref
@@ -1494,7 +1516,7 @@ Make sure the data portion of a piddle can be accessed from XS code.
 Ensures that a piddle gets its own allocated copy of data. This obviously
 implies that there are certain piddles which do not have their own data.
 These are so called I<virtual> piddles that make use of the I<vaffine>
-optimisation (see L<PDL::Indexing|PDL::Indexing>). 
+optimisation (see L<PDL::Indexing|PDL::Indexing>).
 They do not have their own copy of
 data but instead store only access information to some (or all) of another
 piddle's data.
@@ -1502,7 +1524,7 @@ piddle's data.
 Note: this function should not be used unless absolutely neccessary
 since otherwise memory requirements might be severly increased. Instead
 of writing your own XS code with the need to call C<make_physical> you
-might want to consider using the PDL preprocessor 
+might want to consider using the PDL preprocessor
 (see L<PDL::PP|PDL::PP>)
 which can be used to transparently access virtual piddles without the
 need to physicalise them (though there are exceptions).
@@ -1531,10 +1553,10 @@ last dim, etc.
 
 If you specify a dimension position larger than the existing
 dimension list of your PDL, the PDL gets automagically padded with extra
-dummy dimensions so that you get the dim you asked for, in the slot you 
-asked for.  This could cause you trouble if, for example, 
-you ask for $a->dummy(5000,1) because $a will get 5,000 dimensions, 
-each of rank 1. 
+dummy dimensions so that you get the dim you asked for, in the slot you
+asked for.  This could cause you trouble if, for example,
+you ask for $a->dummy(5000,1) because $a will get 5,000 dimensions,
+each of rank 1.
 
 Because padding at the beginning of the dimension list moves existing
 dimensions from slot to slot, it's considered unsafe, so automagic
@@ -1573,7 +1595,7 @@ sub PDL::dummy($$;$) {
    my ($pdl,$dim,$size) = @_;
    barf("Missing position argument to dummy()") unless defined $dim;  # required argument
    $dim = $pdl->getndims+1+$dim if $dim < 0;
-   $size = 1 unless defined($size);
+   $size = defined($size) ? (1 * $size) : 1;  # make $size a number (sf feature # 3479009)
 
    barf("For safety, <pos> < -(dims+1) forbidden in dummy.  min="
 	 . -($pdl->getndims+1).", pos=". ($dim-1-$pdl->getndims) ) if($dim<0);
@@ -1583,7 +1605,7 @@ sub PDL::dummy($$;$) {
    $s .= "*$size";
 
    $pdl->slice($s);
-}  
+}
 
 
 ## Cheesy, slow way
@@ -1595,7 +1617,7 @@ sub PDL::dummy($$;$) {
 #   barf ("too high/low dimension in call to dummy, allowed min/max=0/"
 # 	 . $_[0]->getndims)
 #     if $dim>$pdl->getndims || $dim < 0;
-#   
+#
 #   $_[2] = 1 if ($#_ < 2);
 #   $pdl->slice((','x$dim)."*$_[2]");
 
@@ -1618,7 +1640,7 @@ and the element C<$b-E<gt>at(7,3)> refers to the element
 C<$a-E<gt>at(1,2,3)>.
 
 Use C<clump(-1)> to flatten a piddle. The method L<flat|PDL::Core/flat>
-is provided as a convenient alias.  
+is provided as a convenient alias.
 
 Clumping with a negative dimension in general leaves that many
 dimensions behind -- e.g. clump(-2) clumps all of the first few
@@ -1723,7 +1745,7 @@ resulting in the following output
  2,1,0,-1,
  3,1,0,-1,
 
-which is used in 
+which is used in
 L<PDL::Graphics::TriD::VRML|PDL::Graphics::TriD::VRML>
 to generate VRML output.
 
@@ -1748,7 +1770,7 @@ sub PDL::thread_define ($$) {
   my $sig = new PDL::PP::Signature($sigstr);
   my $args = @{$sig->names}; # number of piddle arguments
   barf "no piddle args" if $args == 0;
-  $args--; 
+  $args--;
   # TODO: $sig->dimcheck(@_) + proper creating generation
   my $def = "\@_[0..$args] = map {PDL::Core::topdl(\$_)} \@_[0..$args];\n".
             '$sig->checkdims(@_);
@@ -1838,7 +1860,7 @@ Explicit threading over specified dims using thread id 1.
 
  Wibble
 
-Convenience function interfacing to 
+Convenience function interfacing to
 L<PDL::Slices::threadI|PDL::Slices/threadI>.
 
 =cut
@@ -1862,7 +1884,7 @@ Explicit threading over specified dims using thread id 2.
 
  Wibble
 
-Convenience function interfacing to 
+Convenience function interfacing to
 L<PDL::Slices::threadI|PDL::Slices/threadI>.
 
 =cut
@@ -1886,7 +1908,7 @@ Explicit threading over specified dims using thread id 3.
 
  Wibble
 
-Convenience function interfacing to 
+Convenience function interfacing to
 L<PDL::Slices::threadI|PDL::Slices/threadI>.
 
 =cut
@@ -1990,7 +2012,7 @@ This is simply achieved by using C<sever>. For example,
    $a = $pdl->index(pdl(0,3,7))->sever;
    $a++;       # important: $pdl is not modified!
 
-In many (but not all) circumstances it acts therefore similar to 
+In many (but not all) circumstances it acts therefore similar to
 L<copy|PDL::Core/copy>.
 However, in general performance is better with C<sever> and secondly,
 C<sever> doesn't lead to futile copying when used on piddles that
@@ -2053,12 +2075,27 @@ Dataflow status
 
 =item S
 
+=cut
+
 !NO!SUBS!
+
+# Document for CPAN folks
+=pod
+
+Some internal flags (P=physical,V=Vaffine,C=changed,B=may contain bad data)
+
+=cut
+
+print OUT "=pod\n\n";
+
 if ( $bvalflag ) {
-   print OUT "Some internal flags (P=physical,V=Vaffine,C=changed,B=may\ncontain bad data)\n";
+   print OUT "Some internal flags (P=physical,V=Vaffine,C=changed,B=may\ncontain bad data)";
 } else {
-   print OUT "Some internal flags (P=physical,V=Vaffine,C=changed)\n";
+   print OUT "Some internal flags (P=physical,V=Vaffine,C=changed)";
 }
+
+print OUT "\n\n=cut\n\n";
+
 print OUT '# line ' . (__LINE__ + 2) . <<'!NO!SUBS!';
  "Basic/Core/Core.pm.PL (i.e. PDL::Core.pm)"
 
@@ -2081,7 +2118,7 @@ Calculated memory consumption of this piddle's data area
 sub PDL::info {
     my ($this,$str) = @_;
     $str = "%C: %T %D" unless defined $str;
-    return ref($this)."->null" 
+    return ref($this)."->null"
 	if PDL::Core::dimstr($this) =~ /D \[0\]/;
     my @hash = split /(%[-,0-9]*[.]?[0-9]*\w)/, $str;
     my @args = ();
@@ -2140,7 +2177,7 @@ sub PDL::approx {
 
 =for ref
 
-Convenience interface to L<slice|PDL::Slices/slice>, 
+Convenience interface to L<slice|PDL::Slices/slice>,
 allowing easier inclusion of dimensions in perl code.
 
 =for usage
@@ -2162,7 +2199,7 @@ sub PDL::mslice {
         my($pdl) = shift;
         return $pdl->slice(join ',',(map {
                         !ref $_ && $_ eq "X" ? ":" :
-			   ref $_ eq "ARRAY" ? $#$_ > 1 && @$_[2] == 0 ? 
+			   ref $_ eq "ARRAY" ? $#$_ > 1 && @$_[2] == 0 ?
 			   "(".int(@$_[0]).")" : join ':', map {int $_} @$_ :
                         !ref $_ ? intpars $_ :
                         die "INVALID SLICE DEF $_"
@@ -2173,10 +2210,13 @@ sub PDL::mslice {
 
 =for ref
 
-If C<$self> is a PDL, then calls C<nslice> with all
-but the last argument, otherwise $self->($_[-1]) is
-called where $_[-1} is the original argument string
-found during PDL::NiceSlice filtering.
+If C<$self> is a PDL, then calls C<slice> with all but the last
+argument, otherwise $self->($_[-1]) is called where $_[-1} is the
+original argument string found during PDL::NiceSlice filtering.
+
+DEVELOPER'S NOTE: this routine is found in Core.pm.PL but would be
+better placed in Slices/slices.pd.  It is likely to be moved there
+and/or changed to "slice_if_pdl" for PDL 3.0.
 
 =for usage
 
@@ -2197,91 +2237,26 @@ sub PDL::nslice_if_pdl {
    }
 
    unshift @_, $pdl;
-   goto &PDL::nslice;
+   goto &PDL::slice;
 }
 
 =head2 nslice
 
 =for ref
 
-Internally used interface to L<slice|PDL::Slices/slice>
-and L<dice|PDL::Slices/dice> that is the runtime part of
-the L<PDL::NiceSlice|PDL::NiceSlice> implementation.
-
-=for usage
-
- $a = $x->nslice(...);
-
-=for example
-
- # below is the same as $x->slice("5:7,:,3:4:2")
- $a = $x->nslice([5,7],X,[3,4,2]);
-
-It implements a superset of L<mslice|PDL::Core/mslice>'s
-features. Should probably not be used in your scripts. Rather
-resort to the L<PDL::NiceSlice|PDL::NiceSlice> interface.
+c<nslice> was an internally used interface for L<PDL::NiceSlice|PDL::NiceSlice>, 
+but is now merely a springboard to L<PDL::Slice|PDL::Slice>.  It is deprecated
+and likely to disappear in PDL 3.0.
 
 =cut
-
-#' get quotes right for emacs
-
-sub _intpar ($) { ref $_[0] ? UNIVERSAL::isa($_[0],'PDL') ?
-		$_[0]->nelem == 1 ? $_[0]->flat->at(0) :
-		  die "multielement piddle where only one allowed" :
-		    die "non piddle ref '".ref $_[0]."'"
-		      : ($_[0] =~ s/^\*// ? "*".((int $_[0])||1) : int $_[0]); }
 sub PDL::nslice {
-  my($pdl) = shift;
-
-  # This is a placeholder error for the planned sub ref handling refactoring
-  # We'll need to define a UNIVERSAL::nslice() method to perform the runtime
-  # checks (the same as here).  If a non-pdl self is received then we'll use
-  # the stashed original # string to generate the original method call to eval.
-  #
-  barf('PDL::NiceSlice tried to process a sub ref, please use &$subref() syntax')
-     if Scalar::Util::reftype($pdl) eq 'CODE' and not $pdl->isa('PDL');
-
-  my $h = $pdl->hdrcpy() ? PDL::_hdr_copy($pdl->hdr) : undef;
-  my @args = @_;
-  my ($i,$noslice) = (0,0);
-  for (@args) {
-    if (UNIVERSAL::isa($_,'PDL')) {
-      if ($_->nelem > 1) {
-	if ($_->getndims > 1) {
-	  # allow one multi-D arg which will imply flat addressing
-	  PDL::Core::barf 'piddle must be <= 1D' if @args > 1;
-	  $pdl = $pdl->flat->index($_);
-	  $noslice = 1;
-	} else {
-	  # dice this axis
-	  $pdl = $pdl->dice_axis($i,$_);
-	  # and keep resulting dim fully in slice
-	  $_ = 'X'; 
-	}
-      } elsif ($_->nelem > 0) # only if piddle is not empty
-        { $_ = $_->flat->at(0) } # reduce this one-element piddle
-                                      # to a scalar for 'slice'
-        else { return $_->copy } # $_ is empty, return empty copy
+    unless($PDL::nslice_warning_issued) {
+	$PDL::nslice_warning_issued = 1;
+	warn "WARNING: deprecated call to PDL::nslice detected.  Use PDL::slice instead.\n (Warning will be issued only once per session)\n";
     }
-    $i++;
-  }
-  unless ($noslice) {
-   # print STDERR 'processed arglist: ',join(',',@args);
-   my $slstr = join ',',(map {
-    !ref $_ && $_ eq "X" ? ":" :
-      ref $_ eq "ARRAY" ? $#$_ > 1 && _intpar @$_[2] == 0 ? 
-	"("._intpar(@$_[0]).")" : join ':', map {_intpar $_} @$_ :
-	  _intpar $_
-	} @args);
-   # print STDERR "slicestr: $slstr\n";
-   $pdl = $pdl->slice($slstr);
-  }
-  $pdl->sethdr($h) if $h;
-  return $pdl;
+    goto &PDL::slice;
 }
 
-# Utility to determine if argument is blessed object
-
 sub blessed {
     my $ref = ref(shift);
     return $ref =~ /^(REF|SCALAR|ARRAY|HASH|CODE|GLOB||)$/ ? 0 : 1;
@@ -2290,6 +2265,7 @@ sub blessed {
 # Convert numbers to PDL if not already
 
 sub PDL::topdl {
+    return $_[0]->new(@_[1..$#_]) if($#_ > 1); # PDLify an ARRAY
     return $_[1] if blessed($_[1]); # Fall through
     return $_[0]->new($_[1]) if ref(\$_[1]) eq  'SCALAR' or
            ref($_[1]) eq 'ARRAY';
@@ -2333,7 +2309,7 @@ operate array element by array element like C<log10>).
  pdl> $x = xvals zeroes 10;
  pdl> log10(inplace $x)
  pdl> p $x
- [-inf 0    0.30103 0.47712125 0.60205999    0.69897 0.77815125 0.84509804 0.90308999 0.95424251] 
+ [-inf 0    0.30103 0.47712125 0.60205999    0.69897 0.77815125 0.84509804 0.90308999 0.95424251]
 
 =cut
 
@@ -2357,7 +2333,7 @@ Test the in-place flag on a piddle
   $out = ($in->is_inplace) ? $in : zeroes($in);
   $in->set_inplace(0)
 
-Provides access to the L<inplace|/inplace> hint flag, within the perl millieu. 
+Provides access to the L<inplace|/inplace> hint flag, within the perl millieu.
 That way functions you write can be inplace aware... If given an
 argument the inplace flag will be set or unset depending on the value
 at the same time. Can be used for shortcut tests that delete the
@@ -2393,9 +2369,9 @@ Return back either the argument pdl or a copy of it depending on whether
 it be flagged in-place or no.  Handy for building inplace-aware functions.
 
 If you specify a preferred type (must be one of the usual PDL type strings,
-a list ref containing several of them, or a string containing several of them), 
-then the copy is coerced into the first preferred type listed if it is not 
-already one of the preferred types.  
+a list ref containing several of them, or a string containing several of them),
+then the copy is coerced into the first preferred type listed if it is not
+already one of the preferred types.
 
 Note that if the inplace flag is set, no coersion happens even if you specify
 a preferred type.
@@ -2407,7 +2383,7 @@ sub new_or_inplace {
 	my $preferred = shift;
 	my $force = shift;
 	if($pdl->is_inplace) {
-		$pdl->set_inplace(0); 
+		$pdl->set_inplace(0);
 		return $pdl;
 	} else {
 	    unless(defined($preferred)) {
@@ -2460,7 +2436,7 @@ Note, however, that in all functions using C<new_from_specification>
 calling C<func $piddle> will probably not do what you want. So to play safe
 use (e.g. with zeroes)
 
-  $pdl = zeroes $dimpdl->list; 
+  $pdl = zeroes $dimpdl->list;
 
 Calling
 
@@ -2498,11 +2474,11 @@ sub PDL::new_from_specification{
          for my $dim ($_->list) {$nelems *= $dim; push @dims, $dim}
        } else {
           if ($_) {  # quiet warnings when $_ is the empty string
-             barf "Dimensions must be non-negative" if $_<0;  
+             barf "Dimensions must be non-negative" if $_<0;
              $nelems *= $_; push @dims, $_
           } else {
              $nelems *= 0; push @dims, 0;
-          }    
+          }
        }
     }
     my $pdl = $class->initialize();
@@ -2512,9 +2488,25 @@ sub PDL::new_from_specification{
     return $pdl;
 }
 
-# is there such a beast?
-# L<PDL::Primitive::isnull|PDL::Primitive/isnull> 
-#
+=head2 isnull
+
+=for ref
+
+Test whether a piddle is null
+
+=for usage
+
+ croak("Input piddle mustn't be null!")
+     if $input_piddle->isnull;
+
+This function returns 1 if the piddle is null, zero if it is not. The purpose
+of null piddles is to "tell" any PDL::PP methods to allocate new memory for
+an output piddle, but only when that PDL::PP method is called in full-arg
+form. Of course, there's no reason you couldn't commandeer the special value
+for your own purposes, for which this test function would prove most helpful.
+But in general, you shouldn't need to test for a piddle's nullness.
+
+See L</Null PDLs> for more information.
 
 =head2 isempty
 
@@ -2538,10 +2530,10 @@ zero dimension.
 
 Note that having zero elements is rather different from the concept
 of being a null piddle, see the L<PDL::FAQ|PDL::FAQ> and
-L<PDL::Indexing|PDL::Indexing> 
+L<PDL::Indexing|PDL::Indexing>
 manpages for discussions of this.
 
-=cut 
+=cut
 
 sub PDL::isempty {
     my $pdl=shift;
@@ -2746,7 +2738,7 @@ sub PDL::squeeze { return $_[0]->reshape(-1) }
 
 =for ref
 
-flatten a piddle (alias for C<$pdl->clump(-1)>)
+flatten a piddle (alias for C<< $pdl->clump(-1) >>)
 
 =for example
 
@@ -2802,11 +2794,21 @@ sub PDL::convert {
 
 =head2 Datatype_conversions
 
-=for ref
+=cut
 
 !NO!SUBS!
 
-print OUT "$convertalts convert shorthands\n";
+# CPAN-only docs
+# XXX Be sure to update these when new types are added!
+=pod
+
+=for ref
+
+byte|short|ushort|long|longlong|float|double (shorthands to convert datatypes)
+
+=cut
+
+print OUT "=for ref\n\n$convertalts (shorthands to convert datatypes)\n\n=cut\n\n";
 
 print OUT '# line ' . (__LINE__ + 2) . <<'!NO!SUBS!';
  "Basic/Core/Core.pm.PL (i.e. PDL::Core.pm)"
@@ -2814,7 +2816,7 @@ print OUT '# line ' . (__LINE__ + 2) . <<'!NO!SUBS!';
 =for usage
 
  $y = double $x; $y = ushort [1..10];
- # all of byte|short|ushort|long|longlong|float|double behave similarly
+ # all of the above listed shorthands behave similarly
 
 When called with a piddle argument, they convert to the specific
 datatype.
@@ -2834,7 +2836,7 @@ Note the last three give identical results, and the last two are exactly
 equivalent - a list is automatically converted to a list reference for
 syntactic convenience. i.e. you can omit the outer C<[]>
 
-When called with no arguments return a special type token.
+When called with no arguments, these functions return a special type token.
 This allows syntactical sugar like:
 
  $x = ones byte, 1000,1000;
@@ -2857,29 +2859,69 @@ see the function L<pdl()|/pdl> for more details.
 
 !NO!SUBS!
 
-# generate type conversion docs
-for my $type (typesrtkeys()) {
-  my $conv = typefld($type,'convertfunc');
-  print OUT << "!WITH!SUBS!";
+#!!!!!!!!!!!! CPAN-specific docs; UPDATE if the types are updated !!!!!!!!!!!#
 
-=head2 $conv
+=head2 byte
 
-=for ref
+Convert to byte datatype
+
+=head2 short
+
+Convert to short datatype
+
+=head2 ushort
+
+Convert to ushort datatype
+
+=head2 long
+
+Convert to long datatype
+
+=head2 longlong
 
-Convert to $conv datatype - see 'Datatype_conversions'
+Convert to longlong datatype
+
+=head2 float
+
+Convert to float datatype
+
+=head2 double
+
+Convert to double datatype
 
 =cut
 
+#!!!!!!!!!!!! CPAN-specific docs; UPDATE if the types are updated !!!!!!!!!!!#
+
+# generate type conversion docs for each type
+for my $type (typesrtkeys()) {
+  my $conv = typefld($type,'convertfunc');
+
+  # This produces the auto-generated docs on the user's machine of the list
+  # given above. The leading white-space is necessary to prevent CPAN from
+  # thinking it should render the next six lines as documentation on cpan.org
+  # Thus, I must remove it before printing it to the module file.
+  my $doc_string = << "!WITH!SUBS!";
+ =head2 $conv
+
+ =for ref
+
+ Convert to $conv datatype - see 'Datatype_conversions'
+
 !WITH!SUBS!
+
+  # Remove the leading white space
+  $doc_string =~ s/^ //mg;
+  print OUT $doc_string
+
 } # end for loop
 
-print OUT "for (
-$typearray";
+print OUT "\n=cut\n\nfor ( $typearray )\n";
 
 print OUT '# line ' . (__LINE__ + 2) . <<'!NO!SUBS!';
  "Basic/Core/Core.pm.PL (i.e. PDL::Core.pm)"
 
-) {
+{
 	eval ('sub PDL::'.$_->[0]." { ".
 		'return bless ['.$_->[1].'], "PDL::Type" unless @_;
                 convert(alltopdl(\'PDL\', (scalar(@_)>1 ? [@_] : shift)),'.$_->[1].')
@@ -2981,8 +3023,16 @@ occasionally useful and is provied for backwards compatibility.
 
 !NO!SUBS!
 
+=pod
+
+If you compile PDL with bad value support (the default), your machine's
+docs will also say this:
+
+=cut
+
 if ( $bvalflag ) {
     print OUT <<'!NO!SUBS!';
+
 =for bad
 
 list converts any bad values into the string 'BAD'.
@@ -3003,6 +3053,74 @@ sub PDL::list{ # pdl -> @list
      @{listref_c($pdl)};
 }
 
+=head2 unpdl
+
+=for ref
+
+Convert piddle to nested Perl array references
+
+=for usage
+
+ $arrayref = unpdl $x;
+
+This function returns a reference to a Perl list-of-lists structure
+equivalent to the input piddle (within the limitation that while values
+of elements should be preserved, the detailed datatypes will not as
+perl itself basically has "number" data rather than byte, short, int...
+E.g., C<< sum($x - pdl( $x->unpdl )) >> should equal 0.
+
+Obviously this is grossly inefficient in memory and processing for the
+large datasets PDL is designed to handle. Sometimes, however, you really
+want to move your data back to Perl, and with proper dimensionality,
+unlike C<list>.
+
+=for example
+
+ use JSON;
+ my $json = encode_json unpdl $pdl;
+
+=cut
+
+!NO!SUBS!
+
+=pod
+
+If you compile PDL with bad value support (the default), your machine's
+docs will also say this:
+
+=cut
+
+if ( $bvalflag ) {
+    print OUT <<'!NO!SUBS!';
+
+=for bad
+
+unpdl converts any bad values into the string 'BAD'.
+
+=cut
+
+!NO!SUBS!
+}
+
+print OUT '# line ' . (__LINE__ + 2) . <<'!NO!SUBS!';
+ "Basic/Core/Core.pm.PL (i.e. PDL::Core.pm)"
+
+sub PDL::unpdl {
+    barf 'Usage: unpdl($pdl)' if $#_ != 0;
+    my $pdl = PDL->topdl(shift);
+    return [] if $pdl->nelem == 0;
+    return _unpdl_int($pdl);
+}
+
+sub _unpdl_int {
+    my $pdl = shift;
+    if ($pdl->ndims > 1) {
+        return [ map { _unpdl_int($_) } dog $pdl ];
+    } else {
+        return listref_c($pdl);
+    }
+}
+
 =head2 listindices
 
 =for ref
@@ -3092,20 +3210,31 @@ in a general context, quite useful too inside PDL internals.
  pdl> p $x->at(1,2)
  7
 
+=cut
+
 !NO!SUBS!
 
+=pod
+
+If you compile PDL with bad value support (the default), your machine's
+docs will also say this:
+
+=cut
+
 if ( $bvalflag ) {
     print OUT <<'!NO!SUBS!';
+
 =for bad
 
 at converts any bad values into the string 'BAD'.
 
+=cut
+
 !NO!SUBS!
 }
 
 print OUT '# line ' . (__LINE__ + 2) . <<'!NO!SUBS!';
  "Basic/Core/Core.pm.PL (i.e. PDL::Core.pm)"
-=cut
 
 sub PDL::at {     # Return value at ($x,$y,$z...)
     barf 'Usage: at($pdl, $x, $y, ...)' if $#_<0;
@@ -3204,19 +3333,34 @@ returns a single piddle of dimension N+1
   ]
  ]
 
+=cut
+
 !NO!SUBS!
+
+=pod
+
+If you compile PDL with bad value support (the default), your machine's
+docs will also say this:
+
+=cut
+
 	if ( $bvalflag ) {
 print OUT <<'!NO!SUBS!';
+
 =for bad
 
 The output piddle is set bad if any input piddles have their bad flag set.
 
+=cut
+
 !NO!SUBS!
 } # if: $bvalflag
 
 print OUT '# line ' . (__LINE__ + 2) . <<'!NO!SUBS!';
  "Basic/Core/Core.pm.PL (i.e. PDL::Core.pm)"
 
+=pod
+
 Similar functions include L<append|PDL::Primitive/append> and
 L<glue|PDL::Primitive/glue>.
 
@@ -3227,9 +3371,19 @@ sub PDL::cat {
 	my $old_err = $@;
 	$@ = '';
 	eval {
-		$res = $_[0]->initialize; $res->set_datatype($_[0]->get_datatype);
-		$res->setdims([$_[0]->dims,scalar(@_)]);
-		my ($i,$t); my $s = ":,"x$_[0]->getndims;
+		$res = $_[0]->initialize; 
+		$res->set_datatype($_[0]->get_datatype);
+		
+		my @resdims = $_[0]->dims;
+		for my $i(0..$#_){
+		    my @d = $_[$i]->dims;
+		    for my $j(0..$#d) {
+			$resdims[$j] = $d[$j] if( !defined($resdims[$j]) or $resdims[$j]==1 );
+			die "mismatched dims\n" if($d[$j] != 1 and $resdims[$j] != $d[$j]);
+		    }
+		}
+		$res->setdims( [@resdims,scalar(@_) ]);
+		my ($i,$t); my $s = ":,"x@resdims;
 		for (@_) { $t = $res->slice($s."(".$i++.")"); $t .= $_}
 
 		# propogate any bad flags
@@ -3243,8 +3397,8 @@ sub PDL::cat {
 
 	# If we've gotten here, then there's been an error, so check things
 	# and barf out a meaningful message.
-  
-	if  ($@ =~ /PDL::Ops::assgn/
+
+	if  ($@ =~ /PDL::Ops::assgn|mismatched/
 	  or $@ =~ /"badflag"/
 	  or $@ =~ /"initialize"/) {
 		my (@mismatched_dims, @not_a_piddle);
@@ -3255,7 +3409,7 @@ sub PDL::cat {
 		if ($@ =~ /"initialize"/) {
 			# Handle the special case that there are *no* args passed:
 			barf("Called PDL::cat without any arguments") unless @_;
-			
+
 			while ($i < @_ and not eval{ $_[$i]->isa('PDL')}) {
 				push (@not_a_piddle, $i);
 				$i++;
@@ -3266,7 +3420,7 @@ sub PDL::cat {
 		# list:
 		my $first_piddle_argument = $i;
 		my @dims = $_[$i]->dims if ref($_[$i]) =~ /PDL/;
-		
+
 		# Figure out all the ways that the caller screwed up:
 		while ($i < @_) {
 			my $arg = $_[$i];
@@ -3289,7 +3443,7 @@ sub PDL::cat {
 			}
 			$i++;
 		}
-		
+
 		# Construct a message detailing the results
 		my $message = "bad arguments passed to function PDL::cat\n";
 		if (@mismatched_dims > 1) {
@@ -3313,12 +3467,12 @@ sub PDL::cat {
 			# one non-piddle
 			$message .= "Argument $not_a_piddle[0] is not a piddle.\n";
 		}
-		
+
 		# Handle the edge case that something else happened:
 		if (@not_a_piddle == 0 and @mismatched_dims == 0) {
 			barf("cat: unknown error from the internals:\n$@");
 		}
-               
+
 		$message .= "(Argument counting starts from zero.)";
 		croak($message);
 	}
@@ -3368,8 +3522,17 @@ e.g.:
 =cut
 
 !NO!SUBS!
+
+=pod
+
+If you compile PDL with bad value support (the default), your machine's
+docs will also say this:
+
+=cut
+
 	if ( $bvalflag ) {
 print OUT <<'!NO!SUBS!';
+
 =for bad
 
 The output piddles are set bad if the original piddle has its bad flag set.
@@ -3529,22 +3692,22 @@ sub str2D{
     my $badflag = $self->badflag();
 
     my $findmax = 1;
-    if (!defined $format || $format eq "") { 
+    if (!defined $format || $format eq "") {
 	# Format not given? - find max length of default
 	$len=0;
 
 	if ( $badflag ) {
-	    for (@$x) { 
-		if ( $_ eq "BAD" ) { $i = 3; } 
+	    for (@$x) {
+		if ( $_ eq "BAD" ) { $i = 3; }
 		else               { $i = length($_); }
 		$len = $i>$len ? $i : $len;
-	    } 
+	    }
 	} else {
 	    for (@$x) {$i = length($_); $len = $i>$len ? $i : $len };
 	}
 
 	$format = "%".$len."s";
-	
+
 	if ($len>7) { # Too long? - perhaps try smaller format
 	    if ($dtype == $PDL_F) {
 		$format = $PDL::floatformat;
@@ -3579,7 +3742,7 @@ sub str2D{
     } # if: $findmax
 
     $ret = "\n" . " "x$level . "[\n";
-    { 
+    {
 	my $level = $level+1;
 	$ret .= " "x$level ."[";
 	for ($i=0; $i<=$#$x; $i++) {
@@ -3637,11 +3800,11 @@ Retrieve header information from a piddle
  print "Number of pixels in the X-direction=$$h{NAXIS1}\n";
 
 The C<gethdr> function retrieves whatever header information is contained
-within a piddle. The header can be set with L<sethdr|/sethdr> and is always a 
+within a piddle. The header can be set with L<sethdr|/sethdr> and is always a
 hash reference or undef.
 
 C<gethdr> returns undef if the piddle has not yet had a header
-defined; compare with C<hdr> and C<fhdr>, which are guaranteed to return a 
+defined; compare with C<hdr> and C<fhdr>, which are guaranteed to return a
 defined value.
 
 Note that gethdr() works by B<reference>: you can modify the header
@@ -3653,7 +3816,7 @@ in-place once it has been retrieved:
 
 It is also important to realise that in most cases the header is not
 automatically copied when you copy the piddle.  See L<hdrcpy|/hdrcpy>
-to enable automatic header copying.  
+to enable automatic header copying.
 
 Here's another example: a wrapper around rcols that allows your piddle
 to remember the file it was read from and the columns could be easily
@@ -3667,7 +3830,7 @@ as an exercise for the reader)
     $$header{Columns}=\@columns;
 
     @piddles=rcols $file, @columns;
-    foreach (@piddles) { $_->sethdr($header); } 
+    foreach (@piddles) { $_->sethdr($header); }
     return @piddles;
  }
 
@@ -3684,7 +3847,7 @@ Retrieve or set header information from a piddle
 The C<hdr> function allows convenient access to the header of a
 piddle.  Unlike C<gethdr> it is guaranteed to return a defined value,
 so you can use it in a hash dereference as in the example.  If the
-header does not yet exist, it gets autogenerated as an empty hash. 
+header does not yet exist, it gets autogenerated as an empty hash.
 
 Note that this is usually -- but not always -- What You Want.  If you
 want to use a tied L<Astro::FITS::Header|Astro::FITS::Header> hash,
@@ -3706,16 +3869,16 @@ Retrieve or set FITS header information from a piddle
 The C<fhdr> function allows convenient access to the header of a
 piddle.  Unlike C<gethdr> it is guaranteed to return a defined value,
 so you can use it in a hash dereference as in the example.  If the
-header does not yet exist, it gets autogenerated as a tied 
-L<Astro::FITS::Header|Astro::FITS::Header> hash.  
+header does not yet exist, it gets autogenerated as a tied
+L<Astro::FITS::Header|Astro::FITS::Header> hash.
 
 Astro::FITS::Header tied hashes are better at matching the behavior of
 FITS headers than are regular hashes.  In particular, the hash keys
 are CAsE INsEnSItiVE, unlike normal hash keys.  See
 L<Astro::FITS::Header> for details.
 
-If you do not have Astro::FITS::Header installed, you get back a 
-normal hash instead of a tied object.  
+If you do not have Astro::FITS::Header installed, you get back a
+normal hash instead of a tied object.
 
 =head2 sethdr
 
@@ -3732,8 +3895,8 @@ Set header information of a piddle
  $pdl->sethdr( $h );
 
 The C<sethdr> function sets the header information for a piddle.
-You must feed in a hash ref or undef, and the header field of the PDL is 
-set to be a new ref to the same hash (or undefined).  
+You must feed in a hash ref or undef, and the header field of the PDL is
+set to be a new ref to the same hash (or undefined).
 
 The hash ref requirement is a speed bump put in place since the normal
 use of headers is to store fits header information and the like.  Of course,
@@ -3748,7 +3911,7 @@ can use one of the following:
   use PDL::IO::Dumper;
   $pdl->sethdr( deep_copy($h) );
 
-(which is slow but general), or 
+(which is slow but general), or
 
   $pdl->sethdr( PDL::_hdr_copy($h) )
 
@@ -3774,7 +3937,7 @@ switch on/off/examine automatic header copying
 =for example
 
  print "hdrs will be copied" if $a->hdrcpy;
- $a->hdrcpy(1);       # switch on automatic header copying 
+ $a->hdrcpy(1);       # switch on automatic header copying
  $b = $a->sumover;    # and $b will inherit $a's hdr
  $a->hdrcpy(0);       # and now make $a non-infectious again
 
@@ -3785,7 +3948,7 @@ in method-call pipelines).
 Normally, the optional header of a piddle is not copied automatically
 in pdl operations. Switching on the hdrcpy flag using the C<hdrcpy>
 method will enable automatic hdr copying. Note that an actual deep
-copy gets made, which is rather processor-inefficient -- so avoid 
+copy gets made, which is rather processor-inefficient -- so avoid
 using header copying in tight loops!
 
 Most PDLs have the C<hdrcpy> flag cleared by default; however, some
@@ -3857,17 +4020,17 @@ See L<PDL::ParallelCPU> for an overview of the auto-pthread process.
   #   PDLs with greater than 1M elements
   set_autopthread_targ(2);
   set_autopthread_size(1);
-  
+
   # Execute a pdl function, processing will split into two pthreads as long as
   #  one of the pdl-threaded dimensions is divisible by 2.
   $a = minimum($b);
-  
+
   # Get the actual number of pthreads that were run.
   $actual_pthread = get_autopthread_actual();
 
 =cut
 
-*set_autopthread_targ       = \&PDL::set_autopthread_targ;	  
+*set_autopthread_targ       = \&PDL::set_autopthread_targ;
 
 
 =head2 get_autopthread_targ
@@ -3887,7 +4050,7 @@ See L<PDL::ParallelCPU> for an overview of the auto-pthread process.
 
 =cut
 
-*get_autopthread_targ       = \&PDL::get_autopthread_targ;	  
+*get_autopthread_targ       = \&PDL::get_autopthread_targ;
 
 =head2 get_autopthread_actual
 
@@ -3906,7 +4069,7 @@ See L<PDL::ParallelCPU> for an overview of the auto-pthread process.
 
 =cut
 
-*get_autopthread_actual      = \&PDL::get_autopthread_actual;	  
+*get_autopthread_actual      = \&PDL::get_autopthread_actual;
 
 
 =head2 set_autopthread_size
@@ -3932,17 +4095,17 @@ See L<PDL::ParallelCPU> for an overview of the auto-pthread process.
   #   PDLs with greater than 1M elements
   set_autopthread_targ(2);
   set_autopthread_size(1);
-  
+
   # Execute a pdl function, processing will split into two pthreads as long as
   #  one of the pdl-threaded dimensions is divisible by 2.
   $a = minimum($b);
-  
+
   # Get the actual number of pthreads that were run.
   $actual_pthread = get_autopthread_actual();
 
 =cut
 
-*set_autopthread_size       = \&PDL::set_autopthread_size;	  
+*set_autopthread_size       = \&PDL::set_autopthread_size;
 
 
 =head2 get_autopthread_size
@@ -3962,7 +4125,7 @@ See L<PDL::ParallelCPU> for an overview of the auto-pthread process.
 
 =cut
 
-*get_autopthread_size       = \&PDL::get_autopthread_size;	  
+*get_autopthread_size       = \&PDL::get_autopthread_size;
 
 
 =head1 AUTHOR
@@ -3992,7 +4155,7 @@ sub PDL::fhdr {
 	if( (defined $pdl->gethdr) ||
 	!defined $Astro::FITS::Header::VERSION
 	    );
-	
+
     # Avoid bug in 1.15 and earlier Astro::FITS::Header
     my @hdr = ("SIMPLE  =                    T");
     my $hdr = new Astro::FITS::Header(Cards=>\@hdr);
@@ -4000,7 +4163,7 @@ sub PDL::fhdr {
     $pdl->sethdr(\%hdr);
     return \%hdr;
 }
-    
+
 use Fcntl;
 
 BEGIN {
@@ -4020,7 +4183,7 @@ BEGIN {
 #
 # sub pdl_do_sys_map {
 #         my (undef, $length, $protection, $flags, $fh, $offset) = @_;
-#         my $utf8 = File::Map::_check_layers($fh); 
+#         my $utf8 = File::Map::_check_layers($fh);
 #         my $fd = ($flags & MAP_ANONYMOUS) ? (-1) : fileno($fh);
 #         $offset ||= 0;
 #         File::Map::_mmap_impl($_[0], $length, $protection, $flags, $fd, $offset, $utf8);
@@ -95,29 +95,29 @@ int pdl_autopthread_size   = 1;
 
 #define CHECKP(p)    if ((p) == NULL) croak("Out of memory")
 
-static int* pdl_packint( SV* sv, int *ndims ) {
+static PDL_Indx* pdl_packint( SV* sv, int *ndims ) {
 
    SV*  bar;
    AV*  array;
    int i;
-   int *dims;
+   PDL_Indx *dims;
 
    if (!(SvROK(sv) && SvTYPE(SvRV(sv))==SVt_PVAV))  /* Test */
        return NULL;
    array = (AV *) SvRV(sv);   /* dereference */
      *ndims = (int) av_len(array) + 1;  /* Number of dimensions */
    /* Array space */
-   dims = (int *) pdl_malloc( (*ndims) * sizeof(*dims) );
+   dims = (PDL_Indx *) pdl_malloc( (*ndims) * sizeof(*dims) );
    CHECKP(dims);
 
    for(i=0; i<(*ndims); i++) {
       bar = *(av_fetch( array, i, 0 )); /* Fetch */
-      dims[i] = (int) SvIV(bar);
+      dims[i] = (PDL_Indx) SvIV(bar);
    }
    return dims;
 }
 
-static SV* pdl_unpackint ( PDL_Long *dims, int ndims ) {
+static SV* pdl_unpackint ( PDL_Indx *dims, int ndims ) {
 
    AV*  array;
    int i;
@@ -373,9 +373,7 @@ DESTROY(sv)
   PREINIT:
     pdl *self;
   CODE:
-    if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVHV)
-       1; /* Do nothing */
-    else {
+    if (  !(  (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVHV) )  ) {
        self = SvPDLV(sv);
        PDLDEBUG_f(printf("DESTROYING %p\n",(void*)self);)
        if (self != NULL)
@@ -424,7 +422,8 @@ iscontig(x)
       RETVAL = 1;
       pdl_make_physvaffine( x );
 	if PDL_VAFFOK(x) {
-	   int i, inc=1;
+	   int i;
+           PDL_Indx inc=1;
 	   printf("vaff check...\n");
   	   for (i=0;i<x->ndims;i++) {
      	      if (PDL_REPRINC(x,i) != inc) {
@@ -621,7 +620,7 @@ set_data_by_mmap(it,fname,len,shared,writable,creat,mode,trunc)
                
                if(error)
                {
-					fprintf(stderr,"Failed to set length of '%s' to %d. errno=%d",fname,len,error);
+					fprintf(stderr,"Failed to set length of '%s' to %d. errno=%d",fname,(int)len,(int)error);
 					croak("set_data_by_mmap: first ftruncate failed");
                }
                
@@ -629,7 +628,7 @@ set_data_by_mmap(it,fname,len,shared,writable,creat,mode,trunc)
                
                if(error)
                {
-					fprintf(stderr,"Failed to set length of '%s' to %d. errno=%d",fname,len,error);
+					fprintf(stderr,"Failed to set length of '%s' to %d. errno=%d",fname,(int)len,(int)error);
 					croak("set_data_by_mmap: second ftruncate failed");
                }
        }
@@ -678,13 +677,13 @@ set_data_by_offset(it,orig,offset)
               pdl_freedata(it);
               it->data = ((char *) orig->data) + offset;
 	      it->datasv = orig->sv;
-              SvREFCNT_inc(it->datasv);
+              (void)SvREFCNT_inc(it->datasv);
               it->state |= PDL_DONTTOUCHDATA | PDL_ALLOCATED;
               RETVAL = 1;
       OUTPUT:
               RETVAL
 
-int
+PDL_Indx
 nelem(x)
 	pdl *x
 	CODE:
@@ -793,9 +792,9 @@ SV *
 sclr_c(it)
    pdl* it
    PREINIT:
-	PDL_Long nullp = 0;
-	PDL_Long dummyd = 1;
-	PDL_Long dummyi = 1;
+	PDL_Indx nullp = 0;
+	PDL_Indx dummyd = 1;
+	PDL_Indx dummyi = 1;
 	double result;
    CODE:
         /* get the first element of a piddle and return as
@@ -819,7 +818,7 @@ at_c(x,position)
    pdl*	x
    SV*	position
    PREINIT:
-    PDL_Long * pos;
+    PDL_Indx * pos;
     int npos;
     int ipos;
     double result;
@@ -854,7 +853,7 @@ at_bad_c(x,position)
    pdl*	x
    SV *	position
    PREINIT:
-    PDL_Long * pos;
+    PDL_Indx * pos;
     int npos;
     int ipos;
     int badflag;
@@ -924,15 +923,15 @@ void
 list_c(x)
 	pdl *x
       PREINIT:
-	PDL_Long *inds;
-      PDL_Long *incs;
-      PDL_Long offs;
+	PDL_Indx *inds;
+      PDL_Indx *incs;
+      PDL_Indx offs;
 	void *data;
 	int ind;
 	int stop = 0;
 	PPCODE:
       pdl_make_physvaffine( x );
-	inds = pdl_malloc(sizeof(PDL_Long) * x->ndims); /* GCC -> on stack :( */
+	inds = pdl_malloc(sizeof(PDL_Indx) * x->ndims); /* GCC -> on stack :( */
 
 	data = PDL_REPRP(x);
 	incs = (PDL_VAFFOK(x) ? x->vafftrans->incs : x->dimincs);
@@ -957,9 +956,9 @@ SV *
 listref_c(x)
    pdl *x
   PREINIT:
-   PDL_Long * inds;
-   PDL_Long * incs;
-   PDL_Long offs;
+   PDL_Indx * inds;
+   PDL_Indx * incs;
+   PDL_Indx offs;
    void *data;
    int ind;
    int lind;
@@ -1004,7 +1003,7 @@ if ( $bvalflag ) {
 print OUT <<'!NO!SUBS!';
 
    pdl_make_physvaffine( x );
-   inds = pdl_malloc(sizeof(PDL_Long) * x->ndims); /* GCC -> on stack :( */
+   inds = pdl_malloc(sizeof(PDL_Indx) * x->ndims); /* GCC -> on stack :( */
    data = PDL_REPRP(x);
    incs = (PDL_VAFFOK(x) ? x->vafftrans->incs : x->dimincs);
    offs = PDL_REPROFFS(x);
@@ -1019,7 +1018,7 @@ print OUT <<'!NO!SUBS!';
     if ( $bvalflag ) {
 
 	my $condition;
-	if ( $usenan ) {
+	if ( $usenan ) {  # NOTE: dangerous use of hardwired datatype value 4!
 	    $condition = '( (x->datatype < 4 && pdl_val == pdl_badval) ||
 			(x->datatype >= 4 && finite(pdl_val) == 0) )';
 	} else {
@@ -1069,7 +1068,7 @@ set_c(x,position,value)
     SV*	position
     double	value
    PREINIT:
-    PDL_Long * pos;
+    PDL_Indx * pos;
     int npos;
     int ipos;
    CODE:
@@ -1197,22 +1196,6 @@ print OUT <<'!NO!SUBS!';
 
    sv_setiv(get_sv("PDL::SHARE",TRUE|GV_ADDMULTI), PTR2IV(&PDL));
 
-# version of eval() which propogates errors encountered in
-# any internal eval(). Must be passed a code reference - could
-# be use perl_eval_sv() but that is still buggy. This subroutine is
-# primarily for the perlDL shell to use.
-#
-# Thanks to Sarathy (gsar@engin.umich.edu) for suggesting this, though
-# it needs to be wrapped up in the stack stuff to avoid certain SEGVs!
-
-void
-myeval(code)
-  SV *	code;
-  PROTOTYPE: $
-  CODE:
-   PUSHMARK(sp) ;
-   perl_call_sv(code, G_EVAL|G_KEEPERR|GIMME_V);
-
 
 # make piddle belonging to 'class' and of type 'type'
 # from avref 'array_ref' which is checked for being
@@ -1422,7 +1405,7 @@ getndims(x)
 	OUTPUT:
 		RETVAL
 
-int
+PDL_Indx
 getdim(x,y)
 	pdl *x
 	int y
@@ -1462,7 +1445,7 @@ setdims(x,dims_arg)
 	pdl *x
       SV * dims_arg
       PREINIT:
-	 PDL_Long * dims;
+	 PDL_Indx * dims;
 	 int ndims;
        int i;
 	CODE:
@@ -1588,7 +1571,7 @@ threadover_n(...)
     {
 	    int i,sd;
 	    pdl **pdls = malloc(sizeof(pdl *) * npdls);
-	    int *realdims = malloc(sizeof(int) * npdls);
+	    PDL_Indx *realdims = malloc(sizeof(PDL_Indx) * npdls);
 	    pdl_thread pdl_thr;
 	    SV *code = ST(items-1);
 	    for(i=0; i<npdls; i++) {
@@ -1612,7 +1595,7 @@ threadover_n(...)
 		}
 	    	PUTBACK;
 		perl_call_sv(code,G_DISCARD);
-	    } while(sd = pdl_iterthreadloop(&pdl_thr,0));
+	    } while( (sd = pdl_iterthreadloop(&pdl_thr,0)) );
 	    pdl_freethreadloop(&pdl_thr);
 	    free(pdls);
 	    free(realdims);
@@ -1633,7 +1616,8 @@ threadover(...)
     	croak("Usage: threadover(nothers,pdl[,pdl...][,otherpars..],realdims,creating,sub)");
     npdls = targs-nothers;
     {
-	    int i,j,nd1,nd2,dtype=0,nc=npdls;
+	    int i,nd1,nd2,dtype=0;
+	    PDL_Indx j,nc=npdls;
 	    SV* rdimslist = ST(items-3);
 	    SV* cdimslist = ST(items-2);
 	    SV *code = ST(items-1);
@@ -1644,8 +1628,8 @@ threadover(...)
 	    SV **dims = malloc(sizeof(SV *) * npdls);
 	    SV **incs = malloc(sizeof(SV *) * npdls);
 	    SV **others = malloc(sizeof(SV *) * nothers);
-	    int *creating = pdl_packint(cdimslist,&nd2);
-	    int *realdims = pdl_packint(rdimslist,&nd1);
+	    PDL_Indx *creating = pdl_packint(cdimslist,&nd2);
+	    PDL_Indx *realdims = pdl_packint(rdimslist,&nd1);
 	    CHECKP(pdls); CHECKP(child); CHECKP(dims);
 	    CHECKP(incs); CHECKP(csv);
 
@@ -1681,7 +1665,7 @@ threadover(...)
 				NULL,&pdl_thr,NULL, 1);
 	    for(i=0, nc=npdls; i<npdls; i++)  /* create as necessary */
               if (creating[i]) {
-		int *cp = creating+nc;
+		PDL_Indx *cp = creating+nc;
 		pdls[i]->datatype = dtype;
 		pdl_thread_create_parameter(&pdl_thr,i,cp,0);
 		nc += realdims[i];
@@ -459,6 +459,7 @@ my $libsarg = $libs || $malloclib ? "$libs $malloclib " : ''; # for Win32
 	 'INC'          => &PDL_INCLUDE()." $inc $mallocinc",
 	 'LIBS'         => $libsarg ? [$libsarg] : [],
 	 'clean'        => {'FILES'  => "$pref.xs $pref.pm $pref\$(OBJ_EXT) $pref.c"},
+     (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
  );
 }
 
@@ -475,6 +476,7 @@ sub pdlpp_stdargs {
 	 'INC'          => &PDL_INST_INCLUDE()." $inc",
 	 'LIBS'         => $libs ? ["$libs "] : [],
 	 'clean'        => {'FILES'  => "$pref.xs $pref.pm $pref\$(OBJ_EXT) $pref.c"},
+     (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
  );
 }
 
@@ -22,7 +22,7 @@ PDL::Core::Dev->import();
 use Config;
 use IO::File;
 
-$DB::single = 1;  # uncomment to have debugger stop here
+## $DB::single = 1;  # uncomment to have debugger stop here
 
 my $pthread_include = $Config::Config{usrinc};  # not good for win32
 my $pthread_library = '-lpthread';                                  # not good for MSVC
@@ -77,16 +77,21 @@ if ( exists $PDL::Config{POSIX_THREADS_LIBS} and defined $PDL::Config{POSIX_THRE
 } elsif ($^O eq 'freebsd'){
     if ($Config::Config{libs} =~ /-lc_r/) {
         print "\tGood, found -lc_r on a freebsd system.\n";
-    }else{
+    } else {
         print "On FreeBSD try building perl with libc_r instead of libc\n";
         $pthread_library = '';
     }
-} elsif ($^O =~ /bsd$/i){
-    if ($Config::Config{usemymalloc} eq 'y') {
-        print "\tGood, usemymalloc=y, will build with pthread support\n";
-    }else{
-        print "\tGot usemymalloc=$Config::Config{usemymalloc} so not building with pthreads\n";
-        $pthread_library = '';
+ } elsif ($^O =~ /bsd$/i){
+    if ($Config::Config{ldflags} =~ /-pthread/) {
+       if ($Config::Config{usemymalloc} eq 'y') {
+          print "\tGood, usemymalloc=y, will build with pthread support\n";
+       } else {
+          print "\tGot usemymalloc=$Config::Config{usemymalloc} so not building with pthreads\n";
+          $pthread_library = '';
+       }
+    } else {
+          print "\tMissing '-pthread' from ldflags=$Config::Config{lddlflags} so not building with pthreads\n";
+          $pthread_library = '';
     }
  } else {
     print "\tNope, your perl was not linked against pthread library\n";
@@ -161,6 +166,7 @@ WriteMakefile(
 		   'mymalloc.p badsupport.p'
 		   },
  'INC'          => "$pthread_include $mallocinc",
+ (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
 # Extra targets to build
@@ -11,13 +11,30 @@ use File::Basename qw(&basename &dirname);
 
 # Figure out the 4 byte integer type on this machine
 
-sub typeofPDLLong {
+sub packtypeof_PDL_Indx {
+   if ($Config{'ivsize'} == 8) {
+      return 'q*';
+   }
+   elsif ($Config{'ivsize'} == 4 ) {
+      return 'l*';
+   }
+   else {
+      die "Types.pm.PL: packtype for ivsize==$Config{'ivsize'} not handled\n";
+   }
+}
+
+sub typeof_PDL_Indx {
+   warn "Types.pm.PL: using typedef $Config{'ivtype'} PDL_Indx\n";
+   return $Config{'ivtype'} 
+}
+
+sub typeof_PDL_Long {
    return 'int'  if $Config{'intsize'}==4;
    return 'long' if $Config{'longsize'}==4;
    die "Can not find an integer datatype of size 4 bytes!!!\n";
 }
 
-sub typeofPDLi64 {
+sub typeof_PDL_i64 {
   return $Config{i64type} or
     die "Can not find an integer 64 bit type";
 }
@@ -65,13 +82,30 @@ my @types = (
 	     {
 	      identifier => 'L',
 	      pdlctype => 'PDL_Long',
-	      realctype => &typeofPDLLong,
+	      realctype => &typeof_PDL_Long,
 	      ppforcetype => 'int',
 	      usenan => 0,
 	      packtype => 'l*',
 	      defaultbadval => 'INT_MIN',
 	     },
 
+#
+# The PDL_Indx type will be either the same as PDL_Long or, probably,
+# the same as PDL_LongLong depending on the platform.  Will need to
+# determine the actual type at build time.
+
+       {
+        identifier => 'IND',
+        onecharident => 'N',   # only needed if different from identifier
+        pdlctype => 'PDL_Indx',
+        realctype => &typeof_PDL_Indx,
+        ppforcetype => 'indx',
+        usenan => 0,
+        packtype => &packtypeof_PDL_Indx,
+        defaultbadval => 'LONG_MIN',
+       },
+#
+#
 # note that the I/O routines have *not* been updated to be aware of
 # such a type yet
 #
@@ -79,7 +113,7 @@ my @types = (
 	identifier => 'LL',
 	onecharident => 'Q',   # only needed if different from identifier
 	pdlctype => 'PDL_LongLong',
-	realctype => &typeofPDLi64,
+	realctype => &typeof_PDL_i64,
 	ppforcetype => 'longlong',
 	usenan => 0,
 	packtype => 'q*',
@@ -147,6 +181,7 @@ sub genpacktypes {
 
 sub convertfunc {
   my ($type) = @_;
+  return $type->{'convertfunc'} if exists $type->{'convertfunc'};
   checktypehas 'pdlctype', $type;
   my $cfunc = $type->{pdlctype};
   $cfunc =~ s/PDL_//;
@@ -225,65 +225,71 @@ typedef struct pdl_transvtable {
 #define PDL_ITRANS_VAFFINEVALID 0x2000
 #define PDL_ITRANS_NONMUTUAL 0x4000  /* flag for destruction */
 
-/* vparent is the "virtual parent" which is either
- the parent or grandparent or whatever. The trans -structure must store
- both the relationship with our current parent and, if necessary, the
- virtual parent. */
+// These define struct pdl_trans and all derived structures. There are many
+// structures that defined in other parts of the code that can be referenced
+// like a pdl_trans* because all of these structures have the same pdl_trans
+// initial piece. These structures can contain multiple pdl* elements in them.
+// Thus pdl_trans itself ends with a flexible pdl*[] array, which can be used to
+// reference any number of pdl objects. As a result pdl_trans itself can NOT be
+// instantiated
+
+// vparent is the "virtual parent" which is either
+// the parent or grandparent or whatever. The trans -structure must store
+// both the relationship with our current parent and, if necessary, the
+// virtual parent.
+
+#define PDL_TRANS_START_COMMON                                          \
+  int magicno;                                                          \
+  short flags;                                                          \
+  pdl_transvtable *vtable;                                              \
+  void (*freeproc)(struct pdl_trans *);  /* Call to free this           \
+                                          (means whether malloced or not) */ \
+  int bvalflag;  /* required for binary compatability even if WITH_BADVAL=0 */ \
+  int has_badvalue;                                                     \
+  double badvalue;                                                      \
+  int __datatype
 
-#ifdef _MSC_VER
 #define PDL_TRANS_START(np) \
-	int magicno; \
-	short flags; \
-	pdl_transvtable *vtable; \
-	void (*freeproc)(struct pdl_trans *);  /* Call to free this  \
-					(means whether malloced or not) */ \
-        pdl *pdls[np ? np : 1]; /* The pdls involved in the transformation */ \
-        int bvalflag;  /* required for binary compatability even if WITH_BADVAL=0 */ \
-        int has_badvalue; \
-        double badvalue; \
-	int __datatype
+  PDL_TRANS_START_COMMON; \
+  /* The pdls involved in the transformation */ \
+  pdl *pdls[np]
 
-#else
-#define PDL_TRANS_START(np) \
-	int magicno; \
-	short flags; \
-	pdl_transvtable *vtable; \
-	void (*freeproc)(struct pdl_trans *);  /* Call to free this  \
-					(means whether malloced or not) */ \
-        pdl *pdls[np]; /* The pdls involved in the transformation */ \
-        int bvalflag;  /* required for binary compatability even if WITH_BADVAL=0 */ \
-        int has_badvalue; \
-        double badvalue; \
-	int __datatype
+#define PDL_TRANS_START_FLEXIBLE() \
+  PDL_TRANS_START_COMMON; \
+  /* The pdls involved in the transformation */ \
+  pdl *pdls[]
 
+#ifdef PDL_DEBUGGING
+#define PDL_CHKMAGIC_GENERAL(it,this_magic,type) if((it)->magicno != this_magic) croak("INVALID " #type "MAGIC NO 0x%p %d\n",it,(int)((it)->magicno)); else (void)0
+#else
+#define PDL_CHKMAGIC_GENERAL(it,this_magic,type)
 #endif
 
 #define PDL_TR_MAGICNO 0x91827364
 #define PDL_TR_SETMAGIC(it) it->magicno = PDL_TR_MAGICNO
 #define PDL_TR_CLRMAGIC(it) it->magicno = 0x99876134
-#ifdef PDL_DEBUGGING
-#define PDL_TR_CHKMAGIC(it) if(it->magicno != PDL_TR_MAGICNO) croak("INVALID TRANS MAGIC NO %d %d\n",it,it->magicno); else 0
-#else
-#define PDL_TR_CHKMAGIC(it)
-#endif
+#define PDL_TR_CHKMAGIC(it) PDL_CHKMAGIC_GENERAL(it, PDL_TR_MAGICNO, "TRANS ")
 
 
+// This is a generic parent of all the trans structures. It is a flexible array
+// (can store an arbitrary number of pdl objects). Thus this can NOT be
+// instantiated, only "child" structures can
 struct pdl_trans {
-	PDL_TRANS_START(1);
+  PDL_TRANS_START_FLEXIBLE();
 } ;
 
 typedef struct pdl_trans_affine {
 	PDL_TRANS_START(2);
 /* affine relation to parent */
-	PDL_Long *incs; PDL_Long offs;
+	PDL_Indx *incs; PDL_Indx offs;
 } pdl_trans_affine;
 
 /* Need to make compatible with pdl_trans_affine */
 typedef struct pdl_vaffine {
 	PDL_TRANS_START(2);
-	PDL_Long *incs; PDL_Long offs;
+	PDL_Indx *incs; PDL_Indx offs;
 	int ndims;
-	PDL_Long def_incs[PDL_NDIMS];
+	PDL_Indx def_incs[PDL_NDIMS];
 	pdl *from;
 } pdl_vaffine;
 
@@ -321,11 +327,7 @@ struct pdl_magic;
 
 struct pdl {
 #define PDL_MAGICNO 0x24645399
-#ifdef PDL_DEBUGGING
-#define PDL_CHKMAGIC(it) if(it->magicno != PDL_MAGICNO) croak("INVALID MAGIC NO %d %d\n",it,it->magicno); else 0
-#else
-#define PDL_CHKMAGIC(it)
-#endif
+#define PDL_CHKMAGIC(it) PDL_CHKMAGIC_GENERAL(it,PDL_MAGICNO,"")
    unsigned long magicno; /* Always stores PDL_MAGICNO as a sanity check */
      /* This is first so most pointer accesses to wrong type are caught */
    int state;        /* What's in this pdl */
@@ -351,10 +353,10 @@ struct pdl {
    double badvalue;
    int has_badvalue;    /* required by pdlapi.c */
 
-   int nvals;		/* How many values allocated */
+   PDL_Indx nvals;		/* How many values allocated */
    int datatype;
-   PDL_Long   *dims;      /* Array of data dimensions */
-   PDL_Long   *dimincs;   /* Array of data default increments */
+   PDL_Indx   *dims;      /* Array of data dimensions */
+   PDL_Indx   *dimincs;   /* Array of data default increments */
    short    ndims;     /* Number of data dimensions */
 
    unsigned char *threadids;  /* Starting index of the thread index set n */
@@ -381,8 +383,8 @@ struct pdl {
 #define PDL_LIVINGFOR_FAMILY_SRCFORMUTATION  0x0008
    short living_for; /* perl side not referenced; delete me when */
 
-   PDL_Long   def_dims[PDL_NDIMS];   /* Preallocated space for efficiency */
-   PDL_Long   def_dimincs[PDL_NDIMS];   /* Preallocated space for efficiency */
+   PDL_Indx   def_dims[PDL_NDIMS];   /* Preallocated space for efficiency */
+   PDL_Indx   def_dimincs[PDL_NDIMS];   /* Preallocated space for efficiency */
    unsigned char def_threadids[PDL_NTHREADIDS];
 
    struct pdl_magic *magic;
@@ -416,8 +418,7 @@ struct pdl {
 #define ABORT_RECURSE_GUARD __nrec=0;
 #define END_RECURSE_GUARD __nrec--;
 
-#define PDL_ENSURE_ALLOCATED(it) ((it->state & PDL_ALLOCATED) ||  \
-					((pdl_allocdata(it)),1))
+#define PDL_ENSURE_ALLOCATED(it) ( (void)((it->state & PDL_ALLOCATED) || ((pdl_allocdata(it)),1)) )
 #define PDL_ENSURE_VAFFTRANS(it) \
   ( ((!it->vafftrans) || (it->vafftrans->ndims < it->ndims)) && \
     (pdl_vafftrans_alloc(it),1) )
@@ -1,4 +1,8 @@
 
+use Config;
+$PDL_Indx_type = $Config{'ivtype'};
+warn "Using new 64bit index support\n" if $Config{'ivsize'}==8;
+
 use lib ".";
 require 'Types.pm';
 *T = *PDL::Types::typehash; # Alias
@@ -7,7 +11,6 @@ require 'Types.pm';
 # pdl.h and pdlsimple.h
 
 $enum = '';
-$typedefs = '';
 for (sort { $T{$a}{'numval'}<=>$T{$b}{'numval'} }  keys %T) {
  $enum .= $T{$_}{'sym'}.", ";
  $typedefs .= "typedef $T{$_}{'realctype'}              $T{$_}{'ctype'};\n";
@@ -28,6 +31,9 @@ enum pdl_datatypes { $enum };
 
 $typedefs
 
+/* typedef $PDL_Indx_type    PDL_Indx; */
+
+
 /*****************************************************************************/
 
 EOD
@@ -55,7 +55,7 @@ static int is_parent_of(pdl *it,pdl_trans *trans) {
 }
 
 pdl *pdl_null() {
-	PDL_Long d[1] = {0};
+	PDL_Indx d[1] = {0};
 	pdl *it = pdl_new();
 	pdl_makescratchhash(it,0.0,PDL_B);
 	pdl_setdims(it,d,1);
@@ -77,7 +77,7 @@ pdl *pdl_get_convertedpdl(pdl *old,int type) {
 
 void pdl_allocdata(pdl *it) {
 	int i;
-	int nvals=1;
+	PDL_Indx nvals=1;
 	SV *bar;
 	for(i=0; i<it->ndims; i++) {
 			nvals *= it->dims[i];
@@ -621,7 +621,7 @@ void pdl_reallocthreadids(pdl *it,int n) {
 /* Calculate default increments and grow the PDL data */
 
 void pdl_resize_defaultincs(pdl *it) {
-	int inc = 1;
+	PDL_Indx inc = 1;
 	int i=0;
 	for(i=0; i<it->ndims; i++) {
 		it->dimincs[i] = inc; inc *= it->dims[i];
@@ -635,7 +635,7 @@ void pdl_resize_defaultincs(pdl *it) {
 
 /* Init dims & incs - if *incs is NULL ignored (but space is always same for both)  */
 
-void pdl_setdims(pdl* it, PDL_Long * dims, int ndims) {
+void pdl_setdims(pdl* it, PDL_Indx * dims, int ndims) {
    int i;
 
    pdl_reallocdims(it,ndims);
@@ -672,22 +672,23 @@ void pdl_print(pdl *it) {
 }
 
 /* pdl_get is now vaffine aware */
-double pdl_get(pdl *it,int *inds) {
-        int i, *incs;
-        int offs=PDL_REPROFFS(it);
+double pdl_get(pdl *it,PDL_Indx *inds) {
+        int i;
+        PDL_Indx *incs;
+        PDL_Indx offs=PDL_REPROFFS(it);
         incs = PDL_VAFFOK(it) ? it->vafftrans->incs : it->dimincs;
         for(i=0; i<it->ndims; i++)
                 offs += incs[i] * inds[i];
         return pdl_get_offs(PDL_REPRP(it),offs);
 }
 
-double pdl_get_offs(pdl *it, PDL_Long offs) {
-	PDL_Long dummy1=offs+1; PDL_Long dummy2=1;
+double pdl_get_offs(pdl *it, PDL_Indx offs) {
+	PDL_Indx dummy1=offs+1; PDL_Indx dummy2=1;
 	return pdl_at(it->data, it->datatype, &offs, &dummy1, &dummy2, 0, 1);
 }
 
-void pdl_put_offs(pdl *it, PDL_Long offs, double value) {
-	PDL_Long dummy1=offs+1; PDL_Long dummy2=1;
+void pdl_put_offs(pdl *it, PDL_Indx offs, double value) {
+	PDL_Indx dummy1=offs+1; PDL_Indx dummy2=1;
 	pdl_set(it->data, it->datatype, &offs, &dummy1, &dummy2, 0, 1, value);
 }
 
@@ -1265,7 +1266,7 @@ void pdl__ensure_trans(pdl_trans *trans,int what)
 			PDL_ENSURE_ALLOCATED(trans->pdls[j]);
 	}
 
-	if(flag & PDL_PARENTDATACHANGED | flag & PDL_PARENTDIMSCHANGED) {
+	if(flag & (PDL_PARENTDATACHANGED | PDL_PARENTDIMSCHANGED)) {
 		int i;
 
 		if(par_pvaf && (trans->flags & PDL_ITRANS_ISAFFINE)) {
@@ -1274,8 +1275,8 @@ void pdl__ensure_trans(pdl_trans *trans,int what)
 		  /* is it correct to also unset PDL_PARENTREPRCHANGED? */
 		        trans->pdls[1]->state &= ~(PDL_PARENTDIMSCHANGED |
 						  PDL_PARENTREPRCHANGED);
-			pdl_make_physvaffine(trans->pdls[1]);
-			pdl_readdata_vaffine(trans->pdls[1]);
+			pdl_make_physvaffine(((pdl_trans_affine *)(trans))->pdls[1]);
+			pdl_readdata_vaffine(((pdl_trans_affine *)(trans))->pdls[1]);
 		} else {
 #ifdef DONT_VAFFINE
 			for(i=0; i<trans->vtable->npdls; i++) {
@@ -1326,7 +1327,7 @@ void pdl_destroytransform(pdl_trans *trans,int ensure)
 
 	PDL_TR_CHKMAGIC(trans);
 	if(!trans->vtable) {
-		die("ZERO VTABLE DESTTRAN 0x%x %d\n",trans,ensure);
+	  die("ZERO VTABLE DESTTRAN 0x%p %d\n",trans,ensure);
 	}
 	if(ensure) {
 		PDLDEBUG_f(printf("pdl_destroytransform: ensure\n"));
@@ -1465,8 +1466,8 @@ void pdl_make_physvaffine(pdl *it)
 	pdl *current;
 	int *incsleft = 0;
 	int i,j;
-	int inc;
-	int newinc;
+	PDL_Indx inc;
+	PDL_Indx newinc;
 	int ninced;
 	int flag;
 	int incsign;
@@ -1485,7 +1486,7 @@ void pdl_make_physvaffine(pdl *it)
 		goto mkphys_vaff_end;
 	}
 
-	PDL_ENSURE_VAFFTRANS(it);
+	(void)PDL_ENSURE_VAFFTRANS(it);
 	incsleft = malloc(sizeof(*incsleft)*it->ndims);
         PDLDEBUG_f(printf("vaff_malloc: got %p\n",(void*)incsleft));
         for(i=0; i<it->ndims; i++) {
@@ -327,7 +327,8 @@ void pdl_coercetypes( pdl** aa, pdl** bb, Logical changePerl ) {
 
 void ** pdl_twod( pdl* x ) {
 
-   int i,nx,ny,size;
+   PDL_Indx i,nx,ny;
+   int size;
    long *p;
    char *xx;
 
@@ -201,7 +201,7 @@ int pdl_whichdatatype_double (double nv) {
 void pdl_makescratchhash(pdl *ret,double data, int datatype) {
     STRLEN n_a;
 	HV *hash;
-	SV *dat; PDL_Long fake[1];
+	SV *dat; PDL_Indx fake[1];
 
 	 /* Compress to smallest available type. This may have strange
 	    results sometimes :( */
@@ -233,82 +233,81 @@ void pdl_makescratchhash(pdl *ret,double data, int datatype) {
 
 /*
   "Convert" a perl SV into a pdl (alright more like a mapping as
-   the data block is not actually copied)  - scalars are automatically
-   converted.
+   the data block is not actually copied in the most common case
+   of a single scalar) scalars are automatically converted to PDLs.
 */
 
 pdl* SvPDLV ( SV* sv ) {
 
    pdl* ret;
-   int fake[1];
+   PDL_Indx fake[1];
    SV *sv2;
 
-   if ( !SvROK(sv) ) {   /* Coerce scalar */
+   if ( !SvROK(sv) ) {  
+      /* The scalar is not a ref, so we can use direct conversion. */
+
       SV *dat;
       double data;
       int datatype;
 
       ret = pdl_new();  /* Scratch pdl */
 
-/* Scratch hash for the pdl :( - slow but safest. */
+      /* Scratch hash for the pdl :( - slow but safest. */
 
-	/* handle undefined values */
-        if( sv_undef(sv) ) {
-            sv = get_sv("PDL::undefval",1);
-	    if(SvIV(get_sv("PDL::debug",1))){
-		fprintf(stderr,"Warning: SvPDLV converted undef to $PDL::undefval (%g).\n",SvNV(sv));
-		}
-	}
+      /* handle undefined values */
+      if( sv_undef(sv) ) {
+          sv = get_sv("PDL::undefval",1);
+          if(SvIV(get_sv("PDL::debug",1))){
+            fprintf(stderr,"Warning: SvPDLV converted undef to $PDL::undefval (%g).\n",SvNV(sv));
+          }
+      }
 
-       /* Figure datatype to use */
-       if ( !SvIOK(sv) && SvNOK(sv) && SvNIOK(sv)  )  {/* Perl Double (e.g. 2.0) */
-          data = SvNV(sv);
+      /* Figure datatype to use */
+      if ( !SvIOK(sv) && SvNOK(sv) && SvNIOK(sv)  )  {/* Perl Double (e.g. 2.0) */
+         data = SvNV(sv);
 
 !NO!SUBS!
 
-# XXX HACK this may not be sensible (DJB 08/31/00)
-# - only relevant if BADVAL_USENAN is true in config file
-#
-
+##########
+# If badvals and usenan are true, we default NaNs to type double. 
 if ( $bvalflag and $usenan ) {
-   print OUT <<'!NO!SUBS!';
-
-          /*
-           * default NaN/Infs to double
-           * XXX sensible ?
-           */
-          if ( finite(data) == 0 ) {
-             datatype = PDL_D;
-          } else {
-             datatype = pdl_whichdatatype_double(data);
-          }
-
-!NO!SUBS!
+    print OUT q{
+      /*
+       * default NaN/Infs to double
+       *
+       */
+      if ( finite(data) == 0 ) {
+        datatype = PDL_D;
+      } else {
+        datatype = pdl_whichdatatype_double(data);
+      }
+   }
 } else {
+   print OUT q{
+      datatype = pdl_whichdatatype_double(data);
 
-   print OUT "\tdatatype = pdl_whichdatatype_double(data);\n";
-
+   }
 } # if: $bvalflag
 
 print OUT <<'!NO!SUBS!';
+     } /* end of Perl Double case for data type */
+     else { /* Perl Int (e.g. 2) */
+        data = SvNV(sv);
+        datatype = pdl_whichdatatype(data);
+     }
 
-	  }
-       else { /* Perl Int (e.g. 2) */
-          data = SvNV(sv);
-          datatype = pdl_whichdatatype(data);
-       }
-       pdl_makescratchhash(ret,data,datatype);
 
-       return ret;
+     pdl_makescratchhash(ret,data,datatype);
+
+     return ret;
+
    } /* End of scalar case */
 
+   /* If execution reaches here, then sv is NOT a scalar
+    * (i.e. it is a ref).
+    */
+
 
-#ifdef FOODEB
-	printf("SvPDLV\n");
-	printf("SV: %d\n",sv);
-	printf("SvRV: %d\n",SvRV(sv));
-	printf("SvTYPE: %d\n",SvTYPE(SvRV(sv)));
-#endif
 
    if(SvTYPE(SvRV(sv)) == SVt_PVHV) {
    	HV *hash = (HV*)SvRV(sv);
@@ -332,14 +331,18 @@ print OUT <<'!NO!SUBS!';
 	   dSP;
 	   int count;
 	   ENTER ;
-	   SAVETMPS;
+	   SAVETMPS ;
 	   PUSHMARK(sp) ;
+
 	   count = perl_call_sv(*svp, G_SCALAR|G_NOARGS);
+
 	   SPAGAIN ;
+
 	   if (count != 1)
               croak("Execution of PDL structure failed to return one value\n") ;
 
 	   sv=newSVsv(POPs);
+
 	   PUTBACK ;
 	   FREETMPS ;
 	   LEAVE ;
@@ -347,70 +350,46 @@ print OUT <<'!NO!SUBS!';
 	else {
    	   sv = *svp;
 	}
-#ifdef FOODEB
-	printf("SvPDLV2\n");
-	printf("SV2: %d\n",sv);
-	printf("SvTYPE2: %d\n",SvTYPE(sv));
-	printf("SvFLAGS2: %d\n",SvFLAGS(sv));
-	printf("SvANY: %d\n",SvANY(sv));
-#endif
+
 	if(SvGMAGICAL(sv)) {
 		mg_get(sv);
 	}
-#ifdef FOODEB
-	printf("SvPDLV3\n");
-	printf("SV3: %d\n",sv);
-	printf("SvTYPE3: %d\n",SvTYPE(sv));
-	printf("SvFLAGS3: %d\n",SvFLAGS(sv));
-	printf("SvANY: %d\n",SvANY(sv));
-#endif
+
         if ( !SvROK(sv) ) {   /* Got something from a hash but not a ref */
 		croak("Hash given as pdl - but PDL key is not a ref!");
         }
-#ifdef FOODEB
-	printf("SvRV2: %d\n",SvRV(sv));
-	printf("SvTYPE2: %d\n",SvTYPE(SvRV(sv)));
-#endif
     }
+      
+    if(SvTYPE(SvRV(sv)) == SVt_PVAV) {
+	/* This is similar to pdl_avref in Core.xs.PL -- we do the same steps here. */
+	AV *dims, *av;
+	int i, depth; 
+	int datalevel = -1;
+	pdl *p;
+
+	av = (AV *)SvRV(sv);
+	dims = (AV *)sv_2mortal((SV *)newAV());
+	av_store(dims,0,newSViv( (IV) av_len(av)+1 ) );
+	
+	/* Pull sizes using av_ndcheck */
+	depth = 1 + av_ndcheck(av,dims,0,&datalevel);
 
+	return pdl_from_array(av,dims,PDL_D,NULL);
+
+    } /* end of AV code */
+    
     if (SvTYPE(SvRV(sv)) != SVt_PVMG)
       croak("Error - tried to use an unknown data structure as a PDL");
     else if( !( sv_derived_from( sv, "PDL") ) )
       croak("Error - tried to use an unknown Perl object type as a PDL");
 
-   sv2 = (SV*) SvRV(sv);
-
+    sv2 = (SV*) SvRV(sv);
 
-/* The below "CRUFTY" code is, I believe, intended to make (e.g.)
- * "$a = $b" copy the underlying PDL for $b, rather than simply
- * generating a reference to the same PDL.  It is commented out because
- * dataflow is the current default (you have to ask for a copy explicitly,
- * if you want one).
- *   --CED 16-Jan-2005
- */
-#ifdef OLD_CRUFTY_CODE_FOR_ASSIGNMENT_AVOIDANCE
-   /* Now, do magic: check if there are more than this one ref
-      to this internal sv. If there are, we've been "="'ed
-      (assigned) elsewhere and therefore must copy to keep
-      the semantics clear. This may at the moment be slightly
-      inefficient but as a future optimization, SvPDLV may be replaced
-      by SvPDLV_nodup in places where it is sure that this is ok. */
-
-   if(SvREFCNT(sv2) > 1) {
-   	pdl *tmp = (pdl *)SvIV(sv2);
-	pdl *pnew = pdl_hard_copy(tmp);
-   	printf("More than one ref; copying\n");
-
-	SetSV_PDL(sv,pnew);
-	ret = pnew;
-   } else {
-	   ret = INT2PTR(pdl *,SvIV(sv2));
-   }
-#else
+    /* Return the pdl * pointer */
     ret = INT2PTR(pdl *, SvIV(sv2));
-#endif
 
-   if(ret->magicno != PDL_MAGICNO) {
+    /* Final check -- make sure it has the right magic number */
+    if(ret->magicno != PDL_MAGICNO) {
    	croak("Fatal error: argument is probably not a piddle, or\
  magic no overwritten. You're in trouble, guv: %p %p %lu\n",sv2,ret,ret->magicno);
    }
@@ -469,12 +448,12 @@ SV* pdl_copy( pdl* a, char* option ) {
 
 /* Pack dims array - returns dims[] (pdl_malloced) and ndims */
 
-PDL_Long* pdl_packdims ( SV* sv, int *ndims ) {
+PDL_Indx* pdl_packdims ( SV* sv, int *ndims ) {
 
    SV*  bar;
    AV*  array;
    int i;
-   PDL_Long *dims;
+   PDL_Indx *dims;
 
    if (!(SvROK(sv) && SvTYPE(SvRV(sv))==SVt_PVAV))  /* Test */
        return NULL;
@@ -483,20 +462,20 @@ PDL_Long* pdl_packdims ( SV* sv, int *ndims ) {
 
    *ndims = (int) av_len(array) + 1;  /* Number of dimensions */
 
-   dims = (PDL_Long *) pdl_malloc( (*ndims) * sizeof(*dims) ); /* Array space */
+   dims = (PDL_Indx *) pdl_malloc( (*ndims) * sizeof(*dims) ); /* Array space */
    if (dims == NULL)
       croak("Out of memory");
 
    for(i=0; i<(*ndims); i++) {
       bar = *(av_fetch( array, i, 0 )); /* Fetch */
-      dims[i] = (int) SvIV(bar);
+      dims[i] = (PDL_Indx) SvIV(bar);
    }
    return dims;
 }
 
 /* unpack dims array into PDL SV* */
 
-void pdl_unpackdims ( SV* sv, PDL_Long *dims, int ndims ) {
+void pdl_unpackdims ( SV* sv, PDL_Indx *dims, int ndims ) {
 
    AV*  array;
    HV* hash;
@@ -504,7 +483,7 @@ void pdl_unpackdims ( SV* sv, PDL_Long *dims, int ndims ) {
 
    hash = (HV*) SvRV( sv );
    array = newAV();
-   hv_store(hash, "Dims", strlen("Dims"), newRV( (SV*) array), 0 );
+   (void)hv_store(hash, "Dims", strlen("Dims"), newRV( (SV*) array), 0 );
 
    if (ndims==0 )
       return;
@@ -513,11 +492,12 @@ void pdl_unpackdims ( SV* sv, PDL_Long *dims, int ndims ) {
          av_store( array, i, newSViv( (IV)dims[i] ) );
 }
 
-PDL_Long pdl_safe_indterm( PDL_Long dsz, PDL_Long at, char *file, int lineno)
+PDL_Indx pdl_safe_indterm( PDL_Indx dsz, PDL_Indx at, char *file, int lineno)
 {
   if (at >= 0 && at < dsz) return at;
   pdl_barf("access [%d] out of range [0..%d] (inclusive) at %s line %d",
           at, dsz-1, file?file:"?", lineno);
+  return at; // This can never happen - placed to avoid a compiler warning.
 }
 
 /*
@@ -620,7 +600,7 @@ GEN_PDL_BARF_OR_WARN_LEGACY(warn, 1)
  * They are all called by pdl_avref in Core.xs, which in turn is called by the constructors
  * in Core.pm.PL.
  *
- *
+ */
 
 /******************************
  * av_ndcheck -
@@ -649,9 +629,10 @@ GEN_PDL_BARF_OR_WARN_LEGACY(warn, 1)
  *  which is still Empty.
  */
 
-int av_ndcheck(AV* av, AV* dims, int level, int *datalevel)
+PDL_Indx av_ndcheck(AV* av, AV* dims, int level, int *datalevel)
 {
-  int i, len, oldlen, newdepth, depth = 0;
+  PDL_Indx i, len, oldlen;
+  int newdepth, depth = 0;
   int n_scalars = 0;
   SV *el, **elp;
   pdl *pdl;           /* Stores PDL argument */
@@ -678,15 +659,15 @@ int av_ndcheck(AV* av, AV* dims, int level, int *datalevel)
 	/* Recurse to find depth inside the array reference */
 	newdepth = 1 + av_ndcheck((AV *) SvRV(el), dims, level+1, datalevel);
 	
-      } else if ( pdl = SvPDLV(el) ) {
+      } else if ( (pdl = SvPDLV(el)) ) {
 	/* It is a PDL - walk down its dimension list, exactly as if it
 	 * were a bunch of nested array refs.  We pull the ndims and dims
 	 * fields out to local variables so that nulls can be treated specially.
 	 */
 	int j;
 	short pndims;
-	PDL_Long *pdims;
-	PDL_Long pnvals;
+	PDL_Indx *pdims;
+	PDL_Indx pnvals;
 	
 #ifdef DEBUG_SETAV_TYPE
 	printf("av_ndcheck - found a PDL....\n");
@@ -711,7 +692,7 @@ int av_ndcheck(AV* av, AV* dims, int level, int *datalevel)
 	for(j=0;j<pndims;j++) {
 	  int jl = pndims-j+level;
 	  
-	  int siz = pdims[j];
+	  PDL_Indx siz = pdims[j];
 	  
 	  if(  av_len(dims) >= jl &&
 	       av_fetch(dims,jl,0) != NULL &&
@@ -719,7 +700,7 @@ int av_ndcheck(AV* av, AV* dims, int level, int *datalevel)
 	    
 	    /* We have already found something that specifies this dimension -- so */ 
 	    /* we keep the size if possible, or enlarge if necessary.              */
-	    oldlen=(int)SvIV(*(av_fetch(dims,jl,0)));
+	    oldlen=(PDL_Indx)SvIV(*(av_fetch(dims,jl,0)));
 	    if(siz > oldlen) {
 	      sv_setiv(*(av_fetch(dims,jl,0)),(IV)(pdims[j]));
 	    }
@@ -778,7 +759,7 @@ int av_ndcheck(AV* av, AV* dims, int level, int *datalevel)
       fflush(stdout);
       for( i=0; i<dim; i++ ) {
 	  SV **svp = av_fetch(dims, i, 0);
-	  int k;
+	  PDL_Indx k;
 
 	  if(svp != NULL) {
 	      k = SvIV (*svp);
@@ -794,7 +775,7 @@ int av_ndcheck(AV* av, AV* dims, int level, int *datalevel)
   
     if (av_len(dims) >= level && av_fetch(dims, level, 0) != NULL
       && SvIOK(*(av_fetch(dims, level, 0)))) {
-    oldlen = (int) SvIV(*(av_fetch(dims, level, 0)));
+    oldlen = (PDL_Indx) SvIV(*(av_fetch(dims, level, 0)));
     
     if (len > oldlen)
       sv_setiv(*(av_fetch(dims, level, 0)), (IV) len);
@@ -812,7 +793,7 @@ int av_ndcheck(AV* av, AV* dims, int level, int *datalevel)
       SV **svp = av_fetch(dims, i, 0);
       if(!svp) {
 	av_store(dims, i, newSViv((IV)1));
-      } else if( (int)SvIV(*svp) == 0) {
+      } else if( (PDL_Indx)SvIV(*svp) == 0) {
 	sv_setiv(*svp, (IV)1);
       }
     }
@@ -821,7 +802,7 @@ int av_ndcheck(AV* av, AV* dims, int level, int *datalevel)
       SV **svp = av_fetch(dims, i, 0);
       if(!svp) {
 	av_store(dims, i, newSViv((IV)1));
-      } else if( (int)SvIV(*svp) == 0) {
+      } else if( (PDL_Indx)SvIV(*svp) == 0) {
 	sv_setiv(*svp, (IV)1);
       }
     }
@@ -840,7 +821,7 @@ int av_ndcheck(AV* av, AV* dims, int level, int *datalevel)
       fflush(stdout);
       for( i=0; i<dim; i++ ) {
 	  SV **svp = av_fetch(dims, i, 0);
-	  int k;
+	  PDL_Indx k;
 
 	  if(svp != NULL) {
 	      k = SvIV (*svp);
@@ -860,11 +841,11 @@ int av_ndcheck(AV* av, AV* dims, int level, int *datalevel)
 pdl* pdl_from_array(AV* av, AV* dims, int type, pdl* p)
 {
   int ndims, i, level=0;
-  PDL_Long *pdims;
+  PDL_Indx *pdims;
      double undefval;
 
   ndims = av_len(dims)+1;
-  pdims = (PDL_Long *) pdl_malloc( (ndims) * sizeof(*pdims) );
+  pdims = (PDL_Indx *) pdl_malloc( (ndims) * sizeof(*pdims) );
   for (i=0; i<ndims; i++) {
      pdims[i] = SvIV(*(av_fetch(dims, ndims-1-i, 0))); /* reverse order */
   }
@@ -969,7 +950,7 @@ print OUT <<"!WITH!SUBS!";
  *   It is offset to account for the difference in dimensionality between the input and
  *   output PDLs. It is allowed to be negative (which is equivalent to the "permissive
  *   slicing" that treats missing dimensions as present and having size 1), but should
- *   not match or exceed pdl->ndims.
+ *   not match or exceed pdl->ndims. 
  * pptr is the current offset data pointer into pdl->data.
  *
  * Kludge-copy works backward through the dim lists, so that padding is simpler:  if undefval
@@ -977,19 +958,19 @@ print OUT <<"!WITH!SUBS!";
  * block of memory.
  */
 
-long pdl_kludge_copy_$type(long poff,
+PDL_Indx pdl_kludge_copy_$type(PDL_Indx poff,
 			   PDL_$type* pdata,
-                           PDL_Long* pdims,
-                           PDL_Long ndims,
+                           PDL_Indx* pdims,
+                           PDL_Indx ndims,
                            int level,
-                           long stride,
+                           PDL_Indx stride,
                            pdl* pdl,
                            int plevel,
                            void* pptr,
 			   double undefval
 			   ) {
-  int i;
-  long undef_count = 0;
+  PDL_Indx i;
+  PDL_Indx undef_count = 0;
 
 #ifdef DEBUG_KLUDGE_COPY
   printf("entering pdl_kludge_copy: level=%d, ndims=%d, plevel=%d; pdl->ndims=%d\\n",level,ndims,plevel,pdl->ndims);
@@ -1003,7 +984,7 @@ long pdl_kludge_copy_$type(long poff,
   if(level >= ndims - 1) {
     /* In this case we are in as far as we can go in the destination PDL, so direct copying is in order. */
     int pdldim = pdl->ndims - 1 - plevel;
-    int pdlsiz;
+    PDL_Indx pdlsiz;
     int oob = (ndims-1-level < 0);
 
     /* Do bounds checking on the source dimension -- if we wander off the end, we
@@ -1055,7 +1036,7 @@ long pdl_kludge_copy_$type(long poff,
 	/* pad out, in the innermost dimension */
 #ifdef DEBUG_KLUDGE_COPY
       fprintf(stderr,"padding; "); fflush(stderr);
-      fprintf(stderr," ndims-1-level=%d; ndims=%d, level=%d; plevel=%d; pdl->ndims=%d; poff=%d; oob=%d\\n", ndims-1-level,ndims, level, plevel, pdl->ndims, poff, oob);
+      fprintf(stderr," ndims-1-level=%d; ndims=%d, level=%d; plevel=%d; pdl->ndims=%d; poff=%ld; oob=%d\\n", ndims-1-level,ndims, level, plevel, pdl->ndims, poff, oob);
 #endif
       if( !oob ) {
 	for(;  i< pdims[0]-poff; i++) {
@@ -1087,7 +1068,7 @@ long pdl_kludge_copy_$type(long poff,
   /* If we're here we're not at the bottom level yet... */
 #ifdef DEBUG_KLUDGE_COPY
   printf("Entering PKC recursion loop.  imax is %d (plevel=%d; pdl->dims[%d-1-%d] = %d)\\n",
-	 (   (plevel >= 0)   ?   (pdl->dims[ pdl->ndims - 1 - level ])   :   1    ),
+	 (   (plevel >= 0 && (pdl->ndims - 1 - plevel >= 0) && (pdl->ndims - 1 - plevel < pdl->ndims))   ?   (pdl->dims[ pdl->ndims - 1 - plevel ])   :   1    ),
 	 plevel,
 	 ndims,
 	 plevel,
@@ -1133,7 +1114,7 @@ long pdl_kludge_copy_$type(long poff,
   /* pad tree to zero if there are not enough elements... */
 #ifdef DEBUG_KLUDGE_COPY
   printf("   pdl_kludge_copy - finished recursion  loop at level %d... i is %d, pdims[%d]=%d...\\n",
-	 level, i, ndims - 1 - level);
+	 level, i, ndims - 1 - level,pdims[ndims - 1 - level]);
 #endif
 
   if(i < pdims[ndims - 1 - level]) {
@@ -1198,16 +1179,16 @@ long pdl_kludge_copy_$type(long poff,
  *   -  level is the recursion level, which is also the dimension that we are filling
  */
 
-long pdl_setav_$type(PDL_$type* pdata, AV* av,
-		     PDL_Long* pdims, PDL_Long ndims, int level, double undefval)
+PDL_Indx pdl_setav_$type(PDL_$type* pdata, AV* av,
+		     PDL_Indx* pdims, PDL_Long ndims, int level, double undefval)
 {
-  int cursz = pdims[ndims-1-level]; /* we are starting from the highest dim
+  PDL_Indx cursz = pdims[ndims-1-level]; /* we are starting from the highest dim
                                        inwards */
-  int len = av_len(av);
-  int i,stride=1;
+  PDL_Indx len = av_len(av);
+  PDL_Indx i,stride=1;
 
   SV *el, **elp;
-  long undef_count = 0;
+  PDL_Indx undef_count = 0;
 
   fflush(stdout);
 
@@ -1262,7 +1243,7 @@ long pdl_setav_$type(PDL_$type* pdata, AV* av,
 
     } else if( el && SvROK(el) ) {
       pdl *pdl;
-      if( pdl = SvPDLV(el) ) {
+      if( (pdl = SvPDLV(el)) ) {
 
 	pdl_make_physical(pdl);
 
@@ -1292,7 +1273,10 @@ long pdl_setav_$type(PDL_$type* pdata, AV* av,
 	  }
 #endif
 	  {
-	    int pd = pdims[ ndims - 2 - level];
+	    PDL_Indx pd;
+	    int pddex;
+	    pddex = ndims - 2 - level;
+	    pd = (pddex >= 0 && pddex < ndims ? pdims[ pddex ] : 0);
 	    if(!pd)
 	      pd = 1;
 	    undef_count += pdl_kludge_copy_$type(0, pdata,pdims,ndims, level+1, stride / pd , pdl, 0, pdl->data,undefval);
@@ -22,9 +22,10 @@ use vars qw( %PDL_DATATYPES );
 #   for pthreading (i.e. multi-threading) capabilities
 # version 8 for beginning support for >2GiB piddles
 # version 9 for STRLEN/Size_t/Off_t for mmap delete magic
+# version 10 for 64bit index support (PDL index datatype)
 #
 use vars qw( $pdl_core_version );
-$pdl_core_version = 8;
+$pdl_core_version = 10;
 
 # List explicitly here the variables you want Configure to
 # generate.  Metaconfig only looks for shell variables, so you
@@ -132,16 +133,16 @@ int     pdl_howbig (int datatype);           /* Size of data type (bytes) */
 pdl*    SvPDLV ( SV* sv );                   /* Map SV* to pdl struct */
 void	SetSV_PDL( SV *sv, pdl *it );	     /* Outputting a pdl from.. */
 SV*     pdl_copy( pdl* a, char* option );     /* call copy method */
-PDL_Long *    pdl_packdims ( SV* sv, int*ndims ); /* Pack dims[] into SV aref */
-void    pdl_unpackdims ( SV* sv, PDL_Long *dims,  /* Unpack */
+PDL_Indx *    pdl_packdims ( SV* sv, int*ndims ); /* Pack dims[] into SV aref */
+void    pdl_unpackdims ( SV* sv, PDL_Indx *dims,  /* Unpack */
                          int ndims );
 void*   pdl_malloc ( STRLEN nbytes );           /* malloc memory - auto free()*/
 
 void pdl_makescratchhash(pdl *ret,double data, int datatype);
-PDL_Long pdl_safe_indterm(PDL_Long dsz, PDL_Long at, char *file, int lineno);
+PDL_Indx pdl_safe_indterm(PDL_Indx dsz, PDL_Indx at, char *file, int lineno);
 void pdl_barf(const char* pat,...); /* General croaking utility */
 void pdl_warn(const char* pat,...); /* General warn utility */
-int av_ndcheck(AV* av, AV* dims, int level, int *datalevel);
+PDL_Indx av_ndcheck(AV* av, AV* dims, int level, int *datalevel);
 pdl* pdl_from_array(AV* av, AV* dims, int type, pdl* p);
 
 !NO!SUBS!
@@ -150,8 +151,8 @@ for my $in ( keys %PDL_DATATYPES ) {
 
   (my $type = $PDL_DATATYPES{$in}) =~ s/^PDL_//;
   print OUT <<"!WITH!SUBS!";
-long pdl_setav_$type(PDL_$type* pdata, AV* av,
-	PDL_Long* pdims, PDL_Long ndims, int level, double undefval);
+PDL_Indx pdl_setav_$type(PDL_$type* pdata, AV* av,
+	PDL_Indx* pdims, PDL_Long ndims, int level, double undefval);
 !WITH!SUBS!
 }
 
@@ -183,31 +184,31 @@ pdl* pdl_external_new();
 pdl* pdl_external_tmp();
 pdl* pdl_create(int type);
 void pdl_destroy(pdl *it);
-void pdl_setdims(pdl* it, PDL_Long* dims, int ndims);
+void pdl_setdims(pdl* it, PDL_Indx* dims, int ndims);
 void pdl_reallocdims ( pdl *it,int ndims );  /* reallocate dims and incs */
 void pdl_reallocthreadids ( pdl *it,int ndims );  /* reallocate threadids */
 void pdl_resize_defaultincs ( pdl *it );     /* Make incs out of dims */
-void pdl_unpackarray ( HV* hash, char *key, int *dims, int ndims );
+void pdl_unpackarray ( HV* hash, char *key, PDL_Indx *dims, int ndims );
 void pdl_print(pdl *it);
 void pdl_dump(pdl *it);
 void pdl_allocdata(pdl *it);
 
-int *pdl_get_threadoffsp(pdl_thread *thread); /* For pthreading */
+PDL_Indx *pdl_get_threadoffsp(pdl_thread *thread); /* For pthreading */
 void pdl_thread_copy(pdl_thread *from,pdl_thread *to);
 void pdl_clearthreadstruct(pdl_thread *it);
-void pdl_initthreadstruct(int nobl,pdl **pdls,int *realdims,int *creating,int npdls,
+void pdl_initthreadstruct(int nobl,pdl **pdls,PDL_Indx *realdims,PDL_Indx *creating,int npdls,
 	pdl_errorinfo *info,pdl_thread *thread,char *flags, int noPthreadFlag );
 int pdl_startthreadloop(pdl_thread *thread,void (*func)(pdl_trans *),pdl_trans *);
 int pdl_iterthreadloop(pdl_thread *thread,int which);
 void pdl_freethreadloop(pdl_thread *thread);
-void pdl_thread_create_parameter(pdl_thread *thread,int j,int *dims,
+void pdl_thread_create_parameter(pdl_thread *thread,int j,PDL_Indx *dims,
 				 int temp);
 void pdl_croak_param(pdl_errorinfo *info,int paramIndex, char *pat, ...);
 
 void pdl_setdims_careful(pdl *pdl);
-void pdl_put_offs(pdl *pdl,PDL_Long offs, double val);
-double pdl_get_offs(pdl *pdl,PDL_Long offs);
-double pdl_get(pdl *pdl,int *inds);
+void pdl_put_offs(pdl *pdl,PDL_Indx offs, double val);
+double pdl_get_offs(pdl *pdl,PDL_Indx offs);
+double pdl_get(pdl *pdl,PDL_Indx *inds);
 void pdl_set_trans(pdl *it, pdl *parent, pdl_transvtable *vtable);
 
 void pdl_make_physical(pdl *it);
@@ -231,7 +232,7 @@ void    pdl_fillcache_partial( HV *hash, pdl *thepdl ) ;
 SV*     pdl_getKey( HV* hash, char* key );  /* Get $$x{Key} SV* with deref */
 void pdl_flushcache( pdl *thepdl );	     /* flush cache */
 
-/* pdlfamily.c */
+/* pdlfamily.c */ /* DOES NOT APPEAR TO EXIST ANY MORE!!! */
 
 void pdl_family_create(pdl *from,pdl_trans *trans,int ind1,int ind2);
 pdl *pdl_family_clone2now(pdl *from); /* Use pdl_make_now instead */
@@ -246,26 +247,26 @@ void   pdl_swap(pdl** a, pdl** b);             /* Swap two pdl ptrs */
 void   pdl_converttype( pdl** a, int targtype, /* Change type of a pdl */
                         Logical changePerl );
 void   pdl_coercetypes( pdl** a, pdl **b, Logical changePerl ); /* Two types to same */
-void   pdl_grow  ( pdl* a, int newsize);      /* Change pdl 'Data' size */
+void   pdl_grow  ( pdl* a, PDL_Indx newsize);   /* Change pdl 'Data' size */
 void   pdl_retype( pdl* a, int newtype);      /* Change pdl 'Datatype' value */
 void** pdl_twod( pdl* x );                    /* Return 2D pointer to data array */
 
 /* pdlsections.c */
 
-int  pdl_get_offset(PDL_Long* pos, PDL_Long* dims, PDL_Long *incs, PDL_Long offset, int ndims);      /* Offset of pixel x,y,z... */
-int  pdl_validate_section( int* sec, int* dims,           /* Check section */
+PDL_Indx  pdl_get_offset(PDL_Indx* pos, PDL_Indx* dims, PDL_Indx *incs, PDL_Indx offset, int ndims);      /* Offset of pixel x,y,z... */
+PDL_Indx  pdl_validate_section( PDL_Indx* sec, PDL_Indx* dims,           /* Check section */
                            int ndims );
-void pdl_row_plusplus ( int* pos, int* dims,              /* Move down one row */
+void pdl_row_plusplus ( PDL_Indx* pos, PDL_Indx* dims,              /* Move down one row */
                         int ndims );
 void pdl_subsection( char *y, char*x, int datatype,      /* Take subsection */
-                 int* sec, int* dims, int *incs, int offset, int* ndims);
-void pdl_insertin( char*y, int* ydims, int nydims,        /* Insert pdl in pdl */
-                   char*x, int* xdims, int nxdims,
-                   int datatype, int* pos);
-double pdl_at( void* x, int datatype, PDL_Long* pos, PDL_Long* dims, /* Value at x,y,z,... */
-             PDL_Long *incs, PDL_Long offset, int ndims);
-void  pdl_set( void* x, int datatype, PDL_Long* pos, PDL_Long* dims, /* Set value at x,y,z... */
-                PDL_Long *incs, PDL_Long offs, int ndims, double value);
+                 PDL_Indx* sec, PDL_Indx* dims, PDL_Indx *incs, PDL_Indx offset, int* ndims);
+void pdl_insertin( char*y, PDL_Indx* ydims, int nydims,        /* Insert pdl in pdl */
+                   char*x, PDL_Indx* xdims, int nxdims,
+                   int datatype, PDL_Indx* pos);
+double pdl_at( void* x, int datatype, PDL_Indx* pos, PDL_Indx* dims, /* Value at x,y,z,... */
+             PDL_Indx *incs, PDL_Indx offset, int ndims);
+void  pdl_set( void* x, int datatype, PDL_Indx* pos, PDL_Indx* dims, /* Set value at x,y,z... */
+                PDL_Indx *incs, PDL_Indx offs, int ndims, double value);
 void pdl_axisvals( pdl* a, int axis );               /* Fill with axis values */
 
 /* Structure to hold pointers core PDL routines so as to be used by many modules */
@@ -289,11 +290,11 @@ struct Core {
     void** (*twod)        ( pdl* );
     void*  (*smalloc)      ( STRLEN );
     int    (*howbig)      ( int );
-    PDL_Long*   (*packdims)    ( SV* sv, int *ndims ); /* Pack dims[] into SV aref */
-    void   (*setdims)     ( pdl* it, PDL_Long* dims, int ndims );
-    void   (*unpackdims)  ( SV* sv, PDL_Long *dims,    /* Unpack */
+    PDL_Indx*   (*packdims)    ( SV* sv, int *ndims ); /* Pack dims[] into SV aref */
+    void   (*setdims)     ( pdl* it, PDL_Indx* dims, int ndims );
+    void   (*unpackdims)  ( SV* sv, PDL_Indx *dims,    /* Unpack */
                             int ndims );
-    void   (*grow)        ( pdl* a, int newsize); /* Change pdl 'Data' size */
+    void   (*grow)        ( pdl* a, PDL_Indx newsize); /* Change pdl 'Data' size */
     void (*flushcache)( pdl *thepdl );	     /* flush cache */
     void (*reallocdims) ( pdl *it,int ndims );  /* reallocate dims and incs */
     void (*reallocthreadids) ( pdl *it,int ndims );
@@ -301,21 +302,22 @@ struct Core {
 
 void (*thread_copy)(pdl_thread *from,pdl_thread *to);
 void (*clearthreadstruct)(pdl_thread *it);
-void (*initthreadstruct)(int nobl,pdl **pdls,int *realdims,int *creating,int npdls,
+void (*initthreadstruct)(int nobl,pdl **pdls,PDL_Indx *realdims,PDL_Indx *creating,int npdls,
 	pdl_errorinfo *info,pdl_thread *thread,char *flags, int noPthreadFlag );
 int (*startthreadloop)(pdl_thread *thread,void (*func)(pdl_trans *),pdl_trans *);
-int *(*get_threadoffsp)(pdl_thread *thread); /* For pthreading */
+PDL_Indx *(*get_threadoffsp)(pdl_thread *thread); /* For pthreading */
 int (*iterthreadloop)(pdl_thread *thread,int which);
 void (*freethreadloop)(pdl_thread *thread);
-void (*thread_create_parameter)(pdl_thread *thread,int j,int *dims,
+void (*thread_create_parameter)(pdl_thread *thread,int j,PDL_Indx *dims,
 				int temp);
 void (*add_deletedata_magic) (pdl *it,void (*func)(pdl *, Size_t param), Size_t param); /* Automagic destructor */
+                             /* This needs to be fixed to work correctly for File::Map implementation */
 
 /* XXX NOT YET IMPLEMENTED */
 void (*setdims_careful)(pdl *pdl);
-void (*put_offs)(pdl *pdl,PDL_Long offs, double val);
-double (*get_offs)(pdl *pdl,PDL_Long offs);
-double (*get)(pdl *pdl,int *inds);
+void (*put_offs)(pdl *pdl,PDL_Indx offs, double val);
+double (*get_offs)(pdl *pdl,PDL_Indx offs);
+double (*get)(pdl *pdl,PDL_Indx *inds);
 void (*set_trans_childtrans)(pdl *it, pdl_trans *trans,int nth);
 void (*set_trans_parenttrans)(pdl *it, pdl_trans *trans,int nth);
 pdl *(*make_now)(pdl *it);
@@ -328,7 +330,7 @@ void (*make_trans_mutual)(pdl_trans *trans);
    and not in Core.xs ! */
 void (*readdata_affine)(pdl_trans *tr);
 void (*writebackdata_affine)(pdl_trans *tr);
-void (*affine_new)(pdl *par,pdl *child,int offs,SV *dims,SV *incs);
+void (*affine_new)(pdl *par,pdl *child,PDL_Indx offs,SV *dims,SV *incs);
 
 /* Converttype. Similar */
 void (*converttypei_new)(pdl *par,pdl *child,int type);
@@ -342,7 +344,7 @@ void (*pdl_warn) (const char* pat,...);
 
 void (*make_physvaffine)(pdl *it);
 void (*allocdata) (pdl *it);
-PDL_Long (*safe_indterm)(PDL_Long dsz, PDL_Long at, char *file, int lineno);
+PDL_Indx (*safe_indterm)(PDL_Indx dsz, PDL_Indx at, char *file, int lineno);
 
 float NaN_float;
 double NaN_double;
@@ -359,8 +361,8 @@ for (keys %PDL::Types::typehash) {
    my $ctype = $PDL::Types::typehash{$_}{ctype};
    my $ppsym = $PDL::Types::typehash{$_}{ppsym};
 
-   print OUT "void (*qsort_${ppsym}) (${ctype} *xx, int a, int b );\n";
-   print OUT "void (*qsort_ind_${ppsym}) (${ctype} *xx, int *ix, int a, int b );\n";
+   print OUT "void (*qsort_${ppsym}) (${ctype} *xx, PDL_Indx a, PDL_Indx b );\n";
+   print OUT "void (*qsort_ind_${ppsym}) (${ctype} *xx, PDL_Indx *ix, PDL_Indx a, PDL_Indx b );\n";
 }
 
 # storage space for bad values
@@ -26,7 +26,7 @@ void pdl_freedata (pdl *a) {
 
 /*  Utility to change the size of the data compt of a pdl */
 
-void pdl_grow (pdl* a, int newsize) {
+void pdl_grow (pdl* a, PDL_Indx newsize) {
 
    SV* foo;
    HV* hash;
@@ -70,13 +70,13 @@ void pdl_grow (pdl* a, int newsize) {
 
 /* unpack dims array into Hash */
 
-void pdl_unpackarray ( HV* hash, char *key, int *dims, int ndims ) {
+void pdl_unpackarray ( HV* hash, char *key, PDL_Indx *dims, int ndims ) {
 
    AV*  array;
    int i;
 
    array = newAV();
-   hv_store(hash, key, strlen(key), newRV( (SV*) array), 0 );
+   (void)hv_store(hash, key, strlen(key), newRV( (SV*) array), 0 );
 
    if (ndims==0 )
       return;
@@ -323,8 +323,8 @@ void pdl_magic_thread_cast(pdl *it,void (*func)(pdl_trans *),pdl_trans *t, pdl_t
 	tp = malloc(sizeof(pthread_t) * thread->mag_nthr);
 	tparg = malloc(sizeof(*tparg) * thread->mag_nthr);
 	pthread_key_create(&(ptr->key),NULL);
-	/* if(TVERB) printf("CREATING THREADS, ME: %d, key: %d\n",pthread_self(), ptr->key); */
-	if(TVERB) printf("CREATING THREADS, ME: TBD, key: %d\n", ptr->key);
+
+	if(TVERB) printf("CREATING THREADS, ME: TBD, key: %ld\n", (unsigned long)(ptr->key));
 
 	/* Get the pthread ID of this main thread we are in.
 	 *	Any barf, warn, etc calls in the spawned pthreads can use this
@@ -342,13 +342,15 @@ void pdl_magic_thread_cast(pdl *it,void (*func)(pdl_trans *),pdl_trans *t, pdl_t
             die("Unable to create pthreads!");
         }
     }
-	/* if(TVERB) printf("JOINING THREADS, ME: %d, key: %d\n",pthread_self(), ptr->key); */
-	if(TVERB) printf("JOINING THREADS, ME: TBD, key: %d\n", ptr->key);
+
+    if(TVERB) printf("JOINING THREADS, ME: TBD, key: %ld\n", (unsigned long)(ptr->key));
+
 	for(i=0; i<thread->mag_nthr; i++) {
 		pthread_join(tp[i], NULL);
 	}
-	/* if(TVERB) printf("FINISHED THREADS, ME: %d, key: %d\n",pthread_self(), ptr->key); */
-	if(TVERB) printf("FINISHED THREADS, ME: TBD, key: %d\n", ptr->key);
+
+	if(TVERB) printf("FINISHED THREADS, ME: TBD, key: %ld\n", (unsigned long)(ptr->key));
+
 	pthread_key_delete((ptr->key));
 
 	/* Remove pthread magic if we created in this function */
@@ -20,9 +20,9 @@
 
 /* Compute offset of (x,y,z,...) position in row-major list */
 
-int pdl_get_offset(PDL_Long* pos, PDL_Long* dims, PDL_Long *incs, PDL_Long offset, int ndims) {
+PDL_Indx pdl_get_offset(PDL_Indx* pos, PDL_Indx* dims, PDL_Indx *incs, PDL_Indx offset, int ndims) {
    int i;
-   int result;
+   PDL_Indx result;
    result = offset;
    for (i=0; i<ndims; i++) {
        result = result + (pos[i]+((pos[i]<0)?dims[i]:0))*incs[i];
@@ -32,9 +32,9 @@ int pdl_get_offset(PDL_Long* pos, PDL_Long* dims, PDL_Long *incs, PDL_Long offse
 
 /* Check validity of section - return number of elements in it */
 
-int pdl_validate_section( int* sec, int* dims, int ndims ){
+PDL_Indx pdl_validate_section( PDL_Indx* sec, PDL_Indx* dims, int ndims ){
 
-   int i,start,end,count;
+   PDL_Indx i,start,end,count;
 
    count=1;
 
@@ -56,7 +56,7 @@ int pdl_validate_section( int* sec, int* dims, int ndims ){
 
 /* Increrement a position pointer array by one row */
 
-void pdl_row_plusplus ( int* pos, int* dims, int ndims ) {
+void pdl_row_plusplus ( PDL_Indx* pos, PDL_Indx* dims, int ndims ) {
 
     int i, noescape;
 
@@ -83,19 +83,20 @@ void pdl_row_plusplus ( int* pos, int* dims, int ndims ) {
 
 #ifdef FOOBAR
 
-void pdl_subsection( char *y, char*x, int datatype, int* sec,
-                     int* dims, int *incs, int offs, int* ndims) {
+void pdl_subsection( char *y, char*x, int datatype, PDL_Indx* sec,
+                     PDL_Indx* dims, PDL_Indx *incs, PDL_Indx offs, int* ndims) {
 
 
    /* Note dims, ndims are altered and returned to reflect the new section */
 
-   int *start,*end;
+   PDL_Indx *start,*end;
    int i,n1,n2,nrow,count,dsize;
+   PDL_Indx n1,n2,nrow,count;
 
    /* Seperate section into start and end arrays - KISS! */
 
-   start = (int *) pdl_malloc( (*ndims)*sizeof(int) );
-   end   = (int *) pdl_malloc( (*ndims)*sizeof(int) );
+   start = (PDL_Indx *) pdl_malloc( (*ndims)*sizeof(PDL_Indx) );
+   end   = (PDL_Indx *) pdl_malloc( (*ndims)*sizeof(PDL_Indx) );
 
    if (start == NULL || end == NULL)
        croak("Out of memory");
@@ -145,13 +146,14 @@ void pdl_subsection( char *y, char*x, int datatype, int* sec,
 
 /* Insert one N-dimensional array in another */
 
-void pdl_insertin( char*y, int* ydims, int nydims,
-                   char*x, int* xdims, int nxdims,
-                   int datatype, int* pos) {
+void pdl_insertin( char*y, PDL_Indx* ydims, int nydims,
+                   char*x, PDL_Indx* xdims, int nxdims,
+                   int datatype, PDL_Indx* pos) {
 
    /* Note inserts x[] in y[] */
 
-   int i,nyvals,nxvals,n1,n2,nrow,ntran,dsize;
+   int i,dsize;
+   PDL_Indx nyvals,nxvals,n1,n2,nrow,ntran;
 
    nyvals = 1; nxvals = 1;
 
@@ -202,10 +204,11 @@ void pdl_insertin( char*y, int* ydims, int nydims,
 
 /* Return value at position (x,y,z...) */
 
-double pdl_at( void* x, int datatype, PDL_Long* pos, PDL_Long* dims, 
-	PDL_Long *incs, PDL_Long offset, int ndims) {
+double pdl_at( void* x, int datatype, PDL_Indx* pos, PDL_Indx* dims, 
+	PDL_Indx* incs, PDL_Indx offset, int ndims) {
 
     int i;
+    PDL_Indx ioff;
     double result;
 
     for(i=0; i<ndims; i++) { /* Check */
@@ -217,12 +220,12 @@ double pdl_at( void* x, int datatype, PDL_Long* pos, PDL_Long* dims,
           croak("Position out of range");
     }
 
-   i = pdl_get_offset(pos, dims, incs, offset, ndims);
+   ioff = pdl_get_offset(pos, dims, incs, offset, ndims);
 
    GENERICLOOP (datatype)
 
       generic *xx = (generic *) x;
-      result = (double)xx[i];
+      result = (double)xx[ioff];
 
    ENDGENERICLOOP
 
@@ -236,9 +239,10 @@ double pdl_at( void* x, int datatype, PDL_Long* pos, PDL_Long* dims,
 
 /* Set value at position (x,y,z...) */
 
-void pdl_set( void* x, int datatype, PDL_Long* pos, PDL_Long* dims, PDL_Long *incs, PDL_Long offs, int ndims, double value){
+void pdl_set( void* x, int datatype, PDL_Indx* pos, PDL_Indx* dims, PDL_Indx* incs, PDL_Indx offs, int ndims, double value){
 
     int i;
+    PDL_Indx ioff;
 
     for(i=0; i<ndims; i++) { /* Check */
 
@@ -246,12 +250,12 @@ void pdl_set( void* x, int datatype, PDL_Long* pos, PDL_Long* dims, PDL_Long *in
           croak("Position out of range");
     }
 
-   i = pdl_get_offset(pos, dims, incs, offs, ndims);
+   ioff = pdl_get_offset(pos, dims, incs, offs, ndims);
 
    GENERICLOOP (datatype)
 
       generic *xx = (generic *) x;
-      xx[i] = value;
+      xx[ioff] = value;
 
    ENDGENERICLOOP
 }
@@ -47,11 +47,11 @@ $PDL_DATATYPES
 */
 
 struct pdlsimple {
-   int    datatype;  /* whether byte/int/float etc. */
-   void  *data;      /* Generic pointer to the data block */
-   int    nvals;     /* Number of data values */
-   PDL_Long   *dims; /* Array of data dimensions */
-   int    ndims;     /* Number of data dimensions */
+   int     datatype;  /* whether byte/int/float etc. */
+   void       *data;  /* Generic pointer to the data block */
+   PDL_Indx  nvals;  /* Number of data values */
+   PDL_Indx  *dims;  /* Array of data dimensions */
+   PDL_Long   ndims;  /* Number of data dimensions */
 };
 
 typedef struct pdlsimple pdlsimple;
@@ -18,10 +18,10 @@
  *
  * DJB 2007 March 18. Previous version is v1.6 of pdlthread.c
  */
-static int *copy_int_array (int *from, int size) {
+static PDL_Indx *copy_int_array (PDL_Indx *from, int size) {
   int *to;
   Newx (to, size, int);
-  return (int *) CopyD (from, to, size, int);
+  return (PDL_Indx *) CopyD (from, to, size, int);
 }
 
 static pdl **copy_pdl_array (pdl **from, int size) {
@@ -30,11 +30,12 @@ static pdl **copy_pdl_array (pdl **from, int size) {
   return (pdl **) CopyD (from, to, size, pdl*);
 }
 
-static void print_iarr(int *iarr, int n) {
+static void print_iarr(PDL_Indx *iarr, int n) {
   int i;
   printf("(");
   for (i=0;i<n;i++)
-    printf("%s%d",(i?" ":""),iarr[i]);
+    // printf("%s%d",(i?" ":""),iarr[i]);
+    printf("%s%lld",(i?" ":""),iarr[i]);  // hardwire for test, get from %Config
   printf(")");
 }
 
@@ -73,7 +74,7 @@ void dump_thread(pdl_thread *thread) {
    Input: thread structure
    Outputs: Pointer to pthread-specific offset array (returned by function)
 */
-int *pdl_get_threadoffsp(pdl_thread *thread )
+PDL_Indx *pdl_get_threadoffsp(pdl_thread *thread )
 {
   if(thread->gflags & PDL_THREAD_MAGICKED) {
   	int thr = pdl_magic_get_thread(thread->pdls[thread->mag_nthpdl]);
@@ -92,7 +93,7 @@ int *pdl_get_threadoffsp(pdl_thread *thread )
 	    Pthread index for the current pthread   ( nthr supplied and modified by function)
 
 */
-int *pdl_get_threadoffsp_int(pdl_thread *thread, int *nthr, int **inds)
+PDL_Indx* pdl_get_threadoffsp_int(pdl_thread *thread, int *nthr, PDL_Indx **inds)
 {
   if(thread->gflags & PDL_THREAD_MAGICKED) {
   	int thr = pdl_magic_get_thread(thread->pdls[thread->mag_nthpdl]);
@@ -167,10 +168,11 @@ void pdl_clearthreadstruct(pdl_thread *it) {
    noPthreadFlag is a flag indicating that the pdl thread that called this function is not multiple
      processor threading safe, so no pthreading magic will be added
 */
-void 	pdl_autopthreadmagic( pdl **pdls, int npdls, int * realdims, int* creating, int noPthreadFlag ){
+void 	pdl_autopthreadmagic( pdl **pdls, int npdls, PDL_Indx* realdims, PDL_Indx* creating, int noPthreadFlag ){
 
-	int j, nthrd, totalDims, *nthreadedDims, **threadedDims, **threadedDimSizes;
-	int largest_nvals = 0;  /* The largest PDL size for all the pdls involvled */
+	int j, nthrd, totalDims, *nthreadedDims, **threadedDims;
+    PDL_Indx **threadedDimSizes;
+	PDL_Indx largest_nvals = 0;  /* The largest PDL size for all the pdls involvled */
 
 	int t;             /* Thread index for each pdl */
 	int tdimStart;    /* Start of the threaded dims for each pdl */
@@ -190,7 +192,6 @@ void 	pdl_autopthreadmagic( pdl **pdls, int npdls, int * realdims, int* creating
 	/* Remove any existing threading magic */
 	for(j=0; j<npdls; j++) {
 		if(creating[j]) continue;
-		nthrd;
 
 		/* Remove thread magic, if there is some set for this pdl */
 		if( pdls[j]->magic &&
@@ -221,7 +222,7 @@ void 	pdl_autopthreadmagic( pdl **pdls, int npdls, int * realdims, int* creating
 	/* Build int arrays of threaded dim numbers and sizes for each pdl */
 	nthreadedDims     = (int*)  malloc(sizeof(int)   * (npdls));
 	threadedDims      = (int**) malloc(sizeof(int *) * (npdls));
-	threadedDimSizes  = (int**) malloc(sizeof(int *) * (npdls));
+	threadedDimSizes  = (PDL_Indx**) malloc(sizeof(PDL_Indx *) * (npdls));
 
 
 	/* Find total number of dims and allocate */
@@ -229,7 +230,7 @@ void 	pdl_autopthreadmagic( pdl **pdls, int npdls, int * realdims, int* creating
 	for(j=0; j<npdls; j++) {
 		if(creating[j]) continue;
 		threadedDims[j]     = (int*) malloc(sizeof(int) * pdls[j]->ndims);
-		threadedDimSizes[j] = (int*) malloc(sizeof(int) * pdls[j]->ndims);
+		threadedDimSizes[j] = (PDL_Indx*) malloc(sizeof(PDL_Indx) * pdls[j]->ndims);
 	}
 
 
@@ -328,7 +329,7 @@ void 	pdl_autopthreadmagic( pdl **pdls, int npdls, int * realdims, int* creating
  *   (i.e. don't attempt to create multiple posix threads to execute)
  */
 void pdl_initthreadstruct(int nobl,
-	pdl **pdls,int *realdims,int *creating,int npdls,
+	pdl **pdls,PDL_Indx *realdims,PDL_Indx *creating,int npdls,
 	pdl_errorinfo *info,pdl_thread *thread, char *flags, int noPthreadFlag ) {
 	int i; int j;
 	int ndims=0; int nth;
@@ -435,16 +436,16 @@ void pdl_initthreadstruct(int nobl,
 	thread->ndims = ndims;
 	thread->nimpl = nimpl;
 
-      Newx(thread->inds, thread->ndims * (nthr>0 ? nthr : 1), int); /* Create space for pthread-specific inds (i.e. copy for each pthread)*/
+      Newx(thread->inds, thread->ndims * (nthr>0 ? nthr : 1), PDL_Indx); /* Create space for pthread-specific inds (i.e. copy for each pthread)*/
       if(thread->inds == NULL) croak("Failed to allocate memory for thread->inds in pdlthread.c");
 
-      Newx(thread->dims, thread->ndims, int);
+      Newx(thread->dims, thread->ndims, PDL_Indx);
       if(thread->dims == NULL) croak("Failed to allocate memory for thread->dims in pdlthread.c");
 
-      Newx(thread->offs, thread->npdls * (nthr>0 ? nthr : 1), int); /* Create space for pthread-specific offs */
+      Newx(thread->offs, thread->npdls * (nthr>0 ? nthr : 1), PDL_Indx); /* Create space for pthread-specific offs */
       if(thread->offs == NULL) croak("Failed to allocate memory for thread->offs in pdlthread.c");
 
-      Newx(thread->incs, thread->ndims * npdls, int);
+      Newx(thread->incs, thread->ndims * npdls, PDL_Indx);
       if(thread->incs == NULL) croak("Failed to allocate memory for thread->incs in pdlthread.c");
 
       Newx(thread->flags, npdls, char);
@@ -550,7 +551,7 @@ void pdl_initthreadstruct(int nobl,
 	PDLDEBUG_f(dump_thread(thread);)
 }
 
-void pdl_thread_create_parameter(pdl_thread *thread,int j,int *dims,
+void pdl_thread_create_parameter(pdl_thread *thread,int j,PDL_Indx *dims,
 				 int temp)
 {
 	int i;
@@ -582,8 +583,8 @@ See the manual for why this is impossible");
 int pdl_startthreadloop(pdl_thread *thread,void (*func)(pdl_trans *),
 			pdl_trans *t) {
 	int i,j;
-	int *offsp; int nthr;
-	int *inds;
+	PDL_Indx *offsp; int nthr;
+	PDL_Indx *inds;
 	if(  (thread->gflags & (PDL_THREAD_MAGICKED | PDL_THREAD_MAGICK_BUSY))
 	     == PDL_THREAD_MAGICKED ) {
 
@@ -618,8 +619,8 @@ int pdl_iterthreadloop(pdl_thread *thread,int nth) {
 	int i,j;
 	int stop = 0;
 	int stopdim;
-	int *offsp; int nthr;
-	int *inds;
+	PDL_Indx *offsp; int nthr;
+	PDL_Indx *inds;
 	offsp = pdl_get_threadoffsp_int(thread,&nthr, &inds);
 	for(j=0; j<thread->npdls; j++)
 		offsp[j] = PDL_TREPROFFS(thread->pdls[j],thread->flags[j]);
@@ -39,12 +39,12 @@ typedef struct pdl_thread {
 	int nimpl;	/* Number of these that are implicit */
 	int npdls;	/* Number of pdls involved */
 	int nextra;
-	int *inds;	/* Indices for each of the dimensions */
-	int *dims;	/* Dimensions of each dimension */
-	int *offs;	/* Offsets for each of the pdls */
-	int *incs;	/* npdls * ndims array of increments. Fast because
-	 		   of constant indices for first loops */
-	int *realdims;  /* realdims for each pdl (e.g., specified by PP signature) */
+	PDL_Indx *inds;	/* Indices for each of the dimensions */
+	PDL_Indx *dims;	/* Dimensions of each dimension */
+	PDL_Indx *offs;	/* Offsets for each of the pdls */
+	PDL_Indx *incs;	/* npdls * ndims array of increments. Fast because
+	 		               of constant indices for first loops */
+	PDL_Indx *realdims;  /* realdims for each pdl (e.g., specified by PP signature) */
 	pdl **pdls;
         char *flags;    /* per pdl flags */
         int mag_nth;    /* magicked thread dim */
@@ -4,6 +4,7 @@ pdl *	T_PDL
 pdl_trans * T_PDLTRANS
 pdl_trans* T_PDLTRANS
 Logical	T_IV
+PDL_Indx  T_IV
 
 INPUT
 
@@ -1,16 +1,26 @@
 TYPEMAP
 pdl*	T_PDL
 pdl *	T_PDL
+pdl_trans * T_PDLTRANS
+pdl_trans* T_PDLTRANS
 Logical	T_IV
+PDL_Indx  T_IV
 float	T_NV
 
 INPUT
 
 T_PDL
 	$var = PDL->SvPDLV($arg)
+T_PDLTRANS
+	if(sv_isa($arg,\"PDL::Trans\"))
+		$var = INT2PTR(pdl_trans *,SvIV(SvRV($arg)));
+	else
+	        croak(\"$var is not of type PDL::Trans\")
 
 
 OUTPUT
 
 T_PDL
 	PDL->SetSV_PDL($arg,$var);
+T_PDLTRANS
+	sv_setref_pv($arg, \"PDL::Trans\", (void*)$var);
@@ -14,6 +14,7 @@ WriteMakefile(NAME => "PDL::PP",
 	PM => {@pms},
 	'EXE_FILES' => ['pptemplate'],
 	clean => {FILES => "PP/Dump.pm PP/Dump.pm.tmp pptemplate pptemplate.pod"},
+	(eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
 sub MY::postamble {
@@ -59,7 +59,7 @@ sub set_from { my($this,$otherpar) = @_;
 sub name {return (shift)->{Name}}
 
 sub get_decldim { my($this) = @_;
-	return "PDL_Long __$this->{Name}_size;";
+	return "PDL_Indx __$this->{Name}_size;";
 }
 
 sub get_initdim { my($this) = @_;
@@ -24,7 +24,7 @@ sub get_pdls {my($this) = @_; return ($this->{ParNames},$this->{ParObjs});}
 # defined in this file. ugly...
 
 # Do the appropriate substitutions in the code.
-sub new { 
+sub new {
     my($type,$code,$badcode,$parnames,$parobjs,$indobjs,$generictypes,
        $extrageneric,$havethreading,$name,
        $dont_add_thrloop, $nogeneric_loop, $backcode ) = @_;
@@ -41,10 +41,10 @@ sub new {
     #
     # "backcode" is a flag to the PDL::PP::Threadloop class indicating thre threadloop
     #   is for writeback code (typically used for writeback of data from child to parent PDL
-    
+
     $dont_add_thrloop = 0 unless defined $dont_add_thrloop;
     $nogeneric_loop = 0 unless defined $nogeneric_loop;
-    
+
 
     # C++ style comments
     #
@@ -74,14 +74,14 @@ sub new {
         Generictypes => $generictypes,   # so that MacroAccess can check it
         Name => $name,
     }, $type;
-    
+
     my $inccode = join '',map {$_->get_incregisters();} (values %{$this->{ParObjs}});
 
     # First, separate the code into an array of C fragments (strings),
     # variable references (strings starting with $) and
     # loops (array references, 1. item = variable.
     #
-    my ( $threadloops, $coderef, $sizeprivs ) = 
+    my ( $threadloops, $coderef, $sizeprivs ) =
 	$this->separate_code( "{$inccode\n$code\n}" );
 
     # Now, if there is no explicit threadlooping in the code,
@@ -106,7 +106,7 @@ sub new {
     #
     if ( $handlebad ) {
 	print "Processing 'bad' code...\n" if $::PP_VERBOSE;
-	my ( $bad_threadloops, $bad_coderef, $bad_sizeprivs ) = 
+	my ( $bad_threadloops, $bad_coderef, $bad_sizeprivs ) =
 	    $this->separate_code( "{$inccode\n$badcode\n}" );
 
 	if(!$bad_threadloops && !$dont_add_thrloop && $havethreading) {
@@ -125,10 +125,10 @@ sub new {
 	$coderef = PDL::PP::BadSwitch->new( $good_coderef, $bad_coderef );
 
 	# amalgamate sizeprivs from Code/BadCode segments
-	# (sizeprivs is a simple hash, with each element 
+	# (sizeprivs is a simple hash, with each element
 	# containing a string - see PDL::PP::Loop)
 	while ( my ( $bad_key, $bad_str ) = each %$bad_sizeprivs ) {
-	    my $str = $$sizeprivs{$bad_key}; 
+	    my $str = $$sizeprivs{$bad_key};
 	    if ( defined $str ) {
 		die "ERROR: sizeprivs problem in PP/PDLCode.pm (BadVal stuff)\n"
 		    unless $str eq $bad_str;
@@ -239,7 +239,7 @@ sub get_str_int {
 package PDL::PP::BadSwitch;
 @PDL::PP::BadSwitch::ISA = "PDL::PP::Block";
 
-sub new { 
+sub new {
     my($type,$good,$bad) = @_;
     return bless [$good,$bad], $type;
 }
@@ -272,7 +272,7 @@ sub new { my($type,$args,$sizeprivs,$parent) = @_;
 		print "SIZP $sizeprivs, $_\n" if $::PP_VERBOSE;
 		my $i = $parent->make_loopind($_);
 		$sizeprivs->{$i->[0]} =
-		  "register int __$i->[0]_size = \$PRIV(__$i->[0]_size);\n";
+		  "register PDL_Indx __$i->[0]_size = \$PRIV(__$i->[0]_size);\n";
 		print "SP :",(join ',',%$sizeprivs),"\n" if $::PP_VERBOSE;
 	}
 	return $this;
@@ -284,7 +284,7 @@ sub myprelude { my($this,$parent,$context) = @_;
 	push @$context, map {
 		$i = $parent->make_loopind($_);
 # Used to be $PRIV(.._size) but now we have it in a register.
-		$text .= "{PDL_COMMENT(\"Open $_\") register int $_;
+		$text .= "{PDL_COMMENT(\"Open $_\") register PDL_Indx $_;
 			for($_=0; $_<(__$i->[0]_size); $_++) {";
 		$i;
 	} @{$this->[0]};
@@ -308,7 +308,7 @@ package PDL::PP::GenericLoop;
 
 # Types: BSULFD
 use PDL::Types ':All';
-sub new { 
+sub new {
     my($type,$types,$name,$varnames,$whattype) = @_;
     bless [(PDL::PP::get_generictyperecs($types)),$name,$varnames,
 	   $whattype],$type;
@@ -316,7 +316,7 @@ sub new {
 
 sub myoffs {4}
 
-sub myprelude { 
+sub myprelude {
     my($this,$parent,$context) = @_;
     push @{$parent->{Gencurtype}},'PDL_undef'; # so that $GENERIC can get at it
 
@@ -331,8 +331,8 @@ sub myprelude {
     my $thisis_loop = '';
     if ( $parent->{types} ) {
 	$thisis_loop = join '',
-	map { 
-	    "#undef THISIS$this->[1]_$_\n#define THISIS$this->[1]_$_(a)\n" 
+	map {
+	    "#undef THISIS$this->[1]_$_\n#define THISIS$this->[1]_$_(a)\n"
 	    }
 	(ppdefs);
     }
@@ -340,11 +340,11 @@ sub myprelude {
     return <<WARNING_EATER;
 PDL_COMMENT("Start generic loop")
 $thisis_loop
-	switch($this->[3]) { case -42: PDL_COMMENT("Warning eater") {1;
+	switch($this->[3]) { case -42: PDL_COMMENT("Warning eater") {(void)1;
 WARNING_EATER
 }
 
-sub myitem { 
+sub myitem {
     my($this,$parent,$nth) = @_;
 #	print "GENERICITEM\n";
     my $item = $this->[0]->[$nth];
@@ -365,27 +365,27 @@ sub myitem {
 			map {
 			    "#undef THISIS$this->[1]_$_\n#define THISIS$this->[1]_$_(a)\n";
 			}
-			(ppdefs) 
-			) . 
-			    "#undef THISIS$this->[1]_$item->[3]\n" . 
+			(ppdefs)
+			) .
+			    "#undef THISIS$this->[1]_$item->[3]\n" .
 				"#define THISIS$this->[1]_$item->[3](a) a\n";
     }
-	
+
     return "\t} break; case $item->[0]: {\n".
-	$thisis_loop . 
+	$thisis_loop .
 	    (join '',map{
 		# print "DAPAT: '$_'\n";
 		$parent->{ParObjs}{$_}->get_xsdatapdecl($item->[1]);
 	    } (@{$this->[2]})) ;
 }
 
-sub mypostlude { 
+sub mypostlude {
     my($this,$parent,$context) = @_;
     pop @{$parent->{Gencurtype}};  # and clean up the Gentype stack
 
     # horrible hack for PDL::PP::NaNSupport
     if ( $this->[1] ne "" ) { $parent->{pars} = {}; }
-    
+
     return "\tbreak;}
 	default:barf(\"PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\\n\");}\n";
 }
@@ -441,7 +441,7 @@ use Carp;
 our @CARP_NOT;
 
 
-sub new { 
+sub new {
 	my $type   = shift;
 	bless [],$type;
 }
@@ -454,24 +454,24 @@ sub myprelude {
     #    function name for backcode is writebackdata
     my $funcName = "readdata";
     $funcName = "writebackdata" if( $backcode );
-    
-    
+
+
     my $no; my $no2=-1; my $no3=-1;
     my ($ord,$pdls) = $parent->get_pdls();
 
 '	PDL_COMMENT("THREADLOOPBEGIN")
  if(PDL->startthreadloop(&($PRIV(__pdlthread)),$PRIV(vtable)->'.$funcName.',
  	__tr)) return;
-   do { register int __tind1=0,__tind2=0;
-        register int __tnpdls = $PRIV(__pdlthread).npdls;
-      register int __tdims1 = $PRIV(__pdlthread.dims[1]);
-      register int __tdims0 = $PRIV(__pdlthread.dims[0]);
-      register int *__offsp = PDL->get_threadoffsp(&$PRIV(__pdlthread));
+   do { register PDL_Indx __tind1=0,__tind2=0;
+        register PDL_Indx __tnpdls = $PRIV(__pdlthread).npdls;
+      register PDL_Indx __tdims1 = $PRIV(__pdlthread.dims[1]);
+      register PDL_Indx __tdims0 = $PRIV(__pdlthread.dims[0]);
+      register PDL_Indx *__offsp = PDL->get_threadoffsp(&$PRIV(__pdlthread));
  '.(join '',map {$no2++;
-            "register int __tinc0_".($no2)." = \$PRIV(__pdlthread).incs[$no2];"}
+            "register PDL_Indx __tinc0_".($no2)." = \$PRIV(__pdlthread).incs[$no2];"}
 	     @$ord).
    (join '',map {$no3++;
-            "register int __tinc1_".($no3)." = \$PRIV(__pdlthread).incs[__tnpdls+$no3];"}
+            "register PDL_Indx __tinc1_".($no3)." = \$PRIV(__pdlthread).incs[__tnpdls+$no3];"}
 	     @$ord).
    (join '',map {"${_}_datap += __offsp[".(0+$no++)."];\n"}
  		@$ord).'
@@ -513,11 +513,11 @@ our @CARP_NOT;
 
 sub myprelude {
     my($this,$parent,$context, $backcode) = @_;
-    
+
     # Set backcode flag if not defined. This will make the parent
     #   myprelude emit proper writeback code
     $backcode = 1 unless defined($backcode);
-    
+
     $this->SUPER::myprelude($parent, $context, $backcode);
 }
 
@@ -536,7 +536,7 @@ use PDL::Types ':All';
 @PDL::PP::Types::ISA = "PDL::PP::Block";
 our @CARP_NOT;
 
-sub new { 
+sub new {
     my($type,$ts,$parent) = @_;
     my $types = join '', ppdefs; # BSUL....
     $ts =~ /[$types]+/ or confess "Invalid type access with '$ts'!";
@@ -602,8 +602,8 @@ sub get_str {my($this) = @_;return "\$$this->[0]($this->[1])"}
 #   == 1 then we use NaN's
 #      0             PDL.bvals.Float/Double
 #
-# note the *horrible hack* for piddles whose type have been 
-# specified using the FType option - see GenericLoop. 
+# note the *horrible hack* for piddles whose type have been
+# specified using the FType option - see GenericLoop.
 # There MUST be a better way than this...
 #
 package PDL::PP::NaNSupport;
@@ -626,11 +626,11 @@ $use_nan{int} = 0;
 # Was the following, before new Type "interface"
 #     ( byte => 0, short => 0, ushort => 0, long => 0,
 #       int => 0,  longlong => 0, # necessary for fixed-type piddles (or something)
-#       float => $usenan, 
-#       double => $usenan 
+#       float => $usenan,
+#       double => $usenan
 #       );
 
-my %set_nan = 
+my %set_nan =
     (
      float  => 'PDL->bvals.Float',  PDL_Float  => 'PDL->bvals.Float',
      double => 'PDL->bvals.Double', PDL_Double => 'PDL->bvals.Double',
@@ -662,7 +662,7 @@ sub convert ($$$$$) {
     # based on code from from PdlParObj::ctype()
     # - want to handle FlagTplus case
     # - may not be correct
-    # - extended to include hack to GenericLoop 
+    # - extended to include hack to GenericLoop
     #
     if ( exists $parent->{pars}{$name} ) {
 	$type = $parent->{pars}{$name};
@@ -681,7 +681,7 @@ sub convert ($$$$$) {
 	    }
 	}
     }
-	
+
     if ( use_nan($type) ) {
 	if ( $opcode eq "SETBAD" ) {
 #	    $rhs = "(0.0/0.0)";
@@ -691,7 +691,7 @@ sub convert ($$$$$) {
 	    $lhs = "finite($lhs)";
 	}
     }
-    
+
     return ( $lhs, $rhs );
 }
 
@@ -715,7 +715,7 @@ sub convert ($$$$$) {
 # amount of line noise. This is actually done by the regexp
 # in the separate_code() sub at the end of the file.
 #
-# note: 
+# note:
 #   we also expand out $a(n) etc as well here
 #
 # To do:
@@ -726,7 +726,7 @@ package PDL::PP::BadAccess;
 use Carp;
 our @CARP_NOT;
 
-sub new { 
+sub new {
     my ( $type, $opcode, $pdl_name, $inds, $parent ) = @_;
 
     # trying to avoid auto creation of hash elements
@@ -760,7 +760,7 @@ sub get_str {
     my $lhs = $obj->do_access($inds,$context);
     my $rhs = "${name}_badval";
 
-    ( $lhs, $rhs ) = 
+    ( $lhs, $rhs ) =
       PDL::PP::NaNSupport::convert( $parent, $name, $lhs, $rhs, $opcode );
 
     print "DBG:  [$lhs $op $rhs]\n" if $::PP_VERBOSE;
@@ -788,7 +788,7 @@ package PDL::PP::BadVarAccess;
 use Carp;
 our @CARP_NOT;
 
-sub new { 
+sub new {
     my ( $type, $opcode, $var_name, $pdl_name, $parent ) = @_;
 
     # trying to avoid auto creation of hash elements
@@ -822,7 +822,7 @@ sub get_str {
     my $lhs = $var_name;
     my $rhs = "${pdl_name}_badval";
 
-    ( $lhs, $rhs ) = 
+    ( $lhs, $rhs ) =
       PDL::PP::NaNSupport::convert( $parent, $pdl_name, $lhs, $rhs, $opcode );
 
     print "DBG:  [$lhs $op $rhs]\n" if $::PP_VERBOSE;
@@ -848,11 +848,11 @@ sub get_str {
 #  $PPSETBAD(PARENT,[i])  -> PARENT_physdatap[i]          = PDL->bvals.Float (or .Double)
 #
 
-package PDL::PP::PPBadAccess; 
+package PDL::PP::PPBadAccess;
 use Carp;
 our @CARP_NOT;
 
-sub new { 
+sub new {
     my ( $type, $opcode, $pdl_name, $inds, $parent ) = @_;
 
     $opcode =~ s/^PP//;
@@ -882,7 +882,7 @@ sub get_str {
     my $lhs = $obj->do_physpointeraccess() . "$inds";
     my $rhs = "${name}_badval";
 
-    ( $lhs, $rhs ) = 
+    ( $lhs, $rhs ) =
       PDL::PP::NaNSupport::convert( $parent, $name, $lhs, $rhs, $opcode );
 
     print "DBG:  [$lhs $op $rhs]\n" if $::PP_VERBOSE;
@@ -897,16 +897,16 @@ sub get_str {
 #
 # $PDLSTATEISBAD(a)    ->  ($PDL(a)->state & PDL_BADVAL) > 0
 # $PDLSTATEISGOOD(a)   ->  ($PDL(a)->state & PDL_BADVAL) == 0
-# 
+#
 # $PDLSTATESETBAD(a)   ->  ($PDL(a)->state |= PDL_BADVAL)
 # $PDLSTATESETGOOD(a)  ->  ($PDL(a)->state &= ~PDL_BADVAL)
-# 
+#
 
 package PDL::PP::PDLStateBadAccess;
 use Carp;
 our @CARP_NOT;
 
-sub new { 
+sub new {
     my ( $type, $op, $val, $pdl_name, $parent ) = @_;
 
     # $op  is one of: IS SET
@@ -921,7 +921,7 @@ sub new {
     bless [$op, $val, $pdl_name], $type;
 }
 
-our %ops  = ( 
+our %ops  = (
 	     IS  => { GOOD => '== 0', BAD => '> 0' },
 	     SET => { GOOD => '&= ~', BAD => '|= ' },
 	     );
@@ -1018,7 +1018,7 @@ use PDL::Types ':All';
 my $types = join '',ppdefs;
 our @CARP_NOT;
 
-sub new { my($type,$pdl,$inds,$gentypes,$name) = @_; 
+sub new { my($type,$pdl,$inds,$gentypes,$name) = @_;
 	  $pdl =~ /^\s*T([A-Z]+)\s*$/ or confess("Macroaccess wrong: $pdl\n");
 	  my @ilst = split '',$1;
 	  for my $gt (@$gentypes) {
@@ -1034,7 +1034,7 @@ sub new { my($type,$pdl,$inds,$gentypes,$name) = @_;
 
 sub get_str {my($this,$parent,$context) = @_;
 	my ($pdl,$inds,$name) = @{$this};
-	$pdl =~ /^\s*T([A-Z]+)\s*$/ 
+	$pdl =~ /^\s*T([A-Z]+)\s*$/
 	  or confess("Macroaccess wrong in $name (allowed types $types): was '$pdl'\n");
 	my @lst = split ',',$inds;
 	my @ilst = split '',$1;
@@ -1200,23 +1200,23 @@ package PDL::PP::Code;
 # loops (array references, 1. item = variable.
 #
 sub separate_code {
-	$DB::single=1;
+   ## $DB::single=1;
     my ( $this, $code ) = @_;
-    
+
     # First check for standard code errors:
     catch_code_errors($code);
 
     my $coderef = new PDL::PP::Block;
- 
+
     my @stack = ($coderef);
     my $threadloops = 0;
     my $sizeprivs = {};
 
     local $_ = $code;
-##    print "Code to parse = [$_]\n" if $::PP_VERBOSE; 
+##    print "Code to parse = [$_]\n" if $::PP_VERBOSE;
     while($_) {
 	# Parse next statement
-	
+
 	# I'm not convinced that having the checks twice is a good thing,
 	# since it makes it easy (for me at least) to forget to update one
 	# of them
@@ -1227,9 +1227,9 @@ sub separate_code {
 ###                |\$STATE(IS|SET)(BAD|GOOD)\s*\(\s*[^)]*\s*\)      # $STATEISBAD(a) etc
                 |\$PDLSTATE(IS|SET)(BAD|GOOD)\s*\(\s*[^)]*\s*\)   # $PDLSTATEISBAD(a) etc
 	        |\$[a-zA-Z_]\w*\s*\([^)]*\)  # $a(...): access
-		|\bloop\s*\([^)]+\)\s*%{   # loop(..) %{
-		|\btypes\s*\([^)]+\)\s*%{  # types(..) %{
-		|\bthreadloop\s*%{         # threadloop %{
+		|\bloop\s*\([^)]+\)\s*%\{   # loop(..) %{
+		|\btypes\s*\([^)]+\)\s*%\{  # types(..) %{
+		|\bthreadloop\s*%\{         # threadloop %{
 		|%}                        # %}
 		|$)//xs
 		    or confess("Invalid program $_");
@@ -1242,17 +1242,17 @@ sub separate_code {
 
 		# Then, our control.
 		if($control) {
-			if($control =~ /^loop\s*\(([^)]+)\)\s*%{/) {
+			if($control =~ /^loop\s*\(([^)]+)\)\s*%\{/) {
 				my $ob = new PDL::PP::Loop([split ',',$1],
 						   $sizeprivs,$this);
 				print "SIZEPRIVSXX: $sizeprivs,",(join ',',%$sizeprivs),"\n" if $::PP_VERBOSE;
 				push @{$stack[-1]},$ob;
 				push @stack,$ob;
-			} elsif($control =~ /^types\s*\(([^)]+)\)\s*%{/) {
+			} elsif($control =~ /^types\s*\(([^)]+)\)\s*%\{/) {
 				my $ob = new PDL::PP::Types($1,$this);
 				push @{$stack[-1]},$ob;
 				push @stack,$ob;
-			} elsif($control =~ /^threadloop\s*%{/) {
+			} elsif($control =~ /^threadloop\s*%\{/) {
 				my $ob = new PDL::PP::ThreadLoop();
 				push @{$stack[-1]},$ob;
 				push @stack,$ob;
@@ -1287,14 +1287,14 @@ sub separate_code {
 # errors and croaks with an explanation if they are found.
 sub catch_code_errors {
 	my $code_string = shift;
-	
+
 	# Look for constructs like
 	#   loop %{
 	# which is invalid - you need to specify the dimension over which it
 	# should loop
 	report_error('Expected dimension name after "loop" and before "%{"', $1)
-		if $code_string =~ /(.*\bloop\s*%{)/s;
-	
+		if $code_string =~ /(.*\bloop\s*%\{)/s;
+
 }
 
 # Report an error as precisely as possible. If they have #line directives
@@ -1317,7 +1317,7 @@ sub report_error {
 			$filename = $2;
 		}
 	}
-	
+
 	die "$message at $filename line $line\n";
 }
 
@@ -5,26 +5,14 @@
 package PDL::PP::PdlParObj;
 
 use Carp;
-use SelfLoader;
-# use PDL::Core;
 use PDL::Types;
 
-@ISA = qw/ SelfLoader /;
-
 # check for bad value support
 #
 use PDL::Config;
-#my $bvalflag = $PDL::Config{WITH_BADVAL} || 0;
-$usenan   = $PDL::Config{BADVAL_USENAN} || 0;
-
-# need some mods in Types and Core for that
-# for (byte,short,ushort,long,float,double) {
-#   $Typemap{$_->name} = {  Ctype => $_->ctype,
-# 			  Cenum => $_->enum,
-# 			  Val => $_->val };
-# }
+my $usenan = $PDL::Config{BADVAL_USENAN} || 0;
 
-%PDL::PP::PdlParObj::Typemap = ();
+our %Typemap = ();
 use PDL::Types ':All';
 
 # build a typemap for our translation purposes
@@ -37,30 +25,12 @@ for my $typ (typesrtkeys) {
 					 };
 }
 
-# my $type;
-# for (['Byte',$PDL_B],
-#       ['Short',$PDL_S],
-#       ['Ushort',$PDL_US],
-#       ['Long',$PDL_L],
-#       ['LongLong',$PDL_LL],
-#       ['Float',$PDL_F],
-#       ['Double',$PDL_D]) {
-#   $type = ($_->[0] =~ /^Long$/ ? 'int' : lc $_->[0]);
-#   $Typemap{$type} = { Ctype => "PDL_$_->[0]",
-# 		      Cenum => ($type =~ /ushort/ ? "PDL_US" :
-# 				$type =~ /longlong/ ? "PDL_LL" :
-# 				"PDL_".substr($_->[0],0,1)),
-# 		      Val => $_->[1]  };
-# }
-
+# Try to load Text::Balanced
 my $hasTB = 0;
-eval 'use Text::Balanced';
-if ($@) {
-  # this is too annoying
-  # warn "PDL::PP: can't load Text::Balanced, code parsing will be limited";
-} else {
-  $hasTB = 1;
-}
+eval q{
+	use Text::Balanced;
+	$hasTB = 1;
+};
 
 # split regex $re separated arglist
 # but ignore bracket-protected bits
@@ -104,26 +74,28 @@ sub splitprotected ($$) {
 
 1;
 
-__DATA__
+#__DATA__
 
 # need for $badflag is due to hacked get_xsdatapdecl() 
 # - this should disappear when (if?) things are done sensibly
 #
+my $typeregex = join '|', map {typefld($_,'ppforcetype')} typesrtkeys;
+our $pars_re = qr/^
+	\s*((?:$typeregex)[+]*|)\s*	# $1: first option
+	(?:
+	\[([^]]*)\]   	# $2: The initial [option] part
+	)?\s*
+	(\w+)          	# $3: The name
+	\(([^)]*)\)  		# $4: The indices
+/x;
 sub new {
 	my($type,$string,$number,$badflag) = @_;
-	my $typeregex = join '|', map {typefld($_,'ppforcetype')} typesrtkeys;
 	$badflag ||= 0;
 	my $this = bless {Number => $number, BadFlag => $badflag},$type;
-# Parse the parameter string
-	$string =~
-		/^
-		 \s*((?:$typeregex)[+]*|)\s*	# $1: first option
-		 (?:
-			\[([^]]*)\]   	# $2: The initial [option] part
-	         )?\s*
-		 (\w+)          	# $3: The name
-		 \(([^)]*)\)  		# $4: The indices
-		/x or confess "Invalid pdl def $string (regex $typeregex)\n";
+	# Parse the parameter string. Note that the regexes for this match were
+	# originally defined here, but were moved to PDL::PP for FullDoc parsing.
+	$string =~ $pars_re
+		 or confess "Invalid pdl def $string (regex $typeregex)\n";
 	my($opt1,$opt2,$name,$inds) = ($1,$2,$3,$4);
 	map {$_ = '' unless defined($_)} ($opt1,$opt2,$inds); # shut up -w
 	print "PDL: '$opt1', '$opt2', '$name', '$inds'\n"
@@ -319,7 +291,7 @@ sub get_xsnormdimchecks {
 	$str .= "} else {\n";
 	
 	# We are creating this pdl.
-	$str .= " int dims[".($ninds+1)."]; PDL_COMMENT(\"Use ninds+1 to avoid smart (stupid) compilers\")";
+	$str .= " PDL_Indx dims[".($ninds+1)."]; PDL_COMMENT(\"Use ninds+1 to avoid smart (stupid) compilers\")";
 	$str .= join "",
 	(map {"dims[$_] = ".$iref->[$_]->get_size().";"} 0 .. $#$iref);
 	my $istemp = $this->{FlagTemp} ? 1 : 0;
@@ -343,7 +315,7 @@ sub get_incdecls {
 	my($this) = @_;
 	if(scalar(@{$this->{IndObjs}}) == 0) {return "";}
 	(join '',map {
-		"PDL_Long ".($this->get_incname($_)).";";
+		"PDL_Indx ".($this->get_incname($_)).";";
 	} (0..$#{$this->{IndObjs}}) ) . ";"
 }
 
@@ -351,7 +323,7 @@ sub get_incregisters {
 	my($this) = @_;
 	if(scalar(@{$this->{IndObjs}}) == 0) {return "";}
 	(join '',map {
-		"register PDL_Long ".($this->get_incname($_))." = \$PRIV(".
+		"register PDL_Indx ".($this->get_incname($_))." = \$PRIV(".
 			($this->get_incname($_)).");\n";
 	} (0..$#{$this->{IndObjs}}) )
 }
@@ -494,3 +466,4 @@ sub get_xsdatapdecl {
     return "$str\n";
 }
 
+1;
@@ -76,6 +76,9 @@
 # it does not need to be supplied, and the return value should be
 # given as a single-quoted string and use the $name variable
 #
+# The Substitute rule replaces dollar-signed macros ($P(), $ISBAD(), ect)
+# with the low-level C code to perform the macro.
+#
 # The Substitute class replaces the dosubst rule. The old rule
 #   [["NewXSCoerceMustSubs"], ["NewXSCoerceMustSub1","NewXSSymTab","Name"],
 #	 	      \&dosubst]
@@ -91,7 +94,7 @@
 #   [["CacheBadFlagInit"], ["CacheBadFlagInitNS","NewXSSymTab","Name"],
 #		      \&dousualsubsts],
 # becomes
-#   PDL::PP::Rule::Substityte::Usual->new("CacheBadFlagInit", "CacheBadFlagInitNS")
+#   PDL::PP::Rule::Substitute::Usual->new("CacheBadFlagInit", "CacheBadFlagInitNS")
 #
 # PDL::PP::Rule::Substitute::Usual->new($target, $condition)
 #   $target and $condition must be scalars.
@@ -340,6 +343,30 @@ sub apply {
 	$self->report("\n");
 }
 
+
+package PDL::PP::Rule::Croak;
+
+# Croaks if all of the input variables are defined. Use this to identify
+# incompatible arguments.
+our @ISA = qw(PDL::PP::Rule);
+use Carp;
+our @CARP_NOT;
+
+
+sub new {
+    croak('Usage: PDL::PP::Ruel::Croak->new(["incompatible", "arguments"], "Croaking message")')
+		unless @_ == 3;
+    
+    my $class = shift;
+    my $self  = $class->SUPER::new([], @_);
+    return bless $self, $class;
+}
+
+sub apply {
+    my ($self, $pars) = @_;
+    croak($self->{doc}) if $self->is_valid($pars);
+}
+
 package PDL::PP::Rule::Returns;
 
 use strict;
@@ -753,6 +780,9 @@ package PDL::PP;
 
 use strict;
 
+our $VERSION = "2.2";
+$VERSION = eval $VERSION;
+
 use PDL::Types ':All';
 use Config;
 use FileHandle;
@@ -765,12 +795,12 @@ our @ISA = qw(Exporter);
 @PDL::PP::EXPORT = qw/pp_addhdr pp_addpm pp_bless pp_def pp_done pp_add_boot
                       pp_add_exported pp_addxs pp_add_isa pp_export_nothing
 		      pp_core_importList pp_beginwrap pp_setversion
-                      pp_addbegin pp_boundscheck pp_line_numbers/;
+                      pp_addbegin pp_boundscheck pp_line_numbers
+                      pp_deprecate_module/;
 
 $PP::boundscheck = 1;
 $::PP_VERBOSE    = 0;
 
-$PDL::PP::VERSION = 2.2;
 $PDL::PP::done = 0;  # pp_done has not been called yet
 
 END {
@@ -930,7 +960,7 @@ sub pp_line_numbers ($$) {
 		push @to_return, $_;
 
 		# If we need to add a # line directive, do so before incrementing
-		push (@to_return, "\n#line $line \"$filename\"") if (/%{/ or /%}/);
+		push (@to_return, "\n#line $line \"$filename\"") if (/%\{/ or /%}/);
 
 		$line++ if /\n/;
 	}
@@ -1085,7 +1115,25 @@ sub pp_def {
 	my($name,%obj) = @_;
 
 	print "*** Entering pp_def for $name\n" if $::PP_VERBOSE;
-
+	
+	# See if the 'name' is multiline, in which case we extract the
+	# name and add the FullDoc field
+	if ($name =~ /\n/) {
+		my $fulldoc = $name;
+		# See if the very first thing is a word. That is going to be the
+		# name of the function under consideration
+		if ($fulldoc =~ s/^(\w+)//) {
+			$name = $1;
+		}
+		elsif ($fulldoc =~ /=head2 (\w+)/) {
+			$name = $1;
+		}
+		else {
+			croak('Unable to extract name');
+		}
+		$obj{FullDoc} = $fulldoc;
+	}
+	
 	$obj{Name} = $name;
 	translate(\%obj,$PDL::PP::deftbl);
 
@@ -1113,6 +1161,58 @@ sub pp_def {
 	print "*** Leaving pp_def for $name\n" if $::PP_VERBOSE;
 }
 
+# marks this module as deprecated. This handles the user warnings, and adds a
+# notice into the documentation. Can take a {infavor => "newmodule"} option
+sub pp_deprecate_module
+{
+  my $options;
+  if( ref $_[0] eq 'HASH' )  { $options = shift;  }
+  else                       { $options = { @_ }; }
+
+  my $infavor;
+
+  if( $options && ref $options eq 'HASH' && $options->{infavor} )
+  {
+    $infavor = $options->{infavor};
+  }
+
+  my $mod = $::PDLMOD;
+  my $envvar = 'PDL_SUPPRESS_DEPRECATION_WARNING__' . uc $mod;
+  $envvar =~ s/::/_/g;
+
+  my $warning_main =
+    "$mod is deprecated.";
+  $warning_main .=
+    " Please use $infavor instead." if $infavor;
+
+  my $warning_suppression_runtime =
+    "This module will be removed in the future; please update your code.\n" .
+    "Set the environment variable $envvar\n" .
+    "to suppress this warning\n";
+
+  my $warning_suppression_pod =
+    "A warning will be generated at runtime upon a C<use> of this module\n" .
+    "This warning can be suppressed by setting the $envvar\n" .
+    "environment variable\n";
+
+  my $deprecation_notice = <<EOF ;
+XXX=head1 DEPRECATION NOTICE
+
+$warning_main
+$warning_suppression_pod
+
+XXX=cut
+
+EOF
+  $deprecation_notice =~ s/^XXX=/=/gms;
+  pp_addpm( {At => 'Top'}, $deprecation_notice );
+
+  pp_addpm {At => 'Top'}, <<EOF;
+warn \"$warning_main\n$warning_suppression_runtime\" unless \$ENV{$envvar};
+EOF
+
+
+}
 
 # Worst memleaks: not freeing things at redodims or
 # final free time (thread, dimmed things).
@@ -1393,7 +1493,7 @@ sub pdimexpr2priv {
 #
 sub equivcpoffscode {
     return
-	'int i;
+	'PDL_Indx i;
          for(i=0; i<$CHILD_P(nvals); i++)  {
             $EQUIVCPOFFS(i,i);
          }';
@@ -1548,7 +1648,7 @@ sub wrap_vfn {
     # Put p2child in simple boolean context rather than strict numerical equality
     if ( $p2child ) {
 	$p2decl =
-	    "pdl *__it = __tr->pdls[1]; pdl *__parent = __tr->pdls[0];";
+	    "pdl *__it = ((pdl_trans_affine *)(__tr))->pdls[1]; pdl *__parent = __tr->pdls[0];";
 	if ( $name eq "redodims" ) {
 	    $p2decl .= '
 	     if (__parent->hdrsv && (__parent->state & PDL_HDRCPY)) {
@@ -1570,7 +1670,7 @@ sub wrap_vfn {
                     SV *tmp = (SV *) POPs ;
 		    __it->hdrsv = (void*) tmp;
                     if(tmp != &PL_sv_undef )
-                       SvREFCNT_inc(tmp);
+                       (void)SvREFCNT_inc(tmp);
                   }
 
                   __it->state |= PDL_HDRCPY;
@@ -1893,7 +1993,7 @@ $pars
   PDL_COMMENT("Check if you can get a package name for this input value.  ")
   PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a     ")
   PDL_COMMENT("derived PDL subclass (SVt_PVHV)                            ")
-  
+
   if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
     parent = ST(0);
     if (sv_isobject(parent))
@@ -2201,7 +2301,7 @@ sub InplaceCode {
 
     my $instate = $in . "->state";
     return
-	qq{\tif ( $instate & PDL_INPLACE ) {
+	qq{\tif ( $instate & PDL_INPLACE && ($out != $in)) {
               $instate &= ~PDL_INPLACE; PDL_COMMENT("unset")
               $out = $in;             PDL_COMMENT("discard output value, leak ?")
               PDL->SetSV_PDL(${out}_SV,${out});
@@ -2316,21 +2416,24 @@ sub GenDocs {
 
   $::DOCUMENTED++;
   $pars = "P(); C()" unless $pars;
+  # Strip leading whitespace and trailing semicolons and whitespace
   $pars =~ s/^\s*(.+[^;])[;\s]*$/$1/;
   $otherpars =~ s/^\s*(.+[^;])[;\s]*$/$1/ if $otherpars;
   my $sig = "$pars".( $otherpars ? "; $otherpars" : "");
 
   $doc =~ s/\n(=cut\s*\n)+(\s*\n)*$/\n/m; # Strip extra =cut's
   if ( defined $baddoc ) {
+  	  # Strip leading newlines and any =cut markings
       $baddoc =~ s/\n(=cut\s*\n)+(\s*\n)*$/\n/m;
+      $baddoc =~ s/^\n+//;
       $baddoc = "=for bad\n\n$baddoc";
   }
 
-  return << "EOD";
+  my $baddoc_function_pod = <<"EOD" ;
 
-=head2 $name
+XXX=head2 $name
 
-=for sig
+XXX=for sig
 
   Signature: ($sig)
 
@@ -2338,9 +2441,12 @@ $doc
 
 $baddoc
 
-=cut
+XXX=cut
 
 EOD
+
+  $baddoc_function_pod =~ s/^XXX=/=/gms;
+  return $baddoc_function_pod;
 }
 
 sub ToIsReversible {
@@ -2539,7 +2645,7 @@ sub make_parnames {
          $join__realdims = '0' if $join__realdims eq '';
       }
 	return("static char *__parnames[] = {". $join__parnames ."};
-		static int __realdims[] = {". $join__realdims . "};
+		static PDL_Indx __realdims[] = {". $join__realdims . "};
 		static char __funcname[] = \"\$MODULE()::\$NAME()\";
 		static pdl_errorinfo __einfo = {
 			__funcname, __parnames, $npdls
@@ -2626,8 +2732,9 @@ if (hdrp) {
 
     hdr_copy = (SV *)POPs;
 
-    if(hdr_copy && hdr_copy != &PL_sv_undef)
-       SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
+    if(hdr_copy && hdr_copy != &PL_sv_undef) {
+       (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
+    }
 
     FREETMPS ;
     LEAVE ;
@@ -2644,9 +2751,9 @@ DeePcOPY
      $str .= <<"HdRCHECK2"
        if ( $names[$_]\->hdrsv != hdrp ){
 	 if( $names[$_]\->hdrsv && $names[$_]\->hdrsv != &PL_sv_undef)
-             SvREFCNT_dec( $names[$_]\->hdrsv );
+             (void)SvREFCNT_dec( $names[$_]\->hdrsv );
 	 if( hdr_copy != &PL_sv_undef )
-             SvREFCNT_inc(hdr_copy);
+             (void)SvREFCNT_inc(hdr_copy);
 	 $names[$_]\->hdrsv = hdr_copy;
        }
      if(propagate_hdrcpy)
@@ -2677,7 +2784,7 @@ sub make_redodims_thread {
 
     my $nn = $#$pnames;
     my @privname = map { "\$PRIV(pdls[$_])" } ( 0 .. $nn );
-    $str .= $npdls ? "int __creating[$npdls];\n" : "int __creating[1];\n";
+    $str .= $npdls ? "PDL_Indx __creating[$npdls];\n" : "PDL_Indx __creating[1];\n";
     $str .= join '',map {$_->get_initdim."\n"} values %$dobjs;
 
     # if FlagCreat is NOT true, then we set __creating[] to 0
@@ -2729,6 +2836,117 @@ sub XSHdr {
 	return XS::mkproto($xsname,$nxargs);
 }
 
+###########################################################
+# Name       : extract_signature_from_fulldoc
+# Usage      : $sig = extract_signature_from_fulldoc($fulldoc)
+# Purpose    : pull out the signature from the fulldoc string
+# Returns    : whatever is in parentheses in the signature, or undef
+# Parameters : $fulldoc
+# Throws     : never
+# Notes      : the signature must have the following form:
+#            : 
+#            : =for sig
+#            : <blank>
+#            :   Signature: (<signature can
+#            :                be multiline>)
+#            : <blank>
+#            : 
+#            : The two spaces before "Signature" are required, as are
+#            : the parentheses.
+sub extract_signature_from_fulldoc {
+	my $fulldoc = shift;
+	if ($fulldoc =~ /=for sig\n\n  Signature: \(([^\n]*)\n/g) {
+		# Extract the signature and remove the final parenthesis
+		my $sig = $1;
+		$sig .= $1 while $fulldoc =~ /\G\h+([^\n]*)\n/g;
+		$sig =~ s/\)\s*$//;
+		return $sig;
+	}
+	return;
+}
+
+
+# Build the valid-types regex and valid Pars argument only once. These are
+# also used in PDL::PP::PdlParObj, which is why they are globally available.
+use PDL::PP::PdlParObj;
+my $pars_re = $PDL::PP::PdlParObj::pars_re;
+
+###########################################################
+# Name       : build_pars_from_fulldoc
+# Usage      : $pars = build_pars_from_fulldoc($fulldoc)
+# Purpose    : extract the Pars from the signature from the fulldoc string,
+#            : the part of the signature that specifies the piddles
+# Returns    : a string appropriate for the Pars key
+# Parameters : $fulldoc
+# Throws     : if there is no signature 
+#            : if there is no extractable Pars section
+#            : if some PDL arguments come after the OtherPars arguments start
+# Notes      : This is meant to be used directly in a Rule. Therefore, it
+#            : is only called if the Pars key does not yet exist, so if it
+#            : is not possible to extract the Pars section, it dies.
+sub build_pars_from_fulldoc {
+	my $fulldoc = shift;
+	
+	# Get the signature or die
+	my $sig = extract_signature_from_fulldoc($fulldoc)
+		or confess('No Pars specified and none could be extracted from FullDoc');
+	
+	# Everything is semicolon-delimited
+	my @args = split /\s*;\s*/, $sig;
+	my @pars;
+	my $switched_to_other_pars = 0;
+	for my $arg (@args) {
+		confess('All PDL args must come before other pars in FullDoc signature')
+			if $switched_to_other_pars and $arg =~ $pars_re;
+		if ($arg =~ $pars_re) {
+			push @pars, $arg;
+		}
+		else {
+			$switched_to_other_pars = 1;
+		}
+	}
+	
+	# Make sure there's something there
+	confess('FullDoc signature contains no PDL arguments') if @pars == 0;
+	
+	# All done!
+	return join('; ', @pars);
+}
+
+###########################################################
+# Name       : build_otherpars_from_fulldoc
+# Usage      : $otherpars = build_otherpars_from_fulldoc($fulldoc)
+# Purpose    : extract the OtherPars from the signature from the fulldoc
+#            : string, the part of the signature that specifies non-piddle
+#            : arguments
+# Returns    : a string appropriate for the OtherPars key
+# Parameters : $fulldoc
+# Throws     : if some OtherPars arguments come before the last PDL argument
+# Notes      : This is meant to be used directly in a Rule. Therefore, it
+#            : is only called if the OtherPars key does not yet exist.
+sub build_otherpars_from_fulldoc {
+	my $fulldoc = shift;
+	
+	# Get the signature or do not set
+	my $sig = extract_signature_from_fulldoc($fulldoc)
+		or return 'DO NOT SET!!';
+	
+	# Everything is semicolon-delimited
+	my @args = split /\s*;\s*/, $sig;
+	my @otherpars;
+	for my $arg (@args) {
+		confess('All PDL args must come before other pars in FullDoc signature')
+			if @otherpars > 0 and $arg =~ $pars_re;
+		if ($arg !~ $pars_re) {
+			push @otherpars, $arg;
+		}
+	}
+	
+	# All done!
+	return 'DO NOT SET!!'if @otherpars == 0;
+	return join('; ', @otherpars);
+}
+
 # Set up the rules for translating the pp_def contents.
 #
 $PDL::PP::deftbl =
@@ -2743,9 +2961,97 @@ $PDL::PP::deftbl =
 		      "Sets BadFlag based upon HandleBad key and PDL's ability to handle bad values",
 		      sub { return (defined $_[0]) ? ($bvalflag and $_[0]) : undef; }),
 
+   ####################
+   # FullDoc Handling #
+   ####################
+   
+   # Error processing: does FullDoc contain BadDoc, yet BadDoc specified?
+   PDL::PP::Rule::Croak->new(['FullDoc', 'BadDoc'],
+       'Cannot have both FullDoc and BadDoc defined'),
+   PDL::PP::Rule::Croak->new(['FullDoc', 'Doc'],
+       'Cannot have both FullDoc and Doc defined'),
+   # Note: no error processing on Pars; it's OK for the docs to gloss over
+   # the details.
+   
+   # Add the Pars section based on the signature of the FullDoc if the Pars
+   # section doesn't already exist
+   PDL::PP::Rule->new('Pars', 'FullDoc',
+      'Sets the Pars from the FullDoc if Pars is not explicitly specified',
+      \&build_pars_from_fulldoc
+   ),
+   PDL::PP::Rule->new('OtherPars', 'FullDoc',
+      'Sets the OtherPars from the FullDoc if OtherPars is not explicitly specified',
+      \&build_otherpars_from_fulldoc
+   ),
+   
+   ################################
+   # Other Documentation Handling #
+   ################################
+   
+   # no docs by default
+   PDL::PP::Rule::Returns->new("Doc", [], 'Sets the default doc string',
+    "\n=for ref\n\ninfo not available\n"),
+   
+   # try and automate the docs
+   # could be really clever and include the sig to see about
+   # input/output params, for instance
+   
+   PDL::PP::Rule->new("BadDoc", ["BadFlag","Name","_CopyBadStatusCode"],
+              'Sets the default documentation for handling of bad values',
+      sub {
+         return undef unless $bvalflag;
+         my ( $bf, $name, $code ) = @_;
+         my $str;
+         if ( not defined($bf) ) {
+            $str = "$name does not process bad values.\n";
+         } elsif ( $bf ) {
+            $str = "$name processes bad values.\n";
+         } else {
+            $str = "$name ignores the bad-value flag of the input piddles.\n";
+         }
+         if ( not defined($code) ) {
+            $str .= "It will set the bad-value flag of all output piddles if " .
+            "the flag is set for any of the input piddles.\n";
+         } elsif (  $code eq '' ) {
+            $str .= "The output piddles will NOT have their bad-value flag set.\n";
+         } else {
+            $str .= "The state of the bad-value flag of the output piddles is unknown.\n";
+         }
+      }
+   ),
 
+   # Default: no otherpars
+   PDL::PP::Rule::Returns::EmptyString->new("OtherPars"),
 
+   # the docs
+   PDL::PP::Rule->new("PdlDoc", "FullDoc", sub {
+         my $fulldoc = shift;
+         
+         # Remove bad documentation if bad values are not supported
+         $fulldoc =~ s/=for bad\n\n.*?\n\n//s unless $bvalflag;
+         
+         # Append a final cut if it doesn't exist due to heredoc shinanigans
+         $fulldoc .= "\n\n=cut\n" unless $fulldoc =~ /\n=cut\n*$/;
+         
+         # Make sure the =head1 FUNCTIONS section gets added
+         $::DOCUMENTED++;
+         
+         return $fulldoc;
+      }
+   ),
+   PDL::PP::Rule->new("PdlDoc", ["Name","_Pars","OtherPars","Doc","_BadDoc"], \&GenDocs),
+   
+   ##################
+   # Done with Docs #
+   ##################
+   
+   # Notes
+   # Suffix 'NS' means, "Needs Substitution". In other words, the string
+   # associated with a key that has the suffix "NS" must be run through a
+   # Substitute or Substitute::Usual
 
+# some defaults
+#
    PDL::PP::Rule::Returns->new("CopyName", [],
        'Sets the CopyName key to the default: __copy', "__copy"),
 
@@ -2755,57 +3061,6 @@ $PDL::PP::deftbl =
 			      '$PRIV(flags) |= PDL_ITRANS_DO_DATAFLOW_F | PDL_ITRANS_DO_DATAFLOW_B;'
 				: 'PDL_COMMENT("No flow")'}),
 
-# no docs by default
-#
-   PDL::PP::Rule::Returns->new("Doc", [], 'Sets the default doc string',
-    "\n=for ref\n\ninfo not available\n"),
-
-# try and automate the docs
-# could be really clever and include the sig to see about
-# input/output params, for instance
-#
-   PDL::PP::Rule->new("BadDoc", ["BadFlag","Name","_CopyBadStatusCode"],
-              'Sets the default documentation for handling of bad values',
-		      sub {
-			  return undef unless $bvalflag;
-			  my ( $bf, $name, $code ) = @_;
-			  my $str;
-			  if ( ! defined($bf) ) {
-			      $str = "$name does not process bad values.\n";
-			  } elsif ( $bf ) {
-			      $str = "$name does handle bad values.\n";
-			  } else {
-			      $str = "$name ignores the bad-value flag of the input piddles.\n";
-			  }
-			  if ( ! defined($code) ) {
-			      $str .= "It will set the bad-value flag of all output piddles if " .
-				"the flag is set for any of the input piddles.\n";
-			  } elsif (  $code eq '' ) {
-			      $str .= "The output piddles will NOT have their bad-value flag set.\n";
-			  } else {
-			      $str .= "The state of the bad-value flag of the output piddles is unknown.\n";
-			  }
-		      }),
-
-# P2Child implicitly means "no data type changes".
-# No p2child by default.
-#
-#   PDL::PP::Rule->new("HASP2Child", "_P2Child",
-#      'Sets HASP2Child to a defined boolean value, even if P2Child is not defined',
-#      sub {
-#         my ($p2child) = @_;
-#         if (defined $p2child) {
-#            return $p2child != 0;
-#         }
-#         return 0;
-#      }),
-
-# Default: no otherpars
-#
-   PDL::PP::Rule::Returns::EmptyString->new("OtherPars"),
-
-# some defaults
-#
 # Question: where is ppdefs defined?
 # Answer: Core/Types.pm
 #
@@ -2830,7 +3085,7 @@ $PDL::PP::deftbl =
 # Same number of dimensions is assumed, though.
 #
    PDL::PP::Rule->new("AffinePriv", "XCHGOnly", sub { return @_; }),
-   PDL::PP::Rule::Returns->new("Priv", "AffinePriv", 'PDL_Long incs[$CHILD(ndims)];PDL_Long offs; '),
+   PDL::PP::Rule::Returns->new("Priv", "AffinePriv", 'PDL_Indx incs[$CHILD(ndims)];PDL_Indx offs; '),
    PDL::PP::Rule::Returns->new("IsAffineFlag", "AffinePriv", "PDL_ITRANS_ISAFFINE"),
 
    PDL::PP::Rule->new("RedoDims", ["EquivPDimExpr","FHdrInfo","_EquivDimCheck"],
@@ -2887,9 +3142,6 @@ $PDL::PP::deftbl =
 
    PDL::PP::Rule::Returns::One->new("HaveThreading"),
 
-# the docs
-   PDL::PP::Rule->new("PdlDoc", ["Name","_Pars","OtherPars","Doc","_BadDoc"], \&GenDocs),
-
 # Parameters in the 'a(x,y); [o]b(y)' format, with
 # fixed nos of real, unthreaded-over dims.
 #
@@ -30,9 +30,10 @@ package PDL::Lvalue;
 
 # list of functions that can be used as lvalue subs
 # extend as necessary
-my @funcs = qw/slice mslice nslice nslice_if_pdl index where px diagonal clump
-  dummy index2d dice dice_axis xchg mv flat sever polyfillv range rangeb 
-  indexND indexNDb reshape/;
+my @funcs = qw/ clump diagonal dice dice_axis dummy flat
+                index index2d indexND indexNDb mslice mv
+                nslice nslice_if_pdl nnslice polyfillv px range
+                rangeb reshape sever slice where whereND xchg /;
 
 my $prots = join "\n", map {"use attributes 'PDL', \\&PDL::$_, 'lvalue';"}
   @funcs;
@@ -33,6 +33,7 @@ WriteMakefile(
 	      'MAN3PODS' => \%man3pods,
      'DIR'      => ['Pod','Gen','SourceFilter','Core','Bad','Ops','Ufunc',
 		    'Primitive','Slices','Test','Math','MatrixOps','Complex'],
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
 # modify clean method not to delete files named 'core' 
@@ -1,5 +1,6 @@
 
 use strict;
+use Config;
 
 pp_addpm({At=>'Top'},<<'EOD');
 =head1 NAME
@@ -16,12 +17,12 @@ PDL::Math - extended mathematical operations and special functions
 =head1 DESCRIPTION
 
 This module extends PDL with more advanced mathematical functions than
-provided by standard Perl.  
+provided by standard Perl.
 
 All the functions have one input pdl, and one output, unless otherwise
 stated.
 
-Many of the functions are linked from the system maths library or the 
+Many of the functions are linked from the system maths library or the
 Cephes maths library (determined when PDL is compiled); a few are implemented
 entirely in PDL.
 
@@ -79,13 +80,13 @@ The value for which the area under the
 Gaussian probability density function (integrated from
 minus infinity) is equal to the argument (cf L<erfi|/erfi>).");
 
-doco(qw/bessj0 bessj1/, 
+doco(qw/bessj0 bessj1/,
      "The regular Bessel function of the first kind, J_n" );
 
-doco(qw/bessy0 bessy1/, 
+doco(qw/bessy0 bessy1/,
      "The regular Bessel function of the second kind, Y_n." );
 
-doco( qw/bessjn/, 
+doco( qw/bessjn/,
 '=for ref
 
 The regular Bessel function of the first kind, J_n
@@ -94,7 +95,7 @@ This takes a second int argument which gives the order
 of the function required.
 ');
 
-doco( qw/bessyn/, 
+doco( qw/bessyn/,
 '=for ref
 
 The regular Bessel function of the first kind, Y_n
@@ -103,7 +104,7 @@ This takes a second int argument which gives the order
 of the function required.
 ');
 
-if ($^O !~ /win32/i) {  # doesn't seem to be in the MS VC lib
+if ($^O !~ /win32/i || $Config{cc} =~ /\bgcc/i) {  # doesn't seem to be in the MS VC lib
 doco( 'lgamma' ,<<'EOD');
 =for ref
 
@@ -158,11 +159,11 @@ pp_addhdr('
 my (@ufuncs1) = qw(acos asin atan cosh sinh tan tanh); # F,D only
 my (@ufuncs1g) = qw(ceil floor rint); # Any type
 
-# Note: 
+# Note:
 #  ops.pd has a power() function that does the same thing
 #  (although it has OtherPars => 'int swap;' as well)
 #  - left this in for now.
-# 
+#
 my (@bifuncs1) = qw(pow); # Any type
 
 # Extended `-lm'
@@ -172,21 +173,21 @@ my (@besbifuncs) = qw(jn yn); # "
 # Need igamma, ibeta, and a fall-back implementation of the above
 
 sub code_ufunc    { return '$b() = ' . $_[0] . '($a());'; }
-sub badcode_ufunc { 
+sub badcode_ufunc {
     my $name = $_[0];
-    return 'if ( $ISBAD(a()) ) { $SETBAD(b()); } else { $b() = ' . $name . '($a()); }'; 
+    return 'if ( $ISBAD(a()) ) { $SETBAD(b()); } else { $b() = ' . $name . '($a()); }';
 }
 
-sub code_bifunc { 
+sub code_bifunc {
     my $name = $_[0]; my $a = $_[1] || 'a'; my $b = $_[2] || 'b';
     my $c = $_[3] || 'c';
-    return "\$$c() = $name(\$$a(),\$$b());"; 
+    return "\$$c() = $name(\$$a(),\$$b());";
 }
-sub badcode_bifunc { 
+sub badcode_bifunc {
     my $name = $_[0]; my $a = $_[1] || 'a'; my $b = $_[2] || 'b';
     my $c = $_[3] || 'c';
     return 'if ( $ISBAD('.$a.'()) || $ISBAD('.$b.'()) ) { $SETBAD('.$c.'()); } else { ' .
-	"\$$c() = $name(\$$a(),\$$b()); }"; 
+	"\$$c() = $name(\$$a(),\$$b()); }";
 }
 
 sub inplace_doc {
@@ -283,7 +284,7 @@ if ($^O !~ /win32/i) {
 	   'extern int signgam;
 	    $b() = lgamma($a());
 	    $s() = signgam;',     # what happens to signgam if $a() is bad?
-	   BadCode => 
+	   BadCode =>
 	   'extern int signgam;
             if ( $ISBAD(a()) ) {
                $SETBAD(b()); $SETBAD(s());
@@ -294,21 +295,39 @@ if ($^O !~ /win32/i) {
 	   );
 } # if: os !~ win32
 
+elsif ($Config{cc} =~ /\bgcc/i) {
+    pp_def("lgamma",
+	   HandleBad => 1,
+	   Pars => 'a(); [o]b(); int[o]s()',
+	   Doc => $doco{"lgamma"},
+	   Code =>
+	   '$b() = lgamma($a());
+	    $s() = tgamma($a()) < 0 ? -1 : 1;',     # what happens to signgam if $a() is bad?
+	   BadCode =>
+	   'if ( $ISBAD(a()) ) {
+               $SETBAD(b()); $SETBAD(s());
+            } else {
+               $b() = lgamma($a());
+               $s() = tgamma($a()) < 0 ? -1 : 1;
+            }',
+	   );
+} # elsif: cc =~ /\bgcc/i
+
 pp_def(
        'badmask',
        Pars => 'a(); b(); [o]c();',
        Inplace => [ 'a' ],
        HandleBad => 1,
-       Code => 
+       Code =>
        '$c() = finite($a()) ? $a() : $b();',
-       BadCode => 
+       BadCode =>
        '$c() = ( finite($a()) && $ISGOOD(a()) ) ? $a() : $b();',
-       CopyBadStatusCode => 
+       CopyBadStatusCode =>
        'if ( a == c && $ISPDLSTATEBAD(a) )
            PDL->propogate_badflag( c, 0 );  /* propogate badflag if inplace AND its changed */
         $SETPDLSTATEGOOD(c);          /* always make sure the output is "good" */
        ',
-       Doc => 
+       Doc =>
 '=for ref
 
 Clears all C<infs> and C<nans> in C<$a> to the corresponding value in C<$b>.
@@ -319,7 +338,7 @@ badmask can be run with C<$a> inplace:
   $a->inplace->badmask(0);
 
 ',
-       BadDoc => 
+       BadDoc =>
        'If bad values are present, these are also cleared.',
        );
 
@@ -328,16 +347,16 @@ pp_def(
        Pars => 'a(); int [o]mask();',
        Inplace => 1,
        HandleBad => 1,
-       Code => 
+       Code =>
        '$mask() = finite((double) $a()) != 0;',
-       BadCode => 
+       BadCode =>
        '$mask() = finite((double) $a()) != 0 && $ISGOOD($a());',
-       CopyBadStatusCode => 
+       CopyBadStatusCode =>
        'if ( a == mask && $ISPDLSTATEBAD(a) )
            PDL->propogate_badflag( mask, 0 );  /* propogate badflag if inplace AND its changed */
         $SETPDLSTATEGOOD(mask);          /* always make sure the output is "good" */
        ',
-       Doc => 
+       Doc =>
 'Sets C<$mask> true if C<$a> is not a C<NaN> or C<inf> (either positive or negative). Works inplace.',
        BadDoc =>
 'Bad values are treated as C<NaN> or C<inf>.',
@@ -352,10 +371,10 @@ pp_def(
        Pars => 'a(); [o]b()',
        Inplace => 1,
        Doc => inplace_doc( "erfi" ),
-       Code => 
+       Code =>
        'extern double ndtri(double), SQRTH;
 	$b() = SQRTH*ndtri((1+(double)$a())/2);',
-       BadCode => 
+       BadCode =>
        'extern double ndtri(double), SQRTH;
         if ( $ISBAD(a()) ) { $SETBAD(b()); }
         else { $b() = SQRTH*ndtri((1+(double)$a())/2); }',
@@ -369,10 +388,10 @@ pp_def(
        Pars => 'a(); [o]b()',
        Inplace => 1,
        Doc => inplace_doc( "ndtri" ),
-       Code => 
+       Code =>
        'extern double ndtri(double);
 	$b() = ndtri((double)$a());',
-       BadCode => 
+       BadCode =>
        'extern double ndtri(double);
         if ( $ISBAD(a()) ) { $SETBAD(b()); }
 	else { $b() = ndtri((double)$a()); }',
@@ -93,7 +93,8 @@ use Carp;
 
 @ISA = qw/PDL::Exporter PDL/;
 
-$VERSION = "0.5";
+our $VERSION = "0.5";
+$VERSION = eval $VERSION;
 
 #######################################################################=
 #########
@@ -87,8 +87,6 @@ EOH
     # handle exceptions
     my $badcode = '$ISBAD(a()) || $ISBAD(b())';
     if ( exists $extra{Exception} ) {
-#	$badcode .= " || $extra{Exception}";
-#	print "Warning: ignored exception for $name\n";
 	delete $exists{Exception};
     }
 
@@ -165,7 +163,7 @@ EOH
   types(BU) %{
   \$c() = BU_$func(\$a(),\$b());
   %}
-  types(SLFD) %{
+  types(SLNFD) %{
   \$c() = $func(\$a(),\$b());
   %}
 ENDCODE
@@ -310,8 +308,8 @@ biop('ne','!=',0,'binary I<not equal to> operation (C<!=>)');
 ## bit ops
 # those need to be limited to the right types
 my $T = [B,U,S,L]; # the sensible types here
-biop('shiftleft','<<',1,'leftshift C<a$> by C<$b>',GenericTypes => $T);
-biop('shiftright','>>',1,'leftshift C<a$> by C<$b>',GenericTypes => $T);
+biop('shiftleft','<<',1,'leftshift C<$a> by C<$b>',GenericTypes => $T);
+biop('shiftright','>>',1,'rightshift C<$a> by C<$b>',GenericTypes => $T);
 biop('or2','|',0,'binary I<or> of two piddles',GenericTypes => $T);
 biop('and2','&',0,'binary I<and> of two piddles',GenericTypes => $T);
 biop('xor','^',0,'binary I<exclusive or> of two piddles',GenericTypes => $T);
@@ -320,7 +318,7 @@ biop('xor','^',0,'binary I<exclusive or> of two piddles',GenericTypes => $T);
 ufunc('bitnot','~','unary bit negation',GenericTypes => $T);
 
 # some standard binary functions
-bifunc('power',['pow','op**'],1,'raise piddle C<$a> to the power C<b>',GenericTypes => [D]);
+bifunc('power',['pow','op**'],1,'raise piddle C<$a> to the power C<$b>',GenericTypes => [D]);
 bifunc('atan2','atan2',1,'elementwise C<atan2> of two piddles',GenericTypes => [D]);
 bifunc('modulo',['MOD','op%'],1,'elementwise C<modulo> operation',unsigned=>1);
 bifunc('spaceship',['SPACE','op<=>'],1,'elementwise "<=>" operation');
@@ -45,7 +45,8 @@ require Exporter;
 
 # difference to 0.91 is that added CENTRE/CENTER as default
 # synonymns (patch by Diab Jerius [ #469110 ])
-$VERSION = '0.92';
+our $VERSION = '0.92';
+$VERSION = eval $VERSION;
 
 @ISA = qw(Exporter);
 
@@ -146,7 +146,7 @@ start-up modules.
 
 
 # set the version:
-$PDL::VERSION = '2.4.11'; # Go to sub numbering per git push
+$PDL::VERSION = '2.007';     # Go to sub numbering per git push
 
 # Main loader of standard PDL package
 
@@ -191,7 +191,23 @@ die $@ if $@;
 # properly recognizes the PDL package.
 package PDL;
 
+##################################################
+# Rudimentary handling for multiple Perl threads #
+##################################################
+my $clone_skip_should_be_quiet = 0;
+sub CLONE_SKIP {
+    warn("* If you need to share PDL data across threads, use memory mapped data, or\n"
+		. "* check out PDL::Parallel::threads, available on CPAN.\n"
+        . "* You can silence this warning by saying `PDL::no_clone_skip_warning;'\n"
+        . "* before you create your first thread.\n")
+        unless $clone_skip_should_be_quiet;
+    PDL::no_clone_skip_warning();
+    # Whether we warned or not, always return 1 to tell Perl not to clone PDL data
+    return 1;
+}
+sub no_clone_skip_warning {
+    $clone_skip_should_be_quiet = 1;
+}
 
 # Exit with OK status
-
 1;
@@ -81,7 +81,7 @@ runtime execution.
 
    __C__
 
-   static pdl* new_pdl(int datatype, PDL_Long dims[], int ndims)
+   static pdl* new_pdl(int datatype, PDL_Indx dims[], int ndims)
    {
      pdl *p = PDL->pdlnew();
      PDL->setdims (p, dims, ndims);  /* set dims */
@@ -93,10 +93,10 @@ runtime execution.
 
    pdl* myfloatseq()
    {
-     PDL_Long dims[] = {5,5,5};
+     PDL_Indx dims[] = {5,5,5};
      pdl *p = new_pdl(PDL_F,dims,3);
      PDL_Float *dataf = (PDL_Float *) p->data;
-     int i;
+     PDL_Indx i; /* dimensions might be 64bits */
 
      for (i=0;i<5*5*5;i++)
        dataf[i] = i; /* the data must be initialized ! */
@@ -163,7 +163,7 @@ The following script demonstrates a simple example:
     */
    typedef void (*DelMagic)(pdl *, int param);
    static void default_magic(pdl *p, int pa) { p->data = 0; }
-   static pdl* pdl_wrap(void *data, int datatype, PDL_Long dims[],
+   static pdl* pdl_wrap(void *data, int datatype, PDL_Indx dims[],
 			int ndims, DelMagic delete_magic, int delparam)
    {
      pdl* npdl = PDL->pdlnew(); /* get the empty container */
@@ -188,7 +188,7 @@ The following script demonstrates a simple example:
    static PDL_Byte* mkramp(void)
    {
      PDL_Byte *data;
-     int i;
+     int i; /* should use PDL_Indx to support 64bit pdl indexing */
 
      if ((data = malloc(SZ*SZ*sizeof(PDL_Byte))) == NULL)
        croak("mkramp: Couldn't allocate memory");
@@ -208,7 +208,7 @@ The following script demonstrates a simple example:
 
    pdl* mkpiddle()
    {
-     PDL_Long dims[] = {SZ,SZ};
+     PDL_Indx dims[] = {SZ,SZ};
      pdl *p;
 
      p = pdl_wrap((void *) mkramp(), PDL_B, dims, 2, 
@@ -332,7 +332,7 @@ C<SV *copy(pdl* p, char* )>
 
 =item *
 
-C<void *smalloc(int nbytes)>
+C<void *smalloc(STRLEN nbytes)>
 
 =item *
 
@@ -360,11 +360,14 @@ C<void make_physvaffine(pdl *p)>
 
 =item *
 
-C<void qsort_X(PDL_Xtype *data, int a, int b)> and
-C<void qsort_ind_X(PDL_Xtype *data, int *ix, int a, int b)>
+C<void qsort_X(PDL_Xtype *data, PDL_Indx a, PDL_Indx b)> and
+C<void qsort_ind_X(PDL_Xtype *data, PDL_Indx *ix, PDL_Indx a, PDL_Indx b)>
 
 where X is one of B,S,U,L,F,D and Xtype is one of Byte, Short, Ushort,
-Long, Float or Double.
+Long, Float or Double.  PDL_Indx is the C integer type corresponding to
+appropriate indexing size for the perl configuration (ivsize and ivtype).
+It can be either 'long' or 'long long' depending on whether your perl
+is 32bit or 64bit enabled.
 
 =item *
 
@@ -428,6 +431,8 @@ Feedback and corrections are welcome.
 
 =head1 COPYRIGHT
 
+Copyright 2013 Chris Marshall (chm@cpan.org).
+
 Copyright 2010 Christian Soeller (c.soeller@auckland.ac.nz).
 You can distribute and/or modify this document under the same
 terms as the current Perl license.
@@ -163,7 +163,7 @@ but it will run slower since you are going to have to handle the presence of bad
 
 If you create a piddle, it will have its bad-value flag set to 0. To change 
 this, use C<$pdl-E<gt>badflag($new_bad_status)>, where C<$new_bad_status> can be 0 or 1.
-When a routine creates a piddle, it's bad-value flag will depend on the input
+When a routine creates a piddle, its bad-value flag will depend on the input
 piddles: unless over-ridden (see the C<CopyBadStatusCode> option to C<pp_def>), the 
 bad-value flag will be set true if any of the input piddles contain bad values.
 To check that a piddle really contains bad data, use the C<check_badflag> method.
@@ -588,7 +588,7 @@ routine C<PDL::Core::Dev::isbigendian()>.
 
 =head1 WHAT ABOUT DOCUMENTATION?
 
-One of the strengths of PDL is it's on-line documentation. The aim is to use
+One of the strengths of PDL is its on-line documentation. The aim is to use
 this system to provide information on how/if a routine supports bad values:
 in many cases C<pp_def()> contains all the information anyway, so the 
 function-writer doesn't need to do anything at all! For the cases when this is
@@ -668,8 +668,6 @@ Several new files have been added:
   Basic/Bad/Makefile.PL
             bad.pd
 
-  IO/NDF/NDF.xs.PL
-
 etc
 
 =head1 TODO/SUGGESTIONS
@@ -704,7 +702,7 @@ as well. However, not sure what to do with parents, since:
   $b = $a->slice(); 
   $b->baddata(0)
 
-doesn't mean that C<$a> shouldn't have it's badvalue cleared.
+doesn't mean that C<$a> shouldn't have its badvalue cleared.
 however, after
 
   $b->baddata(1)
@@ -6,12 +6,12 @@ PDL::FAQ - Frequently asked questions about PDL
 
 =head1 VERSION
 
-Current FAQ version:  1.003
+Current FAQ version:  1.004
 
 
 =head1 DESCRIPTION
 
-This is version 1.003 of the PDL FAQ, a collection of  frequently 
+This is version 1.004 of the PDL FAQ, a collection of  frequently 
 asked questions about PDL - the Perl Data Language.  
 
 
@@ -397,16 +397,16 @@ I<very> good reason for doing that.
 =head2 Q: 3.3    What is the current version of PDL ?  
 
 
-As of this writing (FAQ version 1.003 of 19 Dec 2011) the latest stable version
-is 2.4.9.  The latest stable version should always be available from a CPAN
+As of this writing (FAQ version 1.004 of 16 Sep 2013) the latest stable version
+is 2.006.  The latest stable version should always be available from a CPAN
 mirror site near you (see L<Question 2.7|"Q: 2.7    Where do I get it?"> for
-info on where to get PDL.
+info on where to get PDL).
 
 The most current (possibly unstable) version of PDL can be obtained 
 from the Git repository, see L<Question 4.10|"Q: 4.9    How do I get PDL via Git?">
 and periodic CPAN developers releases of the Git code will be made for testing
-purposes and more general availability.  The current post-PDL-2.4.9 developers
-release of PDL is available as F<CHM/PDL-2.4.9_015.tar.gz> .
+purposes and more general availability.  The current post-PDL-2.006 developers
+release of PDL is available as F<CHM/PDL-2.006_07.tar.gz> .
 
 
 =head2 Q: 3.4    I want to contribute to the further development of PDL. How can I help?  
@@ -545,7 +545,7 @@ If someone is interested in providing binary distributions for other
 architectures, that would be very welcome. Let us know on the 
 pdl-porters@jach.hawaii.edu mailing list. Also check your Linux
 distribution's package manager as many now include PDL.  PPMs
-for win32 versions are also available.
+for win32 versions (both 32bit and 64bit) are also available.
 
 
 =head2 Q: 4.6    Does PDL run on Linux? (And what about packages?)  
@@ -565,7 +565,7 @@ PDL builds fine on Win32 using MinGW or Microsoft compilers.  See
 the F<win32/INSTALL> file in the PDL source distribution for details.
 Other compilers have not been tested--input is welcome.  There is
 also a distribution of PDL through ActiveState's ppm, though it
-might not always be the latest version.  PDL-2.4.9 builds out of
+might not always be the latest version.  PDL-2.006 builds out of
 the box on Strawberry Perl and ActiveState Perl.
 
 
@@ -589,12 +589,12 @@ Assume you have Git installed on your system and want to download the
 project source code into the directory C<PDL>. To get read-only access
 to the repository, you type at the command line
 
-   git clone git://pdl.git.sourceforge.net/gitroot/pdl/pdl PDL
+   git clone git://git.code.sf.net/p/pdl/code pdl-code
 
 For official PDL developers, to get read/write access to the repository
 type at the command line
 
-   git clone ssh://USERNAME@pdl.git.sourceforge.net/gitroot/pdl/pdl PDL
+   git clone ssh://USERNAME@git.code.sf.net/p/pdl/code pdl-code
 
 
 =head2 Q: 4.10   I had a problem with the Git version, how do I check if someone has submitted a patch?  
@@ -602,21 +602,20 @@ type at the command line
 
 The Sourceforge system contains a patch-manager which contains patches
 that have not yet been applied to the distribution. This can be
-accessed via the Tracker at PDL's Sourceforge project page
+accessed via the Tickets menu at PDL's Sourceforge project page
 L<http://sourceforge.net/projects/pdl> .
 
 In addition, if you are not subscribing to the mailing list,
 check the archive of the C<pdl-porters> and C<perldl> mailing lists.
-See Q: 3.2 for details.
+See L<Question 3.2|"Q: 3.2 Are there other PDL information sources on the Internet?"> for details.
 
 
 =head2 Q: 4.11   I have gotten developer access to Git, how do I upload my changes?
 
 
 The first thing you should do is to read the Git documentation and
-learn the basics about Git. There are links to this information from
-PDL's SF Git page L<http://sourceforge.net/scm/?type=git&group_id=612>
-. But here are the basics:
+learn the basics about Git. There are many sources available online.
+But here are the basics:
 
 Before you upload your changes, commit them to YOUR repository
 
@@ -874,7 +873,7 @@ all elements in a piddle fulfills some criterion:
     $a is not positive definite
 
 
-=head2 Q: 6.11   Logical operators and piddles -  '||' and ' & & ' doesn't work!  
+=head2 Q: 6.11   Logical operators and piddles -  '||' and '&&' don't work!  
 
 
 It is a common problem that you try to make a mask array or something 
@@ -1104,7 +1103,7 @@ and a wide variety of other video formats.
 =item *
 
 On CPAN you can find the L<PDL::NetCDF|PDL::NetCDF> module that works with the current
-released version of PDL 2.4.9.
+released version of PDL 2.006.
 
 =back
 
@@ -0,0 +1,615 @@
+
+=head1 NAME
+
+PDL::Index - an index of PDL documentation
+
+=head1 DESCRIPTION
+
+A meta document listing the documented PDL modules and
+the PDL manual documents
+
+=head1 PDL manuals
+
+=over 4
+
+=item *
+
+L<PDL::API|PDL::API> - making piddles from Perl and C/XS code
+
+=item *
+
+L<PDL::BadValues|PDL::BadValues> - Discussion of bad value support in PDL
+
+=item *
+
+L<PDL::Course|PDL::Course> - A journey through PDL's documentation, from beginner to advanced.
+
+=item *
+
+L<PDL::Dataflow|PDL::Dataflow> - description of the dataflow philosophy
+
+=item *
+
+L<PDL::Delta|PDL::Delta> - PDL changes between V1.0 and V2.0
+
+=item *
+
+L<PDL::FAQ|PDL::FAQ> - Frequently asked questions about PDL
+
+=item *
+
+L<PDL::IO|PDL::IO> - An overview of the modules in the PDL::IO namespace.
+
+=item *
+
+L<PDL::Indexing|PDL::Indexing> - Introduction to indexing and slicing piddles.
+
+=item *
+
+L<PDL::Internals|PDL::Internals> - description of some aspects of the current internals
+
+=item *
+
+L<PDL::MATLAB|PDL::MATLAB> - A guide for MATLAB users.
+
+=item *
+
+L<PDL::Modules|PDL::Modules> - A guide to PDL's module reference.
+
+=item *
+
+L<PDL::Objects|PDL::Objects> - Object-Orientation, what is it and how to exploit it
+
+=item *
+
+L<PDL::PP|PDL::PP> - Generate PDL routines from concise descriptions
+
+=item *
+
+L<PDL::ParallelCPU|PDL::ParallelCPU> - Parallel Processor MultiThreading Support in PDL (Experimental)
+
+=item *
+
+L<PDL::Philosophy|PDL::Philosophy> - Why did we write PDL?
+
+=item *
+
+L<PDL::QuickStart|PDL::QuickStart> - Quick introduction to PDL features.
+
+=item *
+
+L<PDL::Scilab|PDL::Scilab> - A guide for Scilab users.
+
+=item *
+
+L<PDL::Threading|PDL::Threading> - Tutorial for PDL's Threading feature
+
+=item *
+
+L<PDL::Tips|PDL::Tips> - Small tidbits of useful arcana. Programming tidbits and such.
+
+=item *
+
+L<PDL::Tutorials|PDL::Tutorials> - A guide to PDL's tutorial documentation.
+
+
+=back
+
+=head1 PDL scripts
+
+=over 4
+
+=item *
+
+L<pdl2|PDL::pdl2> - Simple shell (version 2) for PDL
+
+=item *
+
+L<pdldoc|PDL::pdldoc> - shell interface to PDL documentation
+
+=item *
+
+L<perldl|PDL::perldl> - Simple shell for PDL (see also L<pdl2>)
+
+=item *
+
+L<pptemplate|PDL::pptemplate> - script to generate Makefile.PL and PP file skeleton
+
+
+=back
+
+=head1 PDL modules
+
+=over 4
+
+=item *
+
+L<PDL::PDL|PDL::PDL> - the Perl Data Language
+
+=item *
+
+L<PDL::AutoLoader|PDL::AutoLoader> - MatLab style AutoLoader for PDL
+
+=item *
+
+L<PDL::Bad|PDL::Bad> - PDL does process bad values
+
+=item *
+
+L<PDL::Basic|PDL::Basic> - Basic utility functions for PDL
+
+=item *
+
+L<PDL::CallExt|PDL::CallExt> - call functions in external shared libraries
+
+=item *
+
+L<PDL::Char|PDL::Char> - PDL subclass which allows reading and writing of fixed-length character strings as byte PDLs
+
+=item *
+
+L<PDL::Complex|PDL::Complex> - handle complex numbers
+
+=item *
+
+L<PDL::Compression|PDL::Compression> - compression utilities
+
+=item *
+
+L<PDL::Constants|PDL::Constants> - basic compile time constants for PDL
+
+=item *
+
+L<PDL::Core|PDL::Core> - fundamental PDL functionality and vectorization/threading
+
+=item *
+
+L<PDL::Core::Dev|PDL::Core::Dev> - PDL development module
+
+=item *
+
+L<PDL::Dbg|PDL::Dbg> - functions to support debugging of PDL scripts
+
+=item *
+
+L<PDL::DiskCache|PDL::DiskCache> - Non-memory-resident array object
+
+=item *
+
+L<PDL::Doc|PDL::Doc> - support for PDL online documentation
+
+=item *
+
+L<PDL::Doc::Perldl|PDL::Doc::Perldl> - commands for accessing PDL doc database from 'perldl' shell
+
+=item *
+
+L<PDL::Exporter|PDL::Exporter> - PDL export control
+
+=item *
+
+L<PDL::FFT|PDL::FFT> - FFTs for PDL
+
+=item *
+
+L<PDL::FFTW|PDL::FFTW> - PDL interface to the Fastest Fourier Transform in the West v2.x
+
+=item *
+
+L<PDL::Filter::LinPred|PDL::Filter::LinPred> - Linear predictive filtering
+
+=item *
+
+L<PDL::Filter::Linear|PDL::Filter::Linear> - linear filtering for PDL
+
+=item *
+
+L<PDL::Fit::Gaussian|PDL::Fit::Gaussian> - routines for fitting gaussians
+
+=item *
+
+L<PDL::Fit::LM|PDL::Fit::LM> - Levenberg-Marquardt fitting routine for PDL
+
+=item *
+
+L<PDL::Fit::Linfit|PDL::Fit::Linfit> - routines for fitting data with linear combinations of functions.
+
+=item *
+
+L<PDL::Fit::Polynomial|PDL::Fit::Polynomial> - routines for fitting with polynomials
+
+=item *
+
+L<PDL::Func|PDL::Func> - interpolation, integration, & gradient estimation (differentiation) of functions
+
+=item *
+
+L<PDL::GIS::Proj|PDL::GIS::Proj> - PDL interface to the Proj4 projection library.
+
+=item *
+
+L<PDL::GSL::DIFF|PDL::GSL::DIFF> - PDL interface to numerical differentiation routines in GSL
+
+=item *
+
+L<PDL::GSL::INTEG|PDL::GSL::INTEG> - PDL interface to numerical integration routines in GSL
+
+=item *
+
+L<PDL::GSL::INTERP|PDL::GSL::INTERP> - PDL interface to Interpolation routines in GSL
+
+=item *
+
+L<PDL::GSL::MROOT|PDL::GSL::MROOT> - PDL interface to multidimensional root-finding routines in GSL
+
+=item *
+
+L<PDL::GSL::RNG|PDL::GSL::RNG> - PDL interface to RNG and randist routines in GSL
+
+=item *
+
+L<PDL::GSLSF::AIRY|PDL::GSLSF::AIRY> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::BESSEL|PDL::GSLSF::BESSEL> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::CLAUSEN|PDL::GSLSF::CLAUSEN> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::COULOMB|PDL::GSLSF::COULOMB> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::COUPLING|PDL::GSLSF::COUPLING> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::DAWSON|PDL::GSLSF::DAWSON> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::DEBYE|PDL::GSLSF::DEBYE> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::DILOG|PDL::GSLSF::DILOG> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::ELEMENTARY|PDL::GSLSF::ELEMENTARY> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::ELLINT|PDL::GSLSF::ELLINT> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::ELLJAC|PDL::GSLSF::ELLJAC> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::ERF|PDL::GSLSF::ERF> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::EXP|PDL::GSLSF::EXP> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::EXPINT|PDL::GSLSF::EXPINT> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::FERMI_DIRAC|PDL::GSLSF::FERMI_DIRAC> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::GAMMA|PDL::GSLSF::GAMMA> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::GEGENBAUER|PDL::GSLSF::GEGENBAUER> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::HYPERG|PDL::GSLSF::HYPERG> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::LAGUERRE|PDL::GSLSF::LAGUERRE> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::LEGENDRE|PDL::GSLSF::LEGENDRE> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::LOG|PDL::GSLSF::LOG> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::POLY|PDL::GSLSF::POLY> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::POW_INT|PDL::GSLSF::POW_INT> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::PSI|PDL::GSLSF::PSI> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::SYNCHROTRON|PDL::GSLSF::SYNCHROTRON> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::TRANSPORT|PDL::GSLSF::TRANSPORT> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::TRIG|PDL::GSLSF::TRIG> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::GSLSF::ZETA|PDL::GSLSF::ZETA> - PDL interface to GSL Special Functions
+
+=item *
+
+L<PDL::Gaussian|PDL::Gaussian> - Gaussian distributions.
+
+=item *
+
+L<PDL::Graphics2D|PDL::Graphics2D> - An object oriented interface to PDL graphics
+
+=item *
+
+L<PDL::Graphics::IIS|PDL::Graphics::IIS> - Display PDL images on IIS devices (saoimage/ximtool)
+
+=item *
+
+L<PDL::Graphics::LUT|PDL::Graphics::LUT> - provides access to a number of look-up tables
+
+=item *
+
+L<PDL::Graphics::Limits|PDL::Graphics::Limits> - derive limits for display purposes
+
+=item *
+
+L<PDL::Graphics::OpenGL::Perl::OpenGL|PDL::Graphics::OpenGL::Perl::OpenGL> - PDL TriD OpenGL interface using POGL
+
+=item *
+
+L<PDL::Graphics::OpenGLQ|PDL::Graphics::OpenGLQ> - quick routines to plot lots of stuff from piddles.
+
+=item *
+
+L<PDL::Graphics::PGPLOT|PDL::Graphics::PGPLOT> - PGPLOT enhanced interface for PDL
+
+=item *
+
+L<PDL::Graphics::PGPLOT::Window|PDL::Graphics::PGPLOT::Window> - A OO interface to PGPLOT windows
+
+=item *
+
+L<PDL::Graphics::PGPLOTOptions|PDL::Graphics::PGPLOTOptions> - Setting PGPLOT options
+
+=item *
+
+L<PDL::Graphics::PLplot|PDL::Graphics::PLplot> - Object-oriented interface from perl/PDL to the PLPLOT plotting library
+
+=item *
+
+L<PDL::Graphics::TriD|PDL::Graphics::TriD> - PDL 3D interface
+
+=item *
+
+L<PDL::Graphics::TriD::ButtonControl|PDL::Graphics::TriD::ButtonControl> - default event handler subroutines
+
+=item *
+
+L<PDL::Graphics::TriD::Contours|PDL::Graphics::TriD::Contours> - 3D Surface contours for TriD
+
+=item *
+
+L<PDL::Graphics::TriD::Labels|PDL::Graphics::TriD::Labels> - Text tools
+
+=item *
+
+L<PDL::Graphics::TriD::MathGraph|PDL::Graphics::TriD::MathGraph> - Mathematical Graph objects for PDL
+
+=item *
+
+L<PDL::Graphics::TriD::Objects|PDL::Graphics::TriD::Objects> - Simple Graph Objects for TriD
+
+=item *
+
+L<PDL::Graphics::TriD::Rout|PDL::Graphics::TriD::Rout> - Helper routines for Three-dimensional graphics
+
+=item *
+
+L<PDL::Graphics::TriD::Tk|PDL::Graphics::TriD::Tk> - A Tk widget interface to the PDL::Graphics::TriD.
+
+=item *
+
+L<PDL::Graphics::TriD::VRML|PDL::Graphics::TriD::VRML> - TriD VRML backend
+
+=item *
+
+L<PDL::IO::Dicom|PDL::IO::Dicom> - a module for reading DICOM images.
+
+=item *
+
+L<PDL::IO::Dumper|PDL::IO::Dumper> - data dumping for structs with PDLs
+
+=item *
+
+L<PDL::IO::FITS|PDL::IO::FITS> - Simple FITS support for PDL
+
+=item *
+
+L<PDL::IO::FastRaw|PDL::IO::FastRaw> - A simple, fast and convenient io format for PerlDL.
+
+=item *
+
+L<PDL::IO::FlexRaw|PDL::IO::FlexRaw> - A flexible binary I/O format for PerlDL
+
+=item *
+
+L<PDL::IO::GD|PDL::IO::GD> - Interface to the GD image library.
+
+=item *
+
+L<PDL::IO::HDF|PDL::IO::HDF> - An interface library for HDF4 files.
+
+=item *
+
+L<PDL::IO::HDF::SD|PDL::IO::HDF::SD> - PDL interface to the HDF4 SD library.
+
+=item *
+
+L<PDL::IO::IDL|PDL::IO::IDL> - I/O of IDL Save Files
+
+=item *
+
+L<PDL::IO::Misc|PDL::IO::Misc> - misc IO routines for PDL
+
+=item *
+
+L<PDL::IO::Pic|PDL::IO::Pic> - image I/O for PDL
+
+=item *
+
+L<PDL::IO::Pnm|PDL::IO::Pnm> - pnm format I/O for PDL
+
+=item *
+
+L<PDL::IO::Storable|PDL::IO::Storable> - helper functions to make PDL usable with Storable
+
+=item *
+
+L<PDL::Image2D|PDL::Image2D> - Miscellaneous 2D image processing functions
+
+=item *
+
+L<PDL::ImageND|PDL::ImageND> - useful image processing in N dimensions
+
+=item *
+
+L<PDL::ImageRGB|PDL::ImageRGB> - some utility functions for RGB image data handling
+
+=item *
+
+L<PDL::Lite|PDL::Lite> - minimum PDL module OO loader
+
+=item *
+
+L<PDL::LiteF|PDL::LiteF> - minimum PDL module function loader
+
+=item *
+
+L<PDL::Lvalue|PDL::Lvalue> - declare PDL lvalue subs
+
+=item *
+
+L<PDL::Math|PDL::Math> - extended mathematical operations and special functions
+
+=item *
+
+L<PDL::Matrix|PDL::Matrix> - a convenience matrix class for column-major access
+
+=item *
+
+L<PDL::MatrixOps|PDL::MatrixOps> - Some Useful Matrix Operations
+
+=item *
+
+L<PDL::Minuit|PDL::Minuit> - a PDL interface to the Minuit library
+
+=item *
+
+L<PDL::NiceSlice|PDL::NiceSlice> - toward a nicer slicing syntax for PDL
+
+=item *
+
+L<PDL::Ops|PDL::Ops> - Fundamental mathematical operators
+
+=item *
+
+L<PDL::Opt::Simplex|PDL::Opt::Simplex> - Simplex optimization routines
+
+=item *
+
+L<PDL::Options|PDL::Options> - simplifies option passing by hash in PerlDL
+
+=item *
+
+L<PDL::Perldl2::Plugin::CleanErrors|PDL::Perldl2::Plugin::CleanErrors> - filter out Moose cruft
+
+=item *
+
+L<PDL::Perldl2::Plugin::NiceSlice|PDL::Perldl2::Plugin::NiceSlice> - enable PDL NiceSlice syntax
+
+=item *
+
+L<PDL::Perldl2::Plugin::PDLCommands|PDL::Perldl2::Plugin::PDLCommands> - implement perldl aliases/escapes
+
+=item *
+
+L<PDL::Perldl2::Plugin::PrintControl|PDL::Perldl2::Plugin::PrintControl> - disable default print output
+
+=item *
+
+L<PDL::Perldl2::Profile::Perldl2|PDL::Perldl2::Profile::Perldl2> - profile for Perldl2 shell
+
+=item *
+
+L<PDL::Primitive|PDL::Primitive> - primitive operations for pdl
+
+=item *
+
+L<PDL::Reduce|PDL::Reduce> - a C<reduce> function for PDL
+
+=item *
+
+L<PDL::Slatec|PDL::Slatec> - PDL interface to the slatec numerical programming library
+
+=item *
+
+L<PDL::Slices|PDL::Slices> - Indexing, slicing, and dicing
+
+=item *
+
+L<PDL::Tests|PDL::Tests> - tests for some PP features
+
+=item *
+
+L<PDL::Transform|PDL::Transform> - Coordinate transforms, image warping, and N-D functions
+
+=item *
+
+L<PDL::Transform::Cartography|PDL::Transform::Cartography> - Useful cartographic projections
+
+=item *
+
+L<PDL::Transform::Proj4|PDL::Transform::Proj4> - PDL::Transform interface to the Proj4 projection library
+
+=item *
+
+L<PDL::Types|PDL::Types> - define fundamental PDL Datatypes
+
+=item *
+
+L<PDL::Ufunc|PDL::Ufunc> - primitive ufunc operations for pdl
+
+
+=back
+
+=head1 HISTORY
+
+Automatically generated by scantree.pl for PDL version 2.004_995.
+
@@ -70,10 +70,10 @@ of the file F<pdlcore.h>. So what does the structure look like:
 
 	   void *datasv;        /* Pointer to SV containing data. Refcnt inced */
 	   void *data;            /* Null: no data alloced for this one */
-	   int nvals;           /* How many values allocated */
+	   PDL_Indx nvals;           /* How many values allocated */
 	   int datatype;
-	   PDL_Long   *dims;      /* Array of data dimensions */
-	   PDL_Long   *dimincs;   /* Array of data default increments */
+	   PDL_Indx   *dims;      /* Array of data dimensions */
+	   PDL_Indx   *dimincs;   /* Array of data default increments */
 	   short    ndims;     /* Number of data dimensions */
 
 	   unsigned char *threadids;  /* Starting index of the thread index set n */
@@ -88,8 +88,8 @@ of the file F<pdlcore.h>. So what does the structure look like:
 
 	   short living_for; /* Perl side not referenced; delete me when */
 
-	   PDL_Long   def_dims[PDL_NDIMS];   /* Preallocated space for efficiency */
-	   PDL_Long   def_dimincs[PDL_NDIMS];   /* Preallocated space for efficiency */
+	   PDL_Indx   def_dims[PDL_NDIMS];   /* Preallocated space for efficiency */
+	   PDL_Indx   def_dimincs[PDL_NDIMS];   /* Preallocated space for efficiency */
 	   unsigned char def_threadids[PDL_NTHREADIDS];
 
 	   struct pdl_magic *magic;
@@ -127,9 +127,10 @@ The actual pointer to data is stored in the member
 
 which contains a pointer to a memory area with space for
 
-	int nvals;
+	PDL_Indx nvals;
 
-data items of the data type of this piddle.
+data items of the data type of this piddle.  PDL_Indx is either 'long' or
+'long long' depending on whether your perl is 64bit or not.
 
 The data type of the data is stored in the variable
 
@@ -147,13 +148,13 @@ The number of dimensions in the piddle is given by the member
 
 which shows how many entries there are in the arrays
 
-	PDL_Long   *dims;      
-	PDL_Long   *dimincs;
+	PDL_Indx   *dims;      
+	PDL_Indx   *dimincs;
 
 These arrays are intimately related: C<dims> gives the sizes of the dimensions
 and C<dimincs> is always calculated by the code
 
-	int inc = 1;
+	PDL_Indx inc = 1;
         for(i=0; i<it->ndims; i++) {
 		it->dimincs[i] = inc; inc *= it->dims[i];
 	}
@@ -162,7 +163,7 @@ in the routine C<pdl_resize_defaultincs> in C<pdlapi.c>.
 What this means is that the dimincs can be used to calculate the offset
 by code like
 
-	int offs = 0;
+	PDL_Indx offs = 0;
 	for(i=0; i<it->ndims; i++) {
 		offs += it->dimincs[i] * index[i];
 	}
@@ -176,8 +177,8 @@ Since the vast majority of piddles don't have more than 6 dimensions,
 it is more efficient to have default storage for the dimensions and dimincs
 inside the PDL struct.
 
-   	PDL_Long   def_dims[PDL_NDIMS];   
-   	PDL_Long   def_dimincs[PDL_NDIMS]; 
+   	PDL_Indx   def_dims[PDL_NDIMS];   
+   	PDL_Indx   def_dimincs[PDL_NDIMS]; 
 
 The C<dims> and C<dimincs> may be set to point to the beginning of these
 arrays if C<ndims> is smaller than or equal to the compile-time constant
@@ -596,9 +597,9 @@ mailing list (pdl-porters@jach.hawaii.edu).
 =head1 AUTHOR
 
 Copyright(C) 1997 Tuomas J. Lukka (lukka@fas.harvard.edu),
-2000 Doug Burke (djburke@cpan.org), 2002 Christian Soeller & Doug Burke.
+2000 Doug Burke (djburke@cpan.org), 2002 Christian Soeller & Doug Burke,
+2013 Chris Marshall.
 
 Redistribution in the same form is allowed but reprinting requires
 a permission from the author.
 
-
@@ -12,9 +12,9 @@ B<This document is not a tutorial>. For that, go to L<PDL::QuickStart|
 PDL::QuickStart>. This document B<complements> the Quick Start guide, as
 it highlights the key differences between MATLAB and PDL.
 
-=head1 PERL
+=head1 Perl
 
-The key difference between MATLAB and PDL is B<PERL>.
+The key difference between MATLAB and PDL is B<Perl>.
 
 Perl is a general purpose programming language with thousands of modules
 freely available on the web. PDL is an extension of Perl. This gives PDL
@@ -81,7 +81,7 @@ Save this file as C<myprogram.pl> and run it with:
 
 =head2 New: Flexible syntax
 
-In very recent versions of PDL (version 2.4.6_006 or later) there is
+In current versions of PDL (version 2.4.7 or later) there is
 a flexible matrix syntax that can look extremely similar to MATLAB:
 
 1) Use a ';' to delimit rows:
@@ -142,14 +142,14 @@ MATLAB users will want to start here.
 
 =item Indices
 
-In PDL, indices start at '0' (like C and Java), not 1 (like MATLAB).
+In PDL, indices start at '0' (like C and Java), not 1 (like MATLAB or FORTRAN).
 For example, if C<$b> is an array with 5 elements, the elements would be
 numbered from 0 to 4.
 
 =item Displaying an object
 
-MATLAB normally displays object contents automatically. In PDL you display
-objects explicitly with the C<print> command or the shortcut C<p>:
+MATLAB normally displays object contents automatically. In the PDL shells you
+display objects explicitly with the C<print> command or the shortcut C<p>:
 
 MATLAB:
 
@@ -158,7 +158,7 @@ MATLAB:
  >> b = 23;       % Suppress output.
  >> 
 
-PerlDL:
+PDL Shell (perldl or pdl2):
 
  pdl> $a = 12    # No output.
  pdl> print $a   # Print object.
@@ -278,8 +278,8 @@ method is more flexible:
 =item Slicing and indices
 
 Extracting a subset from a collection of data is known as I<slicing>.
-The PDL shell and MATLAB have a similar syntax for slicing, but there
-are two important differences:
+PDL and MATLAB have a similar syntax for slicing, but there are two
+important differences:
 
 1) PDL indices start at 0, as in C and Java. MATLAB starts indices at 1.
 
@@ -522,7 +522,7 @@ For that, use I<piddles>:
   $pdl = ones 600, 600;
 
 For example:
- 
+
   $points =  pdl  1..10_000_000    # 4.7 seconds
   $points = sequence 10_000_000    # milliseconds
 
@@ -658,6 +658,15 @@ So, in the previous examples:
 
 =head1 ADDITIONAL FEATURES
 
+=head2 ASCII File IO
+
+To read data files containing whitespace separated columns of
+numbers (as would be read using the MATLAB I<load> command)
+one uses the PDL I<rcols> in L<PDL::IO::Misc>.  For a general
+review of the IO functionality available in PDL, see the
+documentation for L<PDL::IO>, e.g., C<help PDL::IO> in the I<pdl2>
+shell or C< pdldoc PDL::IO > from the shell command line.
+
 =head2 Data structures
 
 To create complex data structures, MATLAB uses "I<cell arrays>" and
@@ -5,7 +5,8 @@ BEGIN{if ($^O =~ /MSWin/) {
 }
 use ExtUtils::MakeMaker;
 
-@pods = map { $_=~s/.pod//; $_ } glob("*.pod");
+@pods = map { $_=~s/.pod//; $_ } grep { ! m/Index.pod/ } glob("*.pod");
+
 
 # do we want to create PP-Inline?
 eval 'require Pod::Select';
@@ -29,6 +30,7 @@ WriteMakefile(
  'PM'    =>     { @pms },
  'clean' => {FILES => "PP-Inline.pod"},
  'linkext' =>   {LINKTYPE => ''},  # No linking required in this directory
+ (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
 sub MY::postamble {
@@ -310,7 +310,8 @@ PDL interface to the NetPBM image library.
 
 =item L<PDL::IO::NDF|PDL::IO::NDF>
 
-PDL interface to the Starlink image library.
+PDL interface to the Starlink image library. Available
+as a separate CPAN download.
 
 =back
 
@@ -1,3 +1,7 @@
+package PDL::PP;
+
+__END__
+
 =head1 NAME
 
 PDL::PP - Generate PDL routines from concise descriptions
@@ -20,7 +24,130 @@ e.g.
 
 	pp_done();
 
-=head1 Overview
+=head1 FUNCTIONS
+
+Here is a quick reference list of the functions provided by PDL::PP.
+
+=head2 pp_add_boot
+
+=for ref
+
+Add code to the BOOT section of generated XS file
+
+
+=head2 pp_add_exported
+
+=for ref
+
+Add functions to the list of exported functions
+
+
+=head2 pp_add_isa
+
+=for ref
+
+Add entries to the @ISA list
+
+
+=head2 pp_addbegin
+
+=for ref
+
+Sets code to be added at the top of the generate .pm file
+
+
+=head2 pp_addhdr
+
+=for ref
+
+Add code and includes to C section of the generated XS file
+
+
+=head2 pp_addpm
+
+=for ref
+
+Add code to the generated .pm file
+
+
+=head2 pp_addxs
+
+=for ref
+
+Add extra XS code to the generated XS file
+
+=head2 pp_beginwrap
+
+=for ref
+
+Add BEGIN-block wrapping to code for the generated .pm file
+
+
+=head2 pp_bless
+
+=for ref
+
+Sets the package to which the XS code is added (default is PDL)
+
+
+=head2 pp_boundscheck
+
+=for ref
+
+Control state of PDL bounds checking activity
+
+
+=head2 pp_core_importList
+
+=for ref
+
+Specify what is imported from PDL::Core
+
+
+=head2 pp_def
+
+=for ref
+
+Define a new PDL function
+
+
+=head2 pp_deprecate_module
+
+=for ref
+
+Add runtime and POD warnings about a module being deprecated
+
+
+=head2 pp_done
+
+=for ref
+
+Mark the end of PDL::PP definitions in the file
+
+
+=head2 pp_export_nothing
+
+=for ref
+
+Clear out the export list for your generated module
+
+
+=head2 pp_line_numbers
+
+=for ref
+
+Add line number information to simplify debugging of PDL::PP code
+
+
+=head2 pp_setversion
+
+=for ref
+
+Set the version for .pm and .xs files
+
+
+
+=head1 OVERVIEW
 
 Why do we need PP? Several reasons: firstly, we want to be able to
 generate subroutine code for each of the PDL datatypes (PDL_Byte,
@@ -1635,6 +1762,41 @@ two. To use this, simply have the following line at some point in your
 However, don't use this if you use L<Module::Build::PDL>. See that
 module's documentation for details.
 
+=head3 pp_deprecate_module
+
+If a particular module is deemed obsolete, this function can be used to mark it
+as deprecated. This has the effect of emitting a warning when a user tries to
+C<use> the module. The generated POD for this module also carries a deprecation
+notice. The replacement module can be passed as an argument like this:
+
+ pp_deprecate_module( infavor => "PDL::NewNonDeprecatedModule" );
+
+Note that function affects I<only> the runtime warning and the POD.
+
+=head1 Making your PP function "private"
+
+Let's say that you have a function in your module called PDL::foo that
+uses the PP function C<bar_pp> to do the heavy lifting. But you don't
+want to advertise that C<bar_pp> exists. To do this, you must move your
+PP function to the top of your module file, then call
+
+ pp_export_nothing()
+
+to clear the C<EXPORT> list. To ensure that no documentation (even the
+default PP docs) is generated, set
+
+ Doc => undef
+
+and to prevent the function from being added to the symbol table, set
+
+ PMFunc => ''
+
+in your pp_def declaration (see Image2D.pd for an example). This will
+effectively make your PP function "private." However, it is I<always>
+accessible via PDL::bar_pp due to Perl's module design. But making
+it private will cause the user to go very far out of his or her way
+to use it, so he or she shoulders the consequences!
+
 =head1 Slice operation
 
 The slice operation section of this manual is provided using
@@ -1821,7 +1983,10 @@ define the signature of your function
 
 =item OtherPars
 
-arguments which are not pdls. Default: nothing. This is a semi-colon separated list of arguments, e.g., C<< OtherPars=>'int k; double value; char* fd' >>. See C<$COMP(x)> and also the same entry in L<Appendix B|Appendix B: PP macros and functions>.
+arguments which are not pdls. Default: nothing. This is a semi-colon
+separated list of arguments, e.g.,
+C<< OtherPars=>'int k; double value; char* fd' >>. See C<$COMP(x)> and
+also the same entry in L<Appendix B|/Appendix B: PP macros and functions>.
 
 =item Code
 
@@ -134,8 +134,8 @@ Here are some ways of creating a PDL variable:
    [1 2 3]
    [4 5 6]
  NEWPDL
- $edge1 = pdl q[1 -2];             # 2-element piddle containing  1 and -2
- $edge2 = pdl q[1 - 2];            # 1-element piddle containing -1
+ $c = pdl q[1 -2];             # 2-element piddle containing 1 and -2
+ $c = pdl q[1 - 2];            # 2-element piddle containing 1 and -2
  $b = pdl 42                   # 0-dimensional scalar
  $c = pdl $a;                  # Make a new copy
  
@@ -246,7 +246,13 @@ Default for pdl() is double. Conversions are:
  $c = long($d);   # "long" is generally a 4 byte int
  $d = byte($a);
 
-Also double(), short(), ushort().
+Also double(), short(), ushort(), indx().  
+
+  NOTE: The indx() routine is a special integer type that
+  is the correct size for a PDL index value (dimension size,
+  index, or offest) which can be either a 32bit (long) or
+  64bit (longlong) quantity depending on whether the perl
+  is built with 32bit or 64bit support.
 
 These routines also automatically convert Perl lists to
 allow the convenient shorthand:
@@ -388,11 +394,6 @@ package provides allows one to display images
 in these ("IIS" is the name of an ancient item of image display
 hardware whose protocols these tools conform to.)
 
-=item Karma (B<REMOVED>) 
-
-The L<PDL::Graphics::Karma|PDL::Graphics::Karma> module has
-been removed from the PDL distribution as of version 2.4.8.
-
 =item PDL::Graphics::TriD
 
 See L<PDL::Graphics::TriD|PDL::Graphics::TriD>, this is a collection
@@ -408,7 +409,7 @@ on demand, in a way perhaps familiar to users of MatLab.
 
 One can also write PDL extensions as normal Perl modules.
 
-=head2 PDL shell
+=head2 PDL shells
 
 The Perl script C<pdl2> (or C<perldl>) provides a simple command line interface
 to PDL.  If the latest Readlines/ReadKey modules have been installed C<pdl2>
@@ -12,9 +12,9 @@ B<This document is not a tutorial>. For that, go to L<PDL::QuickStart|
 PDL::QuickStart>. This document B<complements> the Quick Start guide, as
 it highlights the key differences between Scilab and PDL.
 
-=head1 PERL
+=head1 Perl
 
-The key difference between Scilab and PDL is B<PERL>.
+The key difference between Scilab and PDL is B<Perl>.
 
 Perl is a general purpose programming language with thousands of modules
 freely available on the web. PDL is an extension of Perl. This gives PDL
@@ -79,7 +79,7 @@ Save this file as C<myprogram.pl> and run it with:
 
 =head2 New: Flexible syntax
 
-In very recent versions of PDL (version 2.4.6_006 or later) there is
+In very recent versions of PDL (version 2.4.7 or later) there is
 a flexible matrix syntax that can look extremely similar to Scilab:
 
 1) Use a ';' to delimit rows:
@@ -242,11 +242,11 @@ sub PDL::matmult {
 }
 EOPM
 	Code => <<'EOC',
-	long ih, iw, it, ow, oh, ot, wlim, hlim, tlim;
+	PDL_Indx ih, iw, it, ow, oh, ot, wlim, hlim, tlim;
         $GENERIC() *ad, *bd, *cd;
-        long atdi, btdi;
-	long resh, resw, rest;
-	long tsiz = 64;
+        PDL_Indx atdi, btdi;
+	PDL_Indx resh, resw, rest;
+	PDL_Indx tsiz = 64;
 
 	// Zero the output
 	loop(w) %{
@@ -636,22 +636,22 @@ pp_def('norm',
 
 =for sig
 
-  Signature: (a(); int ind(); [o] sum(m))
+  Signature: (a(); indx ind(); [o] sum(m))
 
 =cut
 
 pp_def(
     'indadd',
     HandleBad => 1,
-    Pars => 'a(); int ind(); [o] sum(m)',
+    Pars => 'a(); indx ind(); [o] sum(m)',
     Code => 
-    'register int foo = $ind();
+    'register PDL_Indx foo = $ind();
      if( foo<0 || foo>=$SIZE(m) ) {
        barf("PDL::indadd: invalid index");
      }
      $sum(m => foo) += $a();',
     BadCode => 
-    'register int foo = $ind();
+    'register PDL_Indx foo = $ind();
      if( $ISBADVAR(foo,ind) || foo<0 || foo>=$SIZE(m) ) {
        barf("PDL::indadd: invalid index");
      }
@@ -761,11 +761,19 @@ Compare also L<conv2d|PDL::Image2D/conv2d>, L<convolve|PDL::ImageND/convolve>,
 L<fftconvolve|PDL::FFT/fftconvolve()>, L<fftwconv|PDL::FFTW/fftwconv>,
 L<rfftwconv|PDL::FFTW/rfftwconv>
 
+=for bad
+
+WARNING: C<conv1d> processes bad values in its inputs as
+the numeric value of C<< $pdl->badvalue >> so it is not
+recommended for processing pdls with bad values in them
+unless special care is taken.
+
 =cut
 
 EOD
         Pars => 'a(m); kern(p); [o]b(m);',
         OtherPars => 'int reflect;',
+        HandleBad => 0,
         PMCode => '
         
 sub PDL::conv1d {
@@ -831,8 +839,8 @@ test if a is in the set of values b
 =for example
 
    $goodmsk = $labels->in($goodlabels);
-   print pdl(4,3,1)->in(pdl(2,3,3));
-  [0 1 0]
+   print pdl(3,1,4,6,2)->in(pdl(2,3,3));
+  [1 0 0 0 1]
 
 C<in> is akin to the I<is an element of> of set theory. In priciple,
 PDL threading could be used to achieve its functionality by using a
@@ -916,7 +924,7 @@ sub PDL::uniq {
    if ( $uniq->nelem > 0 ) {
       $answ = $uniq->append($answ);
    } else {
-      $answ = ( ($srt->nelem == 0) ?  $srt : pdl( [$srt->index(0)] ) )->append($answ);
+      $answ = ( ($srt->nelem == 0) ?  $srt : PDL::pdl( ref($srt), [$srt->index(0)] ) )->append($answ);
    }
    return $answ;
 }
@@ -1867,7 +1875,7 @@ sub PDL::fibonacci{
 }
 EOD
      Code => '
-        PDL_Long i=0;
+        PDL_Indx i=0;
         $GENERIC() x1, x2;
 
         x1 = 1; x2 = 0;
@@ -1900,8 +1908,8 @@ pp_def('append',
                 $SIZE(mn) = (dpdla->ndims > 0 ? dpdla->dims[0] : 1) + 
                         (dpdlb->ndims > 0 ? dpdlb->dims[0] : 1);
 		',
-	Code => 'register PDL_Long mnp;
-		 PDL_Long ns = $SIZE(n);
+	Code => 'register PDL_Indx mnp;
+		 PDL_Indx ns = $SIZE(n);
                  threadloop %{
                        loop(n) %{ $c(mn => n) = $a(); %}
 		       loop(m) %{ mnp = m+ns; $c(mn => mnp) = $b(); %}
@@ -2182,7 +2190,7 @@ pp_add_exported('','grandom');
 
 =for sig
 
-  Signature: (i(); x(n); int [o]ip())
+  Signature: (i(); x(n); indx [o]ip())
 
 =cut
 
@@ -2190,12 +2198,12 @@ pp_add_exported('','grandom');
 pp_def('vsearch',
        HandleBad => 0,
        BadDoc => 'needs major (?) work to handles bad values',
-	Pars => 'i(); x(n); int [o]ip()',
+	Pars => 'i(); x(n); indx [o]ip()',
 	GenericTypes => ['F','D'], # too restrictive ?
 	Code => 'int carp=0;
 		 threadloop %{
-		   long n1 = $SIZE(n)-1;
-                   long jl=-1, jh=n1, m;
+		   PDL_Indx n1 = $SIZE(n)-1;
+                   PDL_Indx jl=-1, jh=n1, m;
 		   int up = ($x(n => n1) > $x(n => 0));
 		   $GENERIC() d;
   		   while (jh-jl > 1)  /* binary search */
@@ -2263,10 +2271,10 @@ pp_def('interpolate',
 	GenericTypes => ['F','D'], # too restrictive ?
 	Code => '
 		 $GENERIC() d;
-		 long n  = $SIZE(n);
-		 long n1 = n-1;
+		 PDL_Indx n  = $SIZE(n);
+		 PDL_Indx n1 = n-1;
 		 int up = ($x(n => n1) > $x(n => 0));
-                 long jl, jh, m;
+                 PDL_Indx jl, jh, m;
                  int carp;
 
                  threadloop %{
@@ -2522,11 +2530,17 @@ sub PDL::interpND {
 
     # Use 1/0 corners to select which multiplier happens, multiply
     # 'em all together to get sample weights, and sum to get the answer.
-    my $out =  ( ($a * ($crnr==1) + $b * ($crnr==0)) #index, clst, ith
+    my $out0 =  ( ($a * ($crnr==1) + $b * ($crnr==0)) #index, clst, ith
 		 -> prodover                          #clst, ith
 		 );
 
-    $out = ($out * $samp)->sumover; # ith, sth
+    my $out = ($out0 * $samp)->sumover; # ith, sth
+
+    # Work around BAD-not-being-contagious bug in PDL <= 2.6 bad handling code  --CED 3-April-2013
+    if($PDL::Bad::Status and $source->badflag) {
+	my $baddies = $samp->isbad->orover;
+	$out = $out->setbadif($baddies);
+    }
 
     return $out;
 
@@ -2671,7 +2685,7 @@ EOD
 
 =for sig
 
-  Signature: (mask(n); int [o] inds(m))
+  Signature: (mask(n); indx [o] inds(m))
 
 =cut
 
@@ -2724,7 +2738,7 @@ EOD
 
 =for sig
 
-  Signature: (mask(n); int [o] inds(m); int [o]notinds(q))
+  Signature: (mask(n); indx [o] inds(m); indx [o]notinds(q))
 
 =cut
 
@@ -2755,7 +2769,7 @@ EOD
 
     for (
 	 {Name=>'which',
-	  Pars => 'mask(n); int [o] inds(m);',
+	  Pars => 'mask(n); indx [o] inds(m);',
 	  Variables => 'int dm=0;',
 	  Elseclause => "",
 	  Autosize => '$SIZE(m) = sum;',
@@ -2771,7 +2785,7 @@ EOD
 EOD
 	  },
 	 {Name => 'which_both',
-	  Pars => 'mask(n); int [o] inds(m); int [o]notinds(q)',
+	  Pars => 'mask(n); indx [o] inds(m); indx [o]notinds(q)',
 	  Variables => 'int dm=0; int dm2=0;',
 	  Elseclause => "else { \n          \$notinds(q => dm2)=n; \n           dm2++;\n     }",
 	  Autosize => '$SIZE(m) = sum;'."\n".'  	  $SIZE(q) = dpdl->dims[0]-sum;',
@@ -2813,13 +2827,13 @@ EOD
 #               this will probably break once dataflow is enabled again
 #               *unless* we have made sure that mask is physical by now!!!
 	   RedoDimsCode => '
-		PDL_Long sum = 0;
+		PDL_Indx sum = 0;
 		/* not sure if this is necessary */
 		pdl * dpdl = $PDL(mask);
 		$GENERIC() *m_datap = (($GENERIC() *)(PDL_REPRP(dpdl)));
-		PDL_Long inc = PDL_REPRINC(dpdl,0);
-		PDL_Long offs = PDL_REPROFFS(dpdl);
-		int i;
+		PDL_Indx inc = PDL_REPRINC(dpdl,0);
+		PDL_Indx offs = PDL_REPROFFS(dpdl);
+		PDL_Indx i;
 
 		if (dpdl->ndims != 1)
 		  barf("dimflag currently works only with 1D pdls");
@@ -17,32 +17,32 @@ PDL::Slices -- Indexing, slicing, and dicing
 This package provides many of the powerful PerlDL core index
 manipulation routines.  These routines mostly allow two-way data flow,
 so you can modify your data in the most convenient representation.
-For example, you can make a 1000x1000 unit matrix with 
+For example, you can make a 1000x1000 unit matrix with
 
  $a = zeroes(1000,1000);
  $a->diagonal(0,1) ++;
 
 which is quite efficient. See L<PDL::Indexing> and L<PDL::Tips> for
-more examples.  
+more examples.
 
 Slicing is so central to the PDL language that a special compile-time
-syntax has been introduced to handle it compactly; see L<PDL::NiceSlice> 
+syntax has been introduced to handle it compactly; see L<PDL::NiceSlice>
 for details.
 
-PDL indexing and slicing functions usually include two-way data flow, 
+PDL indexing and slicing functions usually include two-way data flow,
 so that you can separate the actions of reshaping your data structures
 and modifying the data themselves.  Two special methods, L<copy|copy> and
-L<sever|sever>, help you control the data flow connection between related 
+L<sever|sever>, help you control the data flow connection between related
 variables.
 
  $b = $a->slice("1:3"); # Slice maintains a link between $a and $b.
- $b += 5;   		# $a is changed!
+ $b += 5;               # $a is changed!
 
 If you want to force a physical copy and no data flow, you can copy or
 sever the slice expression:
 
  $b = $a->slice("1:3")->copy;
- $b += 5;		# $a is not changed.
+ $b += 5;               # $a is not changed.
 
  $b = $a->slice("1:3")->sever;
  $b += 5;               # $a is not changed.
@@ -54,7 +54,7 @@ say
  $b = $a->slice("1:3");
  $c = $b->sever;
 
-then the variables C<$b> and C<$c> point to the same object but with 
+then the variables C<$b> and C<$c> point to the same object but with
 C<-E<gt>copy> they would not.
 
 =cut
@@ -69,8 +69,20 @@ FUNCTIONS
 
 # $::PP_VERBOSE=1;
 
+pp_addhdr(<<'EOH');
+
+#ifdef _MSC_VER
+#if _MSC_VER < 1300
+#define strtoll strtol
+#else
+#define strtoll _strtoi64
+#endif
+#endif
+
+EOH
+
 pp_add_boot(
-"  PDL->readdata_affine = pdl_readdata_affineinternal;\n" . 
+"  PDL->readdata_affine = pdl_readdata_affineinternal;\n" .
 "     PDL->writebackdata_affine = pdl_writebackdata_affineinternal;\n"
 );
 
@@ -89,18 +101,18 @@ pp_def(
        MakeComp => '$CROAK("AFMC MUSTNT BE CALLED");',
        RedoDims => '$CROAK("AFRD MUSTNT BE CALLED");',
        EquivCPOffsCode => '
-		int i; int poffs=$PRIV(offs); int nd;
-		for(i=0; i<$CHILD_P(nvals); i++) {
-			$EQUIVCPOFFS(i,poffs);
-			for(nd=0; nd<$CHILD_P(ndims); nd++) {
-				poffs += $PRIV(incs[nd]);
-				if(nd<$CHILD_P(ndims)-1 &&
-				   (i+1)%$CHILD_P(dimincs[nd+1]) ||
-				   nd == $CHILD_P(ndims)-1)
-					break;
-				poffs -= $PRIV(incs[nd]) *
-					$CHILD_P(dims[nd]);
-			}
+                PDL_Indx i; PDL_Indx poffs=$PRIV(offs); int nd;
+                for(i=0; i<$CHILD_P(nvals); i++) {
+                        $EQUIVCPOFFS(i,poffs);
+                        for(nd=0; nd<$CHILD_P(ndims); nd++) {
+                                poffs += $PRIV(incs[nd]);
+                                if(nd<$CHILD_P(ndims)-1 &&
+                                   (i+1)%$CHILD_P(dimincs[nd+1]) ||
+                                   nd == $CHILD_P(ndims)-1)
+                                        break;
+                                poffs -= $PRIV(incs[nd]) *
+                                        $CHILD_P(dims[nd]);
+                        }
                 }',
        Doc => undef,    # 'internal',
 );
@@ -118,17 +130,17 @@ Internal vaffine identity function.
 DOC
 
 pp_def(
-	's_identity',
+        's_identity',
         HandleBad => 1,
-	P2Child => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	DefaultFlow => 1,
-	OtherPars => '',
-	Reversible => 1,
-	Dims => '$COPYDIMS();',
-	ParentInds => '$COPYINDS();',
-	Identity => 1,
-	Doc => $doc,
+        DefaultFlow => 1,
+        OtherPars => '',
+        Reversible => 1,
+        Dims => '$COPYDIMS();',
+        ParentInds => '$COPYINDS();',
+        Identity => 1,
+        Doc => $doc,
 );
 
 =head2 index, index2d
@@ -138,17 +150,38 @@ pp_def(
 $doc = <<'EOD';
 =for ref
 
-C<index> and C<index2d> provide rudimentary index indirection.
+C<index>, C<index1d>, and C<index2d> provide rudimentary index indirection.
 
 =for example
 
  $c = index($source,$ind);
+ $c = index($source,$ind);
  $c = index2d($source2,$ind1,$ind2);
 
-use the C<$ind> variables as indices to look up values in C<$source>.  
-C<index2d> uses separate piddles for X and Y coordinates.  For more
-general N-dimensional indexing, see L<PDL::Slices> or the L<PDL::NiceSlice>
-syntax.
+use the C<$ind> variables as indices to look up values in C<$source>.
+The three routines thread slightly differently.
+
+=over 3
+
+=item C<index> uses direct threading for 1-D indexing across the 0 dim
+of C<$source>.  It can thread over source thread dims or index thread
+dims dims not not (easily) both: If <$source> has more than 1
+dimension and C<$ind> has more than 0 dimensions, they must agree in
+a threading sense.
+
+C<index1d> uses a single active dim in C<$ind> to produce a list of
+indexed values in the 0 dim of the output - it is useful for
+collapsing C<$source> by indexing with a single row of values long
+C<$source>'s 0 dimension.  The output has the same number of dims as
+C<$source>.  The 0 dim of the output has size 1 if C<$ind> is a
+scalar, and the same size as the 0 dim of C<$ind> if it is not. If
+C<$ind> and $<source> both have more than 1 dim, then all dims higher
+than 0 must agree in a threading sense.
+
+C<index2d> works like C<index> but uses separate piddles for X and Y
+coordinates.  For more general N-dimensional indexing, see the
+L<PDL::NiceSlice> syntax or L<PDL::Slices> (in particular C<slice>,
+C<indexND>, and C<range>).
 
 These functions are two-way, i.e. after
 
@@ -173,16 +206,16 @@ L<indexND|/indexND>.
 
 EOD
 
-my $index_init_good = 
-       'register int foo = $ind(); 
+my $index_init_good =
+       'register PDL_Indx foo = $ind();
         if( foo<0 || foo>=$SIZE(n) ) {
-	   barf("PDL::index: invalid index %d (valid range 0..%d)",
+           barf("PDL::index: invalid index %d (valid range 0..%d)",
                 foo,$SIZE(n)-1);
         }';
-my $index_init_bad = 
-       'register int foo = $ind(); 
+my $index_init_bad =
+       'register PDL_Indx foo = $ind();
         if( $ISBADVAR(foo,ind) || foo<0 || foo>=$SIZE(n) ) {
-	   barf("PDL::index: invalid index %d (valid range 0..%d)",
+           barf("PDL::index: invalid index %d (valid range 0..%d)",
                 foo,$SIZE(n)-1);
         }';
 
@@ -190,57 +223,122 @@ pp_def(
        'index',
        HandleBad => 1,
        DefaultFlow => 1,
-       Reversible => 1,	
-       Pars => 'a(n); int ind(); [oca] c();',
-       Code => 
+       Reversible => 1,
+       Pars => 'a(n); indx ind(); [oca] c();',
+       Code =>
        $index_init_good . ' $c() = $a(n => foo);',
-       BadCode => 
+$a =        BadCode =>
        $index_init_bad . ' $c() = $a(n => foo);',
-       BackCode => 
+       BackCode =>
        $index_init_good . ' $a(n => foo) = $c();',
-       BadBackCode => 
+       BadBackCode =>
        $index_init_bad . ' $a(n => foo) = $c();',
        Doc => $doc,
        BadDoc =>
        'index barfs if any of the index values are bad.',
        );
 
+pp_def(
+       'index1d',
+       HandleBad => 1,
+       DefaultFlow => 1,
+       Reversible => 1,
+       Pars => 'a(n); indx ind(m); [oca] c(m);',
+       Code =>
+       q{
+         PDL_Indx i;
+         for(i=0;i<$SIZE(m);i++) {
+                  PDL_Indx foo = $ind(m=>i);
+                  if( foo<0 || foo >= $SIZE(n) ) {
+                   barf("PDL::index1d: invalid index %d at pos %d (valid range 0..%d)",
+                     foo, i, $SIZE(n)-1);
+                  }
+                  $c(m=>i) = $a(n=>foo);
+         }
+        },
+        BadCode =>
+        q{
+         PDL_Indx i;
+         for(i=0;i<$SIZE(m);i++) {
+                 PDL_Indx foo = $ind(m=>i);
+                 if( $ISBADVAR(foo, ind) ) {
+                     $SETBAD(c(m=>i));
+                 } else {
+                   if( foo<0 || foo >= $SIZE(n) ) {
+                     barf("PDL::index1d: invalid/bad index %d at pos %d (valid range 0..%d)",
+                      foo, i, $SIZE(n)-1);
+                   }
+                   $c(m=>i) = $a(n=>foo);
+                 }
+         }
+        },
+       BackCode => q{
+         PDL_Indx i;
+         for(i=0;i<$SIZE(m);i++) {
+                PDL_Indx foo = $ind(m=>i);
+                if( foo<0 || foo >= $SIZE(n) ) {
+                 barf("PDL::index1d: invalid index %d at pos %d (valid range 0..%d)",
+                   foo, i, $SIZE(n)-1);
+                }
+                $a(n=>foo) = $c(m=>i);
+         }
+        },
+       BadBackCode => q{
+         PDL_Indx i;
+         for(i=0;i<$SIZE(m);i++) {
+                 PDL_Indx foo = $ind(m=>i);
+                 if( $ISBADVAR(foo, ind) ) {
+                   /* do nothing */
+                 } else {
+                   if( foo<0 || foo >= $SIZE(n) ) {
+                     barf("PDL::index1d: invalid/bad index %d at pos %d (valid range 0..%d)",
+                      foo, i, $SIZE(n)-1);
+                   }
+                   $a(n=>foo) = $c(m=>i);
+                 }
+         }
+        },
+       Doc => $doc,
+       BadDoc =>
+       'index1d propagates BAD index elements to the output variable.'
+       );
+
 my $index2d_init_good =
-       'register int fooa,foob;
-	fooa = $inda(); 
+       'register PDL_Indx fooa,foob;
+        fooa = $inda();
         if( fooa<0 || fooa>=$SIZE(na) ) {
            barf("PDL::index: invalid x-index %d (valid range 0..%d)",
                 fooa,$SIZE(na)-1);
         }
-	foob = $indb(); 
+        foob = $indb();
         if( foob<0 || foob>=$SIZE(nb) ) {
-	   barf("PDL::index: invalid y-index %d (valid range 0..%d)",
+           barf("PDL::index: invalid y-index %d (valid range 0..%d)",
                 foob,$SIZE(nb)-1);
         }';
 my $index2d_init_bad =
-       'register int fooa,foob;
-	fooa = $inda(); 
+       'register PDL_Indx fooa,foob;
+        fooa = $inda();
         if( $ISBADVAR(fooa,inda) || fooa<0 || fooa>=$SIZE(na) ) {
            barf("PDL::index: invalid index 1");
         }
-	foob = $indb(); 
+        foob = $indb();
         if( $ISBADVAR(foob,indb) || foob<0 || foob>=$SIZE(nb) ) {
-	   barf("PDL::index: invalid index 2");
+           barf("PDL::index: invalid index 2");
         }';
 
 pp_def(
        'index2d',
        HandleBad => 1,
        DefaultFlow => 1,
-       Reversible => 1,	
-       Pars => 'a(na,nb); int inda(); int indb(); [oca] c();',
-       Code => 
+       Reversible => 1,
+       Pars => 'a(na,nb); indx inda(); indx indb(); [oca] c();',
+       Code =>
        $index2d_init_good . ' $c() = $a(na => fooa, nb => foob);',
-       BadCode => 
+       BadCode =>
        $index2d_init_bad . '$c() = $a(na => fooa, nb => foob);',
-       BackCode => 
+       BackCode =>
        $index2d_init_good . ' $a(na => fooa, nb => foob) = $c();',
-       BadBackCode => 
+       BadBackCode =>
        $index2d_init_bad . '$a(na => fooa, nb => foob) = $c();',
        Doc => $doc,
        BadDoc =>
@@ -254,7 +352,7 @@ pp_addpm(<<'EOD-indexND');
 
 =head2 indexNDb
 
-=for ref 
+=for ref
 
   Backwards-compatibility alias for indexND
 
@@ -277,11 +375,11 @@ pp_addpm(<<'EOD-indexND');
    [67 89]
   ]
 
-IndexND collapses C<$index> by lookup into C<$source>.  The 
-0th dimension of C<$index> is treated as coordinates in C<$source>, and 
+IndexND collapses C<$index> by lookup into C<$source>.  The
+0th dimension of C<$index> is treated as coordinates in C<$source>, and
 the return value has the same dimensions as the rest of C<$index>.
 The returned elements are looked up from C<$source>.  Dataflow
-works -- propagated assignment flows back into C<$source>.  
+works -- propagated assignment flows back into C<$source>.
 
 IndexND and IndexNDb were originally separate routines but they are both
 now implemented as a call to L<range|/range>, and have identical syntax to
@@ -290,8 +388,8 @@ one another.
 =cut
 
 sub PDL::indexND {
-	my($source,$index, $boundary) = @_;
-	return PDL::range($source,$index,undef,$boundary);
+        my($source,$index, $boundary) = @_;
+        return PDL::range($source,$index,undef,$boundary);
 }
 
 *PDL::indexNDb = \&PDL::indexND;
@@ -318,15 +416,15 @@ sub PDL::range {
 
   $index = $index->dummy(0,1) unless $index->ndims;
 
-	
+
   # Pack boundary string if necessary
   if(defined $bound) {
     if(ref $bound eq 'ARRAY') {
       my ($s,$el);
       foreach $el(@$bound) {
-	barf "Illegal boundary value '$el' in range"
-  	  unless( $el =~ m/^([0123fFtTeEpPmM])/ );
-	$s .= $1;
+        barf "Illegal boundary value '$el' in range"
+          unless( $el =~ m/^([0123fFtTeEpPmM])/ );
+        $s .= $1;
       }
       $bound = $s;
     }
@@ -340,13 +438,14 @@ sub PDL::range {
 }
 EOD-range
 
-=head2 rangeb
+=head2 range
 
 =cut
 
 pp_def(
-	'rangeb',
-	Doc => <<'EOD',
+        'rangeb',
+        OtherPars => 'SV *index; SV *size; SV *boundary',
+        Doc => <<'EOD',
 =for ref
 
 Engine for L<range|/range>
@@ -355,25 +454,25 @@ Engine for L<range|/range>
 
 Same calling convention as L<range|/range>, but you must supply all
 parameters.  C<rangeb> is marginally faster as it makes a direct PP call,
-avoiding the perl argument-parsing step. 
+avoiding the perl argument-parsing step.
 
 =cut
 
 =head2 range
 
-=for ref 
+=for ref
 
 Extract selected chunks from a source piddle, with boundary conditions
 
 =for example
 
-	$out = $source->range($index,[$size,[$boundary]])
+        $out = $source->range($index,[$size,[$boundary]])
 
-Returns elements or rectangular slices of the original piddle, indexed by 
-the C<$index> piddle.  C<$source> is an N-dimensional piddle, and C<$index> is 
-a piddle whose first dimension has size up to N.  Each row of C<$index> is 
-treated as coordinates of a single value or chunk from C<$source>, specifying 
-the location(s) to extract.  
+Returns elements or rectangular slices of the original piddle, indexed by
+the C<$index> piddle.  C<$source> is an N-dimensional piddle, and C<$index> is
+a piddle whose first dimension has size up to N.  Each row of C<$index> is
+treated as coordinates of a single value or chunk from C<$source>, specifying
+the location(s) to extract.
 
 If you specify a single index location, then range is essentially an expensive
 slice, with controllable boundary conditions.
@@ -385,27 +484,27 @@ feed to L<zeroes|PDL::Core/zeroes> and its ilk.  If C<$index>'s 0th dimension
 has size higher than the number of dimensions in C<$source>, then
 C<$source> is treated as though it had trivial dummy dimensions of
 size 1, up to the required size to be indexed by C<$index> -- so if
-your source array is 1-D and your index array is a list of 3-vectors, 
+your source array is 1-D and your index array is a list of 3-vectors,
 you get two dummy dimensions of size 1 on the end of your source array.
 
 You can extract single elements or N-D rectangular ranges from C<$source>,
 by setting C<$size>.  If C<$size> is undef or zero, then you get a single
-sample for each row of C<$index>.  This behavior is similar to 
+sample for each row of C<$index>.  This behavior is similar to
 L<indexNDb|/indexNDb>, which is in fact implemented as a call to L<range|/range>.
 
-If C<$size> is positive then you get a range of values from C<$source> at 
+If C<$size> is positive then you get a range of values from C<$source> at
 each location, and the output has extra dimensions allocated for them.
-C<$size> can be a scalar, in which case it applies to all dimensions, or an 
-N-vector, in which case each element is applied independently to the 
+C<$size> can be a scalar, in which case it applies to all dimensions, or an
+N-vector, in which case each element is applied independently to the
 corresponding dimension in C<$source>.  See below for details.
 
-C<$boundary> is a number, string, or list ref indicating the type of 
+C<$boundary> is a number, string, or list ref indicating the type of
 boundary conditions to use when ranges reach the edge of C<$source>.  If you
 specify no boundary conditions the default is to forbid boundary violations
-on all axes.  If you specify exactly one boundary condition, it applies to 
+on all axes.  If you specify exactly one boundary condition, it applies to
 all axes.  If you specify more (as elements of a list ref, or as a packed
 string, see below), then they apply to dimensions in the order in which they
-appear, and the last one applies to all subsequent dimensions.  (This is 
+appear, and the last one applies to all subsequent dimensions.  (This is
 less difficult than it sounds; see the examples below).
 
 =over 3
@@ -428,15 +527,15 @@ execution continues.
 
 =item 2 (synonyms: 'e','x','extend')
 
-Values that would be outside the original piddle point instead to the 
-nearest allowed value within the piddle.  See the CAVEAT below on 
+Values that would be outside the original piddle point instead to the
+nearest allowed value within the piddle.  See the CAVEAT below on
 mappings that are not single valued.
 
 =item 3 (synonyms: 'p','periodic')
 
 Periodic boundary conditions apply: the numbers in $index are applied,
 strict-modulo the corresponding dimensions of $source.  This is equivalent to
-duplicating the $source piddle throughout N-D space.  See the CAVEAT below 
+duplicating the $source piddle throughout N-D space.  See the CAVEAT below
 about mappings that are not single valued.
 
 =item 4 (synonyms: 'm','mirror')
@@ -446,12 +545,12 @@ below about mappings that are not single valued.
 
 =back
 
-The boundary condition identifiers all begin with unique characters, so 
-you can feed in multiple boundary conditions as either a list ref or a 
-packed string.  (The packed string is marginally faster to run).  For 
-example, the four expressions [0,1], ['forbid','truncate'], ['f','t'], 
-and 'ft' all specify that violating the boundary in the 0th dimension 
-throws an error, and all other dimensions get truncated.  
+The boundary condition identifiers all begin with unique characters, so
+you can feed in multiple boundary conditions as either a list ref or a
+packed string.  (The packed string is marginally faster to run).  For
+example, the four expressions [0,1], ['forbid','truncate'], ['f','t'],
+and 'ft' all specify that violating the boundary in the 0th dimension
+throws an error, and all other dimensions get truncated.
 
 If you feed in a single string, it is interpreted as a packed boundary
 array if all of its characters are valid boundary specifiers (e.g. 'pet'),
@@ -459,7 +558,7 @@ but as a single word-style specifier if they are not (e.g. 'forbid').
 
 B<OUTPUT>
 
-The output threads over both C<$index> and C<$source>.  Because implicit 
+The output threads over both C<$index> and C<$source>.  Because implicit
 threading can happen in a couple of ways, a little thought is needed.  The
 returned dimension list is stacked up like this:
 
@@ -476,7 +575,7 @@ the dimension list here, so that if you feed in (for example) C<$size
 = [2,0,1]> you get an index dim list of C<(2,1)>.
 
 The last few dims of the output correspond to extra dims of C<$source> beyond
-the number of dims indexed by C<$index>.  These dims act like ordinary 
+the number of dims indexed by C<$index>.  These dims act like ordinary
 thread dims, because adding more dims to C<$source> just tacks extra dims
 on the end of the output.  Each source thread dim ranges over the entire
 corresponding dim of C<$source>.
@@ -484,7 +583,7 @@ corresponding dim of C<$source>.
 B<Dataflow>: Dataflow is bidirectional.
 
 B<Examples>:
-Here are basic examples of C<range> operation, showing how to get 
+Here are basic examples of C<range> operation, showing how to get
 ranges out of a small matrix.  The first few examples show extraction
 and selection of individual chunks.  The last example shows
 how to mark loci in the original matrix (using dataflow).
@@ -529,7 +628,7 @@ how to mark loci in the original matrix (using dataflow).
   ]
  ]
  pdl> $src = xvals(5,3)*10+yvals(5,3)
- pdl> print $src->range(3,1)  # Thread over y dimension in $src 
+ pdl> print $src->range(3,1)  # Thread over y dimension in $src
  [
   [30]
   [31]
@@ -556,14 +655,14 @@ others it's not. In particular, this doesn't work:
     pdl> histogram = zeroes(10,10)
     pdl> histogram->range($photon_list,1)++;  #not what you wanted
 
-The reason is that if two photons land in the same bin, then that bin 
+The reason is that if two photons land in the same bin, then that bin
 doesn't get incremented twice.  (That may get fixed in a later version...)
 
 B<PERMISSIVE RANGING>: If C<$index> has too many dimensions compared
 to C<$source>, then $source is treated as though it had dummy
 dimensions of size 1, up to the required number of dimensions.  These
 virtual dummy dimensions have the usual boundary conditions applied to
-them.  
+them.
 
 If the 0 dimension of C<$index> is ludicrously large (if its size is
 more than 5 greater than the number of dims in the source PDL) then
@@ -581,7 +680,7 @@ B<EFFICIENCY>: Because C<range> isn't an affine transformation (it
 involves lookup into a list of N-D indices), it is somewhat
 memory-inefficient for long lists of ranges, and keeping dataflow open
 is much slower than for affine transformations (which don't have to copy
-data around).  
+data around).
 
 Doing operations on small subfields of a large range is inefficient
 because the engine must flow the entire range back into the original
@@ -593,8 +692,8 @@ labels each region in a range sequentially, using many small
 operations rather than a single xvals assignment:
 
   ### How to make a collection of small ops run fast with range...
-  $a =  $data->range($index, $sizes, $bound)->sever; 
-  $aa = $data->range($index, $sizes, $bound);        
+  $a =  $data->range($index, $sizes, $bound)->sever;
+  $aa = $data->range($index, $sizes, $bound);
   map { $a($_ - 1) .= $_; } (1..$a->nelem);    # Lots of little ops
   $aa .= $a;
 
@@ -604,53 +703,47 @@ C<rangeb> is marginally faster but requires that you include all arguments.
 DEVEL NOTES
 
 * index thread dimensions are effectively clumped internally.  This
-makes it easier to loop over the index array but a little more brain-bending 
+makes it easier to loop over the index array but a little more brain-bending
 to tease out the algorithm.
 
-* Currently the index threads really do run fastest in memory; this is 
-probably the wrong direction to thread, for fastest behavior -- modifying 
-the appropriate dimincs in RedoDims ought to take care of it.
-
-=cut 
+=cut
 
 EOD
-	HandleBad => 1,
-	DefaultFlow => 1,
-	Reversible => 1,
-	P2Child => 1,
+        HandleBad => 1,
+        DefaultFlow => 1,
+        Reversible => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	OtherPars => 'SV *index; SV *size; SV *boundary',
-
 
 #
 # rdim: dimensionality of each range (0 dim of index PDL)
 #
 # ntsize: number of nonzero size dimensions
 # sizes:  array of range sizes, indexed (0..rdim-1).  A zero element means
-#	  that the dimension is omitted from the child dim list.
+#         that the dimension is omitted from the child dim list.
 # corners: parent coordinates of each corner, running fastest over coord index.
-#	(indexed 0 .. (nitems-1)*(rdim)+rdim-1)
+#       (indexed 0 .. (nitems-1)*(rdim)+rdim-1)
 # nitems: total number of list elements   (product of itdims)
 # itdim:  number of index thread dimensions
 # itdims: Size of each index thread dimension, indexed (0..itdim-1)
-# 
+#
 # bsize: Number of independently specified boundary conditions
 # nsizes: Number of independently specified range dim sizes
 # boundary: Array containing all the boundary condition specs
 # indord: Order/size of the indexing dim (0th dim of $index)
 
-	Comp => 'PDL_Long rdim; 
-                 PDL_Long nitems;
-                 PDL_Long itdim;
-                 PDL_Long ntsize;
-                 PDL_Long bsize;
-		 PDL_Long nsizes;
-		 PDL_Long sizes[$COMP(rdim)];
-		 PDL_Long itdims[$COMP(itdim)];
-		 PDL_Long corners[$COMP(rdim) * $COMP(nitems)];
-	         char boundary[$COMP(rdim)];
-		 ',
-	MakeComp => <<'EOD-MakeComp',
+        Comp => 'PDL_Indx rdim;
+                 PDL_Indx nitems;
+                 PDL_Indx itdim;
+                 PDL_Indx ntsize;
+                 PDL_Indx bsize;
+                 PDL_Indx nsizes;
+                 PDL_Indx sizes[$COMP(rdim)];
+                 PDL_Indx itdims[$COMP(itdim)];
+                 PDL_Indx corners[$COMP(rdim) * $COMP(nitems)];
+                 char boundary[$COMP(rdim)];
+                 ',
+        MakeComp => <<'EOD-MakeComp',
 pdl *ind_pdl;
 pdl *size_pdl;
 
@@ -663,23 +756,25 @@ if ((index==NULL) || (index == &PL_sv_undef))
 
 if(!(ind_pdl = PDL->SvPDLV(index))) /* assignment */
    { $CROAK("rangeb: unable to convert index variable to a PDL"); }
-  
+
 PDL->make_physdims(ind_pdl);
 
-if(ind_pdl->dims[0] == 0) 
+/* Generalized empties are ok, but not in the special 0 dim (the index vector) */
+if(ind_pdl->dims[0] == 0)
     { $CROAK("rangeb: can't handle Empty indices -- call range instead"); }
 
 /***
- * Ensure that the index is a long.  If there's no loss of information,
+ * Ensure that the index is a PDL_Indx.  If there's no loss of information,
  * just upgrade it -- otherwise, make a temporary copy.
  */
 switch(ind_pdl->datatype) {
  default:                              /* Most types: */
    ind_pdl = PDL->hard_copy(ind_pdl);  /*   copy and fall through */
- case PDL_B: case PDL_S: case PDL_US:  
-   PDL->converttype(&ind_pdl,PDL_L,1); /* convert in place. */
+ case PDL_B: case PDL_S: case PDL_US: case PDL_L: case PDL_LL:
+   PDL->converttype(&ind_pdl,PDL_IND,1); /* convert in place. */
    break;
- case PDL_L:                           
+ case PDL_IND:
+   /* do nothing */
    break;
 }
 
@@ -687,7 +782,7 @@ switch(ind_pdl->datatype) {
  * Figure sizes of the COMP arrrays and allocate them.
  */
 {
-  PDL_Long i,nitems;
+  PDL_Indx i,nitems;
 
   $COMP(rdim) = ind_pdl->ndims ? ind_pdl->dims[0] : 1;
   for(i=nitems=1; i < ind_pdl->ndims; i++)  /* Accumulate item list size */
@@ -704,119 +799,119 @@ switch(ind_pdl->datatype) {
   char *bstr;
   STRLEN blen;
   bstr = SvPV(boundary,blen);
-  
+
   if(blen == 0) {
     /* If no boundary is specified then every dim gets forbidden */
     int i;
-    for (i=0;i<$COMP(rdim);i++) 
+    for (i=0;i<$COMP(rdim);i++)
       $COMP(boundary[i]) = 0;
   } else {
     int i;
     for(i=0;i<$COMP(rdim);i++) {
       switch(bstr[i < blen ? i : blen-1 ]) {
       case '0': case 'f': case 'F':               /* forbid */
-	$COMP(boundary[i]) = 0;
-	break;
+        $COMP(boundary[i]) = 0;
+        break;
       case '1': case 't': case 'T':               /* truncate */
-	$COMP(boundary[i]) = 1;
-	break;
+        $COMP(boundary[i]) = 1;
+        break;
       case '2': case 'e': case 'E':               /* extend */
-	$COMP(boundary[i]) = 2;
-	break;
+        $COMP(boundary[i]) = 2;
+        break;
       case '3': case 'p': case 'P':               /* periodic */
-	$COMP(boundary[i]) = 3;
-	break;
+        $COMP(boundary[i]) = 3;
+        break;
       case '4': case 'm': case 'M':               /* mirror */
-	$COMP(boundary[i]) = 4;
-	break;
+        $COMP(boundary[i]) = 4;
+        break;
       default:
-	{
-	  /* No need to check if i < blen -- this will barf out the
-	   * first time it gets hit.  I didn't use $ CROAK 'coz that
-	   * macro doesn't let you pass in a string variable -- only a 
-	   * constant.
-	   */
-	  barf("Error in rangeb: Unknown boundary condition '%c' in range",bstr[i]);
-	}
-	break;
+        {
+          /* No need to check if i < blen -- this will barf out the
+           * first time it gets hit.  I didn't use $ CROAK 'coz that
+           * macro doesn't let you pass in a string variable -- only a
+           * constant.
+           */
+          barf("Error in rangeb: Unknown boundary condition '%c' in range",bstr[i]);
+        }
+        break;
       } // end of switch
     }
   }
-}  
+}
 /***
  * Store the sizes of the index-thread dims
  */
 {
-  PDL_Long i;
-  PDL_Long nd = ind_pdl->ndims - 1;
+  PDL_Indx i;
+  PDL_Indx nd = ind_pdl->ndims - 1;
   for(i=0; i < nd ; i++)
     $COMP(itdims[i]) = ind_pdl->dims[i+1];
 }
 
-/*** 
+/***
  * Check and condition the size piddle, and store sizes of the ranges
  */
 {
-  PDL_Long i,ntsize;
+  PDL_Indx i,ntsize;
 
   if( (size == NULL) || (size == &PL_sv_undef) ) {
-    // NO size was passed in (not normally executed even if you passed in no size to range(), 
+    // NO size was passed in (not normally executed even if you passed in no size to range(),
     // as range() generates a size array...
     for(i=0;i<$COMP(rdim);i++)
-	  $COMP(sizes[i]) = 0;
+          $COMP(sizes[i]) = 0;
 
   } else {
     /* Normal case with sizes present in a PDL */
-    
+
     if(!(size_pdl = PDL->SvPDLV(size))) /* assignment */
       $CROAK("Unable to convert size to a PDL in range");
 
     if(size_pdl->nvals == 0) {
       // no values in the size_pdl - Empty or Null.  Just copy 0s to all the range dims
       for(i=0;i<$COMP(rdim);i++)
-	$COMP(sizes[i]) = 0;
+        $COMP(sizes[i]) = 0;
 
     } else {
-      
-      // Convert size PDL to long
+
+      // Convert size PDL to PDL_IND to support indices
       switch(size_pdl->datatype) {
       default:                              /* Most types: */
-	size_pdl = PDL->hard_copy(size_pdl);  /*   copy and fall through */
-      case PDL_B: case PDL_S: case PDL_US:  
-	PDL->converttype(&size_pdl,PDL_L,1); /* convert in place. */
-	break;
-      case PDL_L:                           
-	break;
+        size_pdl = PDL->hard_copy(size_pdl);  /*   copy and fall through */
+      case PDL_B: case PDL_S: case PDL_US: case PDL_L:  case PDL_LL:
+        PDL->converttype(&size_pdl,PDL_IND,1); /* convert in place. */
+        break;
+      case PDL_IND:
+        break;
       }
-      
+
       $COMP(nsizes) = size_pdl->nvals; /* Store for later permissiveness check */
 
       /* Copy the sizes, or die if they're the wrong shape */
       if(size_pdl->nvals == 1) {
-	for(i=0;i<$COMP(rdim);i++) {
-	  $COMP(sizes[i]) = *((PDL_Long *)(size_pdl->data));
-	}
-	
-	/* Check for nonnegativity of sizes.  The rdim>0 mask ensures that */
-	/* we don't barf on the Empty PDL (as an index). */
-	if( $COMP(rdim) > 0 && $COMP(sizes[0]) < 0 ) {
-	  $CROAK("  Negative range size is not allowed in range\n");
+        for(i=0;i<$COMP(rdim);i++) {
+          $COMP(sizes[i]) = *((PDL_Indx *)(size_pdl->data));
+        }
+
+        /* Check for nonnegativity of sizes.  The rdim>0 mask ensures that */
+        /* we don't barf on the Empty PDL (as an index). */
+        if( $COMP(rdim) > 0 && $COMP(sizes[0]) < 0 ) {
+          $CROAK("  Negative range size is not allowed in range\n");
         }
       }
       else if( size_pdl->nvals <= $COMP(rdim) && size_pdl->ndims == 1) {
-	for(i=0;i<$COMP(rdim);i++) {
-	  $COMP(sizes[i]) = ( 	(i < size_pdl->nvals) ? 
-	                    	((PDL_Long *)(size_pdl->data))[i] :
-		                0
-			    );
-	  if($COMP(sizes[i]) < 0) 
-		$CROAK("  Negative range sizes are not allowed in range\n");
+        for(i=0;i<$COMP(rdim);i++) {
+          $COMP(sizes[i]) = (   (i < size_pdl->nvals) ?
+                                ((PDL_Indx *)(size_pdl->data))[i] :
+                                0
+                            );
+          if($COMP(sizes[i]) < 0)
+                $CROAK("  Negative range sizes are not allowed in range\n");
         }
       }
       else {
-	$CROAK(" Size must match index's 0th dim in range\n");
+        $CROAK(" Size must match index's 0th dim in range\n");
       }
-	
+
     } /* end of nonempty size-piddle code */
   } /* end of defined-size-piddle code */
 
@@ -832,28 +927,28 @@ switch(ind_pdl->datatype) {
  */
 
 {
-  PDL_Long i,j,k,ioff;
-  PDL_Long *cptr;
-  PDL_Long *iter = (PDL_Long *)(PDL->smalloc((STRLEN) (sizeof(PDL_Long) * ($COMP(itdim)))));
-  
+  PDL_Indx i,j,k,ioff;
+  PDL_Indx *cptr;
+  PDL_Indx *iter = (PDL_Indx *)(PDL->smalloc((STRLEN) (sizeof(PDL_Indx) * ($COMP(itdim)))));
+
   /* initialize iterator to loop over index threads */
   cptr = iter;
   for(k=0;k<$COMP(itdim);k++)
     *(cptr++) = 0;
-  
-  cptr = $COMP(corners);  
+
+  cptr = $COMP(corners);
   do {
     /* accumulate offset into the index from the iterator */
     for(k=ioff=0;k<$COMP(itdim);k++)
       ioff += iter[k] * ind_pdl->dimincs[k+1];
-    
-    /* Loop over the 0th dim of index, copying coords. */ 
+
+    /* Loop over the 0th dim of index, copying coords. */
     /* This is the natural place to check for permissive ranging; too */
     /* bad we don't have access to the parent piddle here... */
-	
-    for(j=0;j<$COMP(rdim);j++) 
-        *(cptr++) = ((PDL_Long *)(ind_pdl->data))[ioff + ind_pdl->dimincs[0] * j];
-    
+
+    for(j=0;j<$COMP(rdim);j++)
+        *(cptr++) = ((PDL_Indx *)(ind_pdl->data))[ioff + ind_pdl->dimincs[0] * j];
+
     /* Increment the iterator -- the test increments, the body carries. */
     for(k=0; k<$COMP(itdim) && (++(iter[k]))>=($COMP(itdims)[k]) ;k++)
       iter[k] = 0;
@@ -868,41 +963,43 @@ $SETREVERSIBLE(1);
 
 EOD-MakeComp
 
-	RedoDims => <<'EOD-RedoDims' ,
-{		      
-  PDL_Long stdim = $PARENT(ndims) - $COMP(rdim);
-  PDL_Long dim,inc;
-  PDL_Long i;
+        RedoDims => <<'EOD-RedoDims' ,
+{
+  PDL_Indx stdim = $PARENT(ndims) - $COMP(rdim);
+  PDL_Indx dim,inc;
+  PDL_Indx i,rdvalid;
 
     // Speed bump for ludicrous cases
     if( $COMP(rdim) > $PARENT(ndims)+5 && $COMP(nsizes) != $COMP(rdim)) {
       barf("Ludicrous number of extra dims in range index; leaving child null.\n    (%d implicit dims is > 5; index has %d dims; source has %d dim%s.)\n    This often means that your index PDL is incorrect.  To avoid this message,\n    allocate dummy dims in the source or use %d dims in range's size field.\n",$COMP(rdim)-$PARENT(ndims),$COMP(rdim),$PARENT(ndims),($PARENT(ndims))>1?"s":"",$COMP(rdim));
     }
-    
-    if(stdim < 0) 
+
+    if(stdim < 0)
       stdim = 0;
-    
+
     /* Set dimensionality of child */
     $CHILD(ndims) = $COMP(itdim) + $COMP(ntsize) + stdim;
     $SETNDIMS($COMP(itdim)+$COMP(ntsize)+stdim);
-    
-    /* Copy index thread dimensions to child */
+
     inc = 1;
-    for(dim=0; dim<$COMP(itdim); dim++) {
-      $CHILD(dimincs[dim]) = inc;
-      inc *= ($CHILD(dims[dim]) = $COMP(itdims[dim])); /* assignment */
-      
-    }
-    
     /* Copy size dimensions to child, crunching as we go. */
-    for(i=0;i<$COMP(rdim);i++) {
+    dim = $COMP(itdim);
+    for(i=rdvalid=0;i<$COMP(rdim);i++) {
       if($COMP(sizes[i])) {
-	$CHILD(dimincs[dim]) = inc;
-	inc *= ($CHILD(dims[dim++]) = $COMP(sizes[i])); /* assignment */
+        rdvalid++;
+        $CHILD(dimincs[dim]) = inc;
+        inc *= ($CHILD(dims[dim++]) = $COMP(sizes[i])); /* assignment */
       }
     }
-    
+
+    /* Copy index thread dimensions to child */
+    for(dim=0; dim<$COMP(itdim); dim++) {
+      $CHILD(dimincs[dim]) = inc;
+      inc *= ($CHILD(dims[dim]) = $COMP(itdims[dim])); /* assignment */
+    }
+
     /* Copy source thread dimensions to child */
+    dim = $COMP(itdim) + rdvalid;
     for(i=0;i<stdim;i++) {
       $CHILD(dimincs[dim]) = inc;
       inc *= ($CHILD(dims[dim++]) = $PARENT(dims[i+$COMP(rdim)])); /* assignment */
@@ -913,13 +1010,12 @@ EOD-MakeComp
     /* to reflect, extend, or mirror. */
     if($PARENT(dims[0])==0) {
       for(dim=0; dim<$COMP(rdim); dim++) {
-	if($COMP(boundary[dim])) 
-	  $COMP(boundary[dim]) = 1; // force truncation
+        if($COMP(boundary[dim]))
+          $COMP(boundary[dim]) = 1; // force truncation
       }
     }
 
 
-
   $CHILD(datatype) = $PARENT(datatype);
 
   $SETDIMS();
@@ -927,23 +1023,23 @@ EOD-MakeComp
 
 EOD-RedoDims
 
-	EquivCPOffsCode => <<'EOD-EquivCPOffsCode',
+        EquivCPOffsCode => <<'EOD-EquivCPOffsCode',
 {
-  PDL_Long *iter, *ip;  /* vector iterator */
-  PDL_Long *sizes, *sp; /* size vector including stdims */
-  PDL_Long *coords;     /* current coordinates */
-
-  PDL_Long k;           /* index */
-  PDL_Long item;        /* index thread iterator */
-  PDL_Long pdim = $PARENT_P(ndims);
-  PDL_Long rdim = $COMP(rdim);
-  PDL_Long prdim = (rdim < pdim) ? rdim : pdim;
-  PDL_Long stdim = pdim - prdim;
-
-  /* Allocate iterator and larger size vector -- do it all in one foop 
+  PDL_Indx *iter, *ip;  /* vector iterator */
+  PDL_Indx *sizes, *sp; /* size vector including stdims */
+  PDL_Indx *coords;     /* current coordinates */
+
+  PDL_Indx k;           /* index */
+  PDL_Indx item;        /* index thread iterator */
+  PDL_Indx pdim = $PARENT_P(ndims);
+  PDL_Indx rdim = $COMP(rdim);
+  PDL_Indx prdim = (rdim < pdim) ? rdim : pdim;
+  PDL_Indx stdim = pdim - prdim;
+
+  /* Allocate iterator and larger size vector -- do it all in one foop
    * to avoid extra calls to smalloc.
    */
-    if(!(iter = (PDL_Long *)(PDL->smalloc((STRLEN) (sizeof(PDL_Long) * ($PARENT_P(ndims) * 2 + rdim)))))) {
+    if(!(iter = (PDL_Indx *)(PDL->smalloc((STRLEN) (sizeof(PDL_Indx) * ($PARENT_P(ndims) * 2 + rdim)))))) {
     barf("couldn't get memory for range iterator");
   }
   sizes  = iter + $PARENT_P(ndims);
@@ -952,7 +1048,7 @@ EOD-RedoDims
   /* Figure out size vector */
   for(ip = $COMP(sizes), sp = sizes, k=0; k<rdim; k++)
      *(sp++) = *(ip++);
-  for(; k < $PARENT_P(ndims); k++) 
+  for(; k < $PARENT_P(ndims); k++)
      *(sp++) = $PARENT_P(dims[k]);
 
 
@@ -960,55 +1056,55 @@ EOD-RedoDims
   for(item=0; item<$COMP(nitems); item++) {
 
     /* initialize in-range iterator to loop within each range */
-    for(ip = iter, k=0; k<$PARENT_P(ndims); k++) 
+    for(ip = iter, k=0; k<$PARENT_P(ndims); k++)
       *(ip++) = 0;
-    
+
     do {
-      PDL_Long poff = 0;
-      PDL_Long coff;
-      PDL_Long k2;
+      PDL_Indx poff = 0;
+      PDL_Indx coff;
+      PDL_Indx k2;
       char trunc = 0;       /* Flag used to skip truncation case */
 
       /* Collect and boundary-check the current N-D coords */
       for(k=0; k < prdim; k++){
 
-	PDL_Long ck = iter[k] + $COMP(corners[ item * rdim + k  ]) ;
-
-     	/* normal case */
-    	  if(ck < 0 || ck >= $PARENT_P(dims[k])) {
- 	    switch($COMP(boundary[k])) {
- 	    case 0: /* no boundary breakage allowed */
- 	      barf("index out-of-bounds in range");
- 	      break;
- 	    case 1: /* truncation */
-	      trunc = 1;
- 	      break;
- 	    case 2: /* extension -- crop */
- 	      ck = (ck >= $PARENT_P(dims[k])) ? $PARENT_P(dims[k])-1 : 0;
- 	      break;
- 	    case 3: /* periodic -- mod it */
- 	      ck %= $PARENT_P(dims[k]);
- 	      if(ck < 0)   /* Fix mod breakage in C */
- 	        ck += $PARENT_P(dims[k]);
- 	      break;
-	    case 4: /* mirror -- reflect off the edges */
-	      ck += $PARENT_P(dims[k]);
-	      ck %= ($PARENT_P(dims[k]) * 2);
-	      if(ck < 0) /* Fix mod breakage in C */
-		ck += $PARENT_P(dims[k])*2;
-	      ck -= $PARENT_P(dims[k]);
-	      if(ck < 0) {
-		ck *= -1;
-	        ck -= 1;
-	      }
-	      break;
- 	    default:
- 	      barf("Unknown boundary condition in range -- bug alert!");
- 	      break;
- 	    }
- 	  }
-
-	coords[k] = ck;
+        PDL_Indx ck = iter[k] + $COMP(corners[ item * rdim + k  ]) ;
+
+        /* normal case */
+          if(ck < 0 || ck >= $PARENT_P(dims[k])) {
+            switch($COMP(boundary[k])) {
+            case 0: /* no boundary breakage allowed */
+              barf("index out-of-bounds in range");
+              break;
+            case 1: /* truncation */
+              trunc = 1;
+              break;
+            case 2: /* extension -- crop */
+              ck = (ck >= $PARENT_P(dims[k])) ? $PARENT_P(dims[k])-1 : 0;
+              break;
+            case 3: /* periodic -- mod it */
+              ck %= $PARENT_P(dims[k]);
+              if(ck < 0)   /* Fix mod breakage in C */
+                ck += $PARENT_P(dims[k]);
+              break;
+            case 4: /* mirror -- reflect off the edges */
+              ck += $PARENT_P(dims[k]);
+              ck %= ($PARENT_P(dims[k]) * 2);
+              if(ck < 0) /* Fix mod breakage in C */
+                ck += $PARENT_P(dims[k])*2;
+              ck -= $PARENT_P(dims[k]);
+              if(ck < 0) {
+                ck *= -1;
+                ck -= 1;
+              }
+              break;
+            default:
+              barf("Unknown boundary condition in range -- bug alert!");
+              break;
+            }
+          }
+
+        coords[k] = ck;
 
       }
 
@@ -1016,26 +1112,26 @@ EOD-RedoDims
       for( ; k < rdim ; k++) {
         /* Check for indexing off the end of the dimension list */
 
-	PDL_Long ck = iter[k] + $COMP(corners[ item * rdim + k  ]) ;
+        PDL_Indx ck = iter[k] + $COMP(corners[ item * rdim + k  ]) ;
 
-  	switch($COMP(boundary[k])) {
-	    case 0: /* No boundary breakage allowed -- nonzero corners cause barfage */
-	      if(ck != 0)
-		 barf("Too many dims in range index (and you've forbidden boundary violations)");
+        switch($COMP(boundary[k])) {
+            case 0: /* No boundary breakage allowed -- nonzero corners cause barfage */
+              if(ck != 0)
+                 barf("Too many dims in range index (and you've forbidden boundary violations)");
               break;
             case 1: /* truncation - just truncate if the corner is nonzero */
-	      trunc |= (ck != 0);
-	      break;
-	    case 2: /* extension -- ignore the corner (same as 3) */
-	    case 3: /* periodic  -- ignore the corner */
+              trunc |= (ck != 0);
+              break;
+            case 2: /* extension -- ignore the corner (same as 3) */
+            case 3: /* periodic  -- ignore the corner */
             case 4: /* mirror -- ignore the corner */
               ck = 0;
               break;
-	    default:
-	      barf("Unknown boudnary condition in range -- bug alert!");
-	      /* Note clever misspelling of boundary to distinguish from other case */
-	      break;
-	  }
+            default:
+              barf("Unknown boudnary condition in range -- bug alert!");
+              /* Note clever misspelling of boundary to distinguish from other case */
+              break;
+          }
       }
 
       /* Find offsets into the child and parent arrays, from the N-D coords */
@@ -1043,45 +1139,45 @@ EOD-RedoDims
       /* because the offset is trivial and/or we're truncating for virtual */
       /* dims caused by permissive ranging. */
       coff = $CHILD_P(dimincs[0]) * item;
-      for(k2 = $COMP(itdim), poff = k = 0; 
-	  k < prdim;
-	  k++) { 
-	poff += coords[k]*$PARENT_P(dimincs[k]);
-	if($COMP(sizes[k])) 
-	  coff += iter[k] * $CHILD_P(dimincs[k2++]);
+      for(k2 = $COMP(itdim), poff = k = 0;
+          k < prdim;
+          k++) {
+        poff += coords[k]*$PARENT_P(dimincs[k]);
+        if($COMP(sizes[k]))
+          coff += iter[k] * $CHILD_P(dimincs[k2++]);
       }
 
       /* Loop the copy over all the source thread dims (above rdim). */
       do {
-	PDL_Long poff1 = poff;
-	PDL_Long coff1 = coff;
-	
-	/* Accumulate the offset due to source threading */
-	for(k2 = $COMP(itdim) + $COMP(ntsize), k = rdim; 
-	    k < pdim;
-	    k++) {
-	  poff1 += iter[k] * $PARENT_P(dimincs[k]);
-	  coff1 += iter[k] * $CHILD_P(dimincs[k2++]);
-	}
-
-	/* Finally -- make the copy 
-	 * EQUIVCPTRUNC works like EQUIVCPOFFS but with checking for 
-	 * out-of-bounds conditions.  
-	 */
-	$EQUIVCPTRUNC(coff1,poff1,trunc);		
-	
-	/* Increment the source thread iterator */
-	for( k=$COMP(rdim); 
-	     k < $PARENT_P(ndims) && (++(iter[k]) >= $PARENT_P(dims[k])); 
-	     k++)
-	  iter[k] = 0;
+        PDL_Indx poff1 = poff;
+        PDL_Indx coff1 = coff;
+
+        /* Accumulate the offset due to source threading */
+        for(k2 = $COMP(itdim) + $COMP(ntsize), k = rdim;
+            k < pdim;
+            k++) {
+          poff1 += iter[k] * $PARENT_P(dimincs[k]);
+          coff1 += iter[k] * $CHILD_P(dimincs[k2++]);
+        }
+
+        /* Finally -- make the copy
+         * EQUIVCPTRUNC works like EQUIVCPOFFS but with checking for
+         * out-of-bounds conditions.
+         */
+        $EQUIVCPTRUNC(coff1,poff1,trunc);
+
+        /* Increment the source thread iterator */
+        for( k=$COMP(rdim);
+             k < $PARENT_P(ndims) && (++(iter[k]) >= $PARENT_P(dims[k]));
+             k++)
+          iter[k] = 0;
       } while(k < $PARENT_P(ndims)); /* end of source-thread iteration */
 
       /* Increment the in-range iterator */
       for(k = 0;
-	  k < $COMP(rdim) && (++(iter[k]) >= $COMP(sizes[k]));
-	  k++)
-	iter[k] = 0;
+          k < $COMP(rdim) && (++(iter[k]) >= $COMP(sizes[k]));
+          k++)
+        iter[k] = 0;
     } while(k < $COMP(rdim)); /* end of main iteration */
   } /* end of item do loop */
 
@@ -1096,9 +1192,9 @@ EOD-EquivCPOffsCode
 =cut
 
 pp_def(
-	'rld',
-	Pars=>'int a(n); b(n); [o]c(m);',
-	PMCode =><<'EOD',
+        'rld',
+        Pars=>'indx a(n); b(n); [o]c(m);',
+        PMCode =><<'EOD',
 sub PDL::rld {
   my ($a,$b) = @_;
   my ($c);
@@ -1115,18 +1211,18 @@ sub PDL::rld {
   $c;
 }
 EOD
-	Code=>'
-	  int i,j=0,an;
-	  $GENERIC(b) bv;
-	  loop (n) %{
-	    an = $a();
-	    bv = $b();
-	    for (i=0;i<an;i++) {
-	      $c(m=>j) = bv;
-	      j++;
-	    }
-	  %}',
-	Doc => <<'EOD'
+        Code=>'
+          PDL_Indx i,j=0,an;
+          $GENERIC(b) bv;
+          loop (n) %{
+            an = $a();
+            bv = $b();
+            for (i=0;i<an;i++) {
+              $c(m=>j) = bv;
+              j++;
+            }
+          %}',
+        Doc => <<'EOD'
 =for ref
 
 Run-length decode a vector
@@ -1147,30 +1243,30 @@ EOD
 =cut
 
 pp_def(
-	'rle',
-	Pars=>'c(n); int [o]a(n); [o]b(n);',
-	Code=>'
-	  int j=0,sn=$SIZE(n);
-	  $GENERIC(c) cv, clv;
-	  clv = $c(n=>0);
-	  $b(n=>0) = clv;
-	  $a(n=>0) = 0;
-	  loop (n) %{
-	    cv = $c();
-	    if (cv == clv) {
-	      $a(n=>j)++;
-	    } else {
-	      j++;
-	      $b(n=>j) = clv = cv;
-	      $a(n=>j) = 1;
-	    }
-	  %}
-	  for (j++;j<sn;j++) {
-	    $a(n=>j) = 0;
-	    $b(n=>j) = 0;
-	  }
-	',
-	Doc => <<'EOD'
+        'rle',
+        Pars=>'c(n); indx [o]a(n); [o]b(n);',
+        Code=>'
+          PDL_Indx j=0,sn=$SIZE(n);
+          $GENERIC(c) cv, clv;
+          clv = $c(n=>0);
+          $b(n=>0) = clv;
+          $a(n=>0) = 0;
+          loop (n) %{
+            cv = $c();
+            if (cv == clv) {
+              $a(n=>j)++;
+            } else {
+              j++;
+              $b(n=>j) = clv = cv;
+              $a(n=>j) = 1;
+            }
+          %}
+          for (j++;j<sn;j++) {
+            $a(n=>j) = 0;
+            $b(n=>j) = 0;
+          }
+        ',
+        Doc => <<'EOD'
 =for ref
 
 Run-length encode a vector
@@ -1196,23 +1292,23 @@ EOD
 pp_def('flowconvert',
        HandleBad => 1,
        DefaultFlow => 1,
-       Reversible => 1,	
+       Reversible => 1,
        Pars => 'PARENT(); [oca]CHILD()',
        OtherPars => 'int totype;',
        Reversible => 1,
        # Forced types
        FTypes => {CHILD => '$COMP(totype)'},
-       Code => 
+       Code =>
        '$CHILD() = $PARENT();',
-       BadCode => 
-       'if ( $ISBAD(PARENT()) ) { 
+       BadCode =>
+       'if ( $ISBAD(PARENT()) ) {
            $SETBAD(CHILD());
         } else {
            $CHILD() = $PARENT();
         }',
        BackCode => '$PARENT() = $CHILD();',
-       BadBackCode => 
-       'if ( $ISBAD(CHILD()) ) { 
+       BadBackCode =>
+       'if ( $ISBAD(CHILD()) ) {
            $SETBAD(PARENT());
         } else {
            $PARENT() = $CHILD();
@@ -1222,18 +1318,18 @@ pp_def('flowconvert',
 
 
 pp_def(
-	'converttypei',
+        'converttypei',
         HandleBad => 1,
-	DefaultFlow => 1,
-	GlobalNew => 'converttypei_new',
-	OtherPars => 'int totype;',
-	P2Child => 1,
+        DefaultFlow => 1,
+        GlobalNew => 'converttypei_new',
+        OtherPars => 'int totype;',
+        P2Child => 1,
         NoPdlThread => 1,
-	Identity => 1,
-	Reversible => 1,
+        Identity => 1,
+        Reversible => 1,
 # Forced types
-	FTypes => {CHILD => '$COMP(totype)'},
-	Doc => 'internal',
+        FTypes => {CHILD => '$COMP(totype)'},
+        Doc => 'internal',
 );
 
 
@@ -1242,43 +1338,43 @@ pp_def(
 if(0) {
 # Special-case
 pp_def(
-	'clump',
-	DefaultFlow => 1,
-	OtherPars => 'int n',
-	P2Child => 1,
-	Priv => 'int nnew; int nrem;',
-	RedoDims => 'int i; int d1;
-		if($COMP(n) > $PARENT(ndims)) 
-			/* Now with more flavor: truncate overly long clumps to 
-			   just clump existing dimensions...  (CED 17-Mar-2002) */
-
-			$COMP(n) = $PARENT(ndims);
-
-			/* Old croaking code: */
-			/*$CROAK("Too many dimensions %d to clump from %d", */
-			/*		$COMP(n),$PARENT(ndims)); */
-
-		 $COMP(nrem) = ($COMP(n)==-1 ? $PARENT(threadids[0]) : $COMP(n));
-		 $PRIV(nnew) = $PARENT(ndims) - $COMP(nrem) + 1;
-		 $SETNDIMS($PRIV(nnew));
-		 d1=1;
-		 for(i=0; i<$PRIV(nrem); i++) {
-		 	d1 *= $PARENT(dims[i]);
-		 }
-		 $CHILD(dims[0]) = d1;
-		 for(; i<$PARENT(ndims); i++) {
-		 	$CHILD(dims[i-$PRIV(nrem)+1]) = $PARENT(dims[i]);
-		 }
-		 $SETDIMS();
-		 $SETDELTATHREADIDS(1-$COMP(nrem));
-		 ',
-	EquivCPOffsCode => '
-		int i;
-		for(i=0; i<$CHILD_P(nvals); i++) {
-			$EQUIVCPOFFS(i,i);
-		}
-		',
-	Reversible => 1,
+        'clump',
+        DefaultFlow => 1,
+        OtherPars => 'int n',
+        P2Child => 1,
+        Priv => 'int nnew; int nrem;',
+        RedoDims => 'int i; PDL_Indx d1;
+                if($COMP(n) > $PARENT(ndims))
+                        /* Now with more flavor: truncate overly long clumps to
+                           just clump existing dimensions...  (CED 17-Mar-2002) */
+
+                        $COMP(n) = $PARENT(ndims);
+
+                        /* Old croaking code: */
+                        /*$CROAK("Too many dimensions %d to clump from %d", */
+                        /*              $COMP(n),$PARENT(ndims)); */
+
+                 $COMP(nrem) = ($COMP(n)==-1 ? $PARENT(threadids[0]) : $COMP(n));
+                 $PRIV(nnew) = $PARENT(ndims) - $COMP(nrem) + 1;
+                 $SETNDIMS($PRIV(nnew));
+                 d1=1;
+                 for(i=0; i<$PRIV(nrem); i++) {
+                        d1 *= $PARENT(dims[i]);
+                 }
+                 $CHILD(dims[0]) = d1;
+                 for(; i<$PARENT(ndims); i++) {
+                        $CHILD(dims[i-$PRIV(nrem)+1]) = $PARENT(dims[i]);
+                 }
+                 $SETDIMS();
+                 $SETDELTATHREADIDS(1-$COMP(nrem));
+                 ',
+        EquivCPOffsCode => '
+                PDL_Indx i;
+                for(i=0; i<$CHILD_P(nvals); i++) {
+                        $EQUIVCPOFFS(i,i);
+                }
+                ',
+        Reversible => 1,
 );
 } else {
 
@@ -1287,53 +1383,53 @@ pp_def(
 # the perl wrapper clump is now defined in Core.pm
 # this is just the low level interface
 pp_def(
-	'_clump_int',
-	P2Child => 1,
+        '_clump_int',
+        P2Child => 1,
         NoPdlThread => 1,
-	DefaultFlow => 1,
-	Reversible => 1,
-	AffinePriv => 1,
-	OtherPars => 'int n',
-	RedoDims => 'int i; int d1;
-		int nrem; int nnew;
-		if($COMP(n) > $PARENT(ndims)) {
-			/* Now with more flavor:  truncate clumping in this case to 
-			 * the total number of dimensions that actually exist...
-			 *  --CED 17-Mar-2002
-			 */
- 			$COMP(n) = -1;
-			
+        DefaultFlow => 1,
+        Reversible => 1,
+        AffinePriv => 1,
+        OtherPars => 'int n',
+        RedoDims => 'int i; PDL_Indx d1;
+                int nrem; int nnew;
+                if($COMP(n) > $PARENT(ndims)) {
+                        /* Now with more flavor:  truncate clumping in this case to
+                         * the total number of dimensions that actually exist...
+                         *  --CED 17-Mar-2002
+                         */
+                        $COMP(n) = -1;
+
 #ifdef older_croaking_code
-			$SETNDIMS(0);  /* fix to make sure we do not get problems later */
-			$PRIV(offs) = 0;
-			$SETDIMS();
-			$CROAK("Too many dimensions %d to clump from %d",
-				$COMP(n),$PARENT(ndims));
+                        $SETNDIMS(0);  /* fix to make sure we do not get problems later */
+                        $PRIV(offs) = 0;
+                        $SETDIMS();
+                        $CROAK("Too many dimensions %d to clump from %d",
+                                $COMP(n),$PARENT(ndims));
 #endif
-		}
-		 nrem = ($COMP(n)< 0 ? $PARENT(threadids[0]) + 1 + ($COMP(n)) : $COMP(n));
-	         if(nrem < 0) {
-			$CROAK("Too many dimensions %d to leave behind when clumping from %d",-$COMP(n),$PARENT(ndims));
-		 }
-
-		 nnew = $PARENT(ndims) - nrem + 1;
-		 $SETNDIMS(nnew);
-		 $DOPRIVDIMS();
-		 $PRIV(offs) = 0;
-		 d1=1;
-		 for(i=0; i<nrem; i++) {
-		 	d1 *= $PARENT(dims[i]);
-		 }
-		 $CHILD(dims[0]) = d1;
-		 $PRIV(incs[0]) = 1;
-		 for(; i<$PARENT(ndims); i++) {
-		 	$CHILD(dims[i-nrem+1]) = $PARENT(dims[i]);
-			$PRIV(incs[i-nrem+1]) = $PARENT(dimincs[i]);
-		 }
-		 $SETDIMS();
-		 $SETDELTATHREADIDS(1-nrem);
-		 ',
-	Doc => 'internal',
+                }
+                 nrem = ($COMP(n)< 0 ? $PARENT(threadids[0]) + 1 + ($COMP(n)) : $COMP(n));
+                 if(nrem < 0) {
+                        $CROAK("Too many dimensions %d to leave behind when clumping from %d",-$COMP(n),$PARENT(ndims));
+                 }
+
+                 nnew = $PARENT(ndims) - nrem + 1;
+                 $SETNDIMS(nnew);
+                 $DOPRIVDIMS();
+                 $PRIV(offs) = 0;
+                 d1=1;
+                 for(i=0; i<nrem; i++) {
+                        d1 *= $PARENT(dims[i]);
+                 }
+                 $CHILD(dims[0]) = d1;
+                 $PRIV(incs[0]) = 1;
+                 for(; i<$PARENT(ndims); i++) {
+                        $CHILD(dims[i-nrem+1]) = $PARENT(dims[i]);
+                        $PRIV(incs[i-nrem+1]) = $PARENT(dimincs[i]);
+                 }
+                 $SETDIMS();
+                 $SETDELTATHREADIDS(1-nrem);
+                 ',
+        Doc => 'internal',
 );
 }
 
@@ -1342,25 +1438,25 @@ pp_def(
 =cut
 
 pp_def(
-	'xchg',
-	OtherPars => 'int n1; int n2;',
-	DefaultFlow => 1,
-	Reversible => 1,
-	P2Child => 1,
+        'xchg',
+        OtherPars => 'int n1; int n2;',
+        DefaultFlow => 1,
+        Reversible => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	XCHGOnly => 1,
-	EquivDimCheck => 'if ($COMP(n1) <0)
-				$COMP(n1) += $PARENT(threadids[0]);
-			  if ($COMP(n2) <0)
-				$COMP(n2) += $PARENT(threadids[0]);
-			  if ($COMP(n1) <0 ||$COMP(n2) <0 ||
-			     $COMP(n1) >= $PARENT(threadids[0]) ||
-			     $COMP(n2) >= $PARENT(threadids[0]))
-		barf("One of dims %d, %d out of range: should be 0<=dim<%d",
-			$COMP(n1),$COMP(n2),$PARENT(threadids[0]));',
-	EquivPDimExpr => '(($CDIM == $COMP(n1)) ? $COMP(n2) : ($CDIM == $COMP(n2)) ? $COMP(n1) : $CDIM)',
-	EquivCDimExpr => '(($PDIM == $COMP(n1)) ? $COMP(n2) : ($PDIM == $COMP(n2)) ? $COMP(n1) : $PDIM)',
-	Doc => <<'EOD',
+        XCHGOnly => 1,
+        EquivDimCheck => 'if ($COMP(n1) <0)
+                                $COMP(n1) += $PARENT(threadids[0]);
+                          if ($COMP(n2) <0)
+                                $COMP(n2) += $PARENT(threadids[0]);
+                          if ($COMP(n1) <0 ||$COMP(n2) <0 ||
+                             $COMP(n1) >= $PARENT(threadids[0]) ||
+                             $COMP(n2) >= $PARENT(threadids[0]))
+                barf("One of dims %d, %d out of range: should be 0<=dim<%d",
+                        $COMP(n1),$COMP(n2),$PARENT(threadids[0]));',
+        EquivPDimExpr => '(($CDIM == $COMP(n1)) ? $COMP(n2) : ($CDIM == $COMP(n2)) ? $COMP(n1) : $CDIM)',
+        EquivCDimExpr => '(($PDIM == $COMP(n1)) ? $COMP(n2) : ($PDIM == $COMP(n2)) ? $COMP(n1) : $PDIM)',
+        Doc => <<'EOD',
 =for ref
 
 exchange two dimensions
@@ -1399,10 +1495,10 @@ once.
 =for usage
 
  # Completely reverse the dimension order of a 6-Dim array.
- $reOrderedPDL = $pdl->reorder(5,4,3,2,1,0); 
+ $reOrderedPDL = $pdl->reorder(5,4,3,2,1,0);
 
 The argument to reorder is an array representing where the current dimensions
-should go in the new array. In the above usage, the argument to reorder 
+should go in the new array. In the above usage, the argument to reorder
 C<(5,4,3,2,1,0)>
 indicates that the old dimensions (C<$pdl>'s dims) should be re-arranged to make the
 new pdl (C<$reOrderPDL>) according to the following:
@@ -1411,10 +1507,10 @@ new pdl (C<$reOrderPDL>) according to the following:
    ------------   ------------
    5              0
    4              1
-   3 		  2
-   2		  3
-   1		  4
-   0		  5
+   3              2
+   2              3
+   1              4
+   0              5
 
 You do not need to specify all dimensions, only a complete set
 starting at position 0.  (Extra dimensions are left where they are).
@@ -1422,11 +1518,11 @@ This means, for example, that you can reorder() the X and Y dimensions of
 an image, and not care whether it is an RGB image with a third dimension running
 across color plane.
 
-=for example 
+=for example
 
 Example:
 
- pdl> $a = sequence(5,3,2);	  # Create a 3-d Array
+ pdl> $a = sequence(5,3,2);       # Create a 3-d Array
  pdl> p $a
  [
   [
@@ -1478,30 +1574,30 @@ result PDL will change the parent.
 =cut
 
 sub PDL::reorder {
-	my ($pdl,@newDimOrder) = @_;
-	
-	my $arrayMax = $#newDimOrder;
-  
-	#Error Checking:
-	if( $pdl->getndims < scalar(@newDimOrder) ){
-		my $errString = "PDL::reorder: Number of elements (".scalar(@newDimOrder).") in newDimOrder array exceeds\n";
-		$errString .= "the number of dims in the supplied PDL (".$pdl->getndims.")";
-		barf($errString);
-	}
-	
-	# Check to make sure all the dims are within bounds
-	for my $i(0..$#newDimOrder) {
-	  my $dim = $newDimOrder[$i];
-	  if($dim < 0 || $dim > $#newDimOrder) {
-	      my $errString = "PDL::reorder: Dim index $newDimOrder[$i] out of range in position $i\n(range is 0-$#newDimOrder)";
-	      barf($errString);
-	  }
-	}
-
-	# Checking that they are all present and also not duplicated is done by thread() [I think]
-
-	# a quicker way to do the reorder
-	return $pdl->thread(@newDimOrder)->unthread(0);
+        my ($pdl,@newDimOrder) = @_;
+
+        my $arrayMax = $#newDimOrder;
+
+        #Error Checking:
+        if( $pdl->getndims < scalar(@newDimOrder) ){
+                my $errString = "PDL::reorder: Number of elements (".scalar(@newDimOrder).") in newDimOrder array exceeds\n";
+                $errString .= "the number of dims in the supplied PDL (".$pdl->getndims.")";
+                barf($errString);
+        }
+
+        # Check to make sure all the dims are within bounds
+        for my $i(0..$#newDimOrder) {
+          my $dim = $newDimOrder[$i];
+          if($dim < 0 || $dim > $#newDimOrder) {
+              my $errString = "PDL::reorder: Dim index $newDimOrder[$i] out of range in position $i\n(range is 0-$#newDimOrder)";
+              barf($errString);
+          }
+        }
+
+        # Checking that they are all present and also not duplicated is done by thread() [I think]
+
+        # a quicker way to do the reorder
+        return $pdl->thread(@newDimOrder)->unthread(0);
 }
 
 EOD
@@ -1510,37 +1606,37 @@ EOD
 =cut
 
 pp_def(
-	'mv',
-	OtherPars => 'int n1; int n2;',
-	DefaultFlow => 1,
-	Reversible => 1,
-	P2Child => 1,
+        'mv',
+        OtherPars => 'int n1; int n2;',
+        DefaultFlow => 1,
+        Reversible => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	XCHGOnly => 1,
-	EquivDimCheck => 'if ($COMP(n1) <0)
-				$COMP(n1) += $PARENT(threadids[0]);
-			  if ($COMP(n2) <0)
-				$COMP(n2) += $PARENT(threadids[0]);
-			  if ($COMP(n1) <0 ||$COMP(n2) <0 ||
-			     $COMP(n1) >= $PARENT(threadids[0]) ||
-			     $COMP(n2) >= $PARENT(threadids[0]))
-		barf("One of dims %d, %d out of range: should be 0<=dim<%d",
-			$COMP(n1),$COMP(n2),$PARENT(threadids[0]));',
-	EquivPDimExpr => '(($COMP(n1) < $COMP(n2)) ?
-	(($CDIM < $COMP(n1) || $CDIM > $COMP(n2)) ?
-		$CDIM : (($CDIM == $COMP(n2)) ? $COMP(n1) : $CDIM+1))
-	: (($COMP(n2) < $COMP(n1)) ?
-		(($CDIM > $COMP(n1) || $CDIM < $COMP(n2)) ?
-			$CDIM : (($CDIM == $COMP(n2)) ? $COMP(n1) : $CDIM-1))
-		: $CDIM))',
-	EquivCDimExpr => '(($COMP(n2) < $COMP(n1)) ?
-	(($PDIM < $COMP(n2) || $PDIM > $COMP(n1)) ?
-		$PDIM : (($PDIM == $COMP(n1)) ? $COMP(n2) : $PDIM+1))
-	: (($COMP(n1) < $COMP(n2)) ?
-		(($PDIM > $COMP(n2) || $PDIM < $COMP(n1)) ?
-			$PDIM : (($PDIM == $COMP(n1)) ? $COMP(n2) : $PDIM-1))
-		: $PDIM))',
-	Doc => << 'EOD',
+        XCHGOnly => 1,
+        EquivDimCheck => 'if ($COMP(n1) <0)
+                                $COMP(n1) += $PARENT(threadids[0]);
+                          if ($COMP(n2) <0)
+                                $COMP(n2) += $PARENT(threadids[0]);
+                          if ($COMP(n1) <0 ||$COMP(n2) <0 ||
+                             $COMP(n1) >= $PARENT(threadids[0]) ||
+                             $COMP(n2) >= $PARENT(threadids[0]))
+                barf("One of dims %d, %d out of range: should be 0<=dim<%d",
+                        $COMP(n1),$COMP(n2),$PARENT(threadids[0]));',
+        EquivPDimExpr => '(($COMP(n1) < $COMP(n2)) ?
+        (($CDIM < $COMP(n1) || $CDIM > $COMP(n2)) ?
+                $CDIM : (($CDIM == $COMP(n2)) ? $COMP(n1) : $CDIM+1))
+        : (($COMP(n2) < $COMP(n1)) ?
+                (($CDIM > $COMP(n1) || $CDIM < $COMP(n2)) ?
+                        $CDIM : (($CDIM == $COMP(n2)) ? $COMP(n1) : $CDIM-1))
+                : $CDIM))',
+        EquivCDimExpr => '(($COMP(n2) < $COMP(n1)) ?
+        (($PDIM < $COMP(n2) || $PDIM > $COMP(n1)) ?
+                $PDIM : (($PDIM == $COMP(n1)) ? $COMP(n2) : $PDIM+1))
+        : (($COMP(n1) < $COMP(n2)) ?
+                (($PDIM > $COMP(n2) || $PDIM < $COMP(n1)) ?
+                        $PDIM : (($PDIM == $COMP(n1)) ? $COMP(n2) : $PDIM-1))
+                : $PDIM))',
+        Doc => << 'EOD',
 =for ref
 
 move a dimension to another position
@@ -1566,8 +1662,8 @@ EOD
 =cut
 
 pp_def(
-	'oneslice',
-	Doc => <<'EOD',
+        'oneslice',
+        Doc => <<'EOD',
 =for ref
 
 experimental function - not for public use
@@ -1583,48 +1679,48 @@ transformations i.e. changing the size of some piddle at run-time.
 However, the mechanism is not yet finalized and this is just a demonstration.
 =cut
 EOD
-	P2Child => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	DefaultFlow => 1,
-	Reversible => 1,
-	OtherPars => 'int nth; int from; int step; int nsteps;',
-	AffinePriv => 1,
-	RedoDims => '
-		int nth = $PRIV(nth);
-		int from = $PRIV(from);
-		int step = $PRIV(step);
-		int nsteps = $PRIV(nsteps);
-		int i;
-		printf("ONESLICE_REDODIMS %d %d %d %d\n",nth,from,step,nsteps);
-		if(nth >= $PARENT(ndims)) {
-			die("Oneslice: too large nthdim");
-		}
-		if(from + step * (nsteps-1) >= $PARENT(dims[nth])) {
-			die("Oneslice: too many, too large steps");
-		}
-		if(from < 0 || step < 0) {
-			die("Oneslice: can only support positive from & step");
-		}
-		$PRIV(offs) = 0;
-		$SETNDIMS($PARENT(ndims));
-		$DOPRIVDIMS();
-		for(i=0; i<$PARENT(ndims); i++) {
-			$CHILD(dims)[i] = $PARENT(dims)[i];
-			$PRIV(incs)[i] = $PARENT(dimincs)[i];
-		}
-		$CHILD(dims)[nth] = nsteps;
-		$PRIV(incs)[nth] *= step;
-		$PRIV(offs) += from * $PARENT(dimincs)[nth];
-		$SETDELTATHREADIDS(0);
-		$SETDIMS();
-	',
-	FooCode => # This is why we have this stupid function
-	'	$COMP(from) = i1;
-		$COMP(step) = i2;
-		$COMP(nsteps) = i3;
-		printf("ONESLICE_FOOFUNC %d %d %d %d\n",
-		    $COMP(nth),$COMP(from),$COMP(step),$COMP(nsteps));
-	',
+        DefaultFlow => 1,
+        Reversible => 1,
+        OtherPars => 'int nth; int from; int step; int nsteps;',
+        AffinePriv => 1,
+        RedoDims => '
+                int nth = $PRIV(nth);
+                PDL_Indx from = $PRIV(from);
+                PDL_Indx step = $PRIV(step);
+                PDL_Indx nsteps = $PRIV(nsteps);
+                int i;
+                printf("ONESLICE_REDODIMS %d %d %d %d\n",nth,from,step,nsteps);
+                if(nth >= $PARENT(ndims)) {
+                        die("Oneslice: too large nthdim");
+                }
+                if(from + step * (nsteps-1) >= $PARENT(dims[nth])) {
+                        die("Oneslice: too many, too large steps");
+                }
+                if(from < 0 || step < 0) {
+                        die("Oneslice: can only support positive from & step");
+                }
+                $PRIV(offs) = 0;
+                $SETNDIMS($PARENT(ndims));
+                $DOPRIVDIMS();
+                for(i=0; i<$PARENT(ndims); i++) {
+                        $CHILD(dims)[i] = $PARENT(dims)[i];
+                        $PRIV(incs)[i] = $PARENT(dimincs)[i];
+                }
+                $CHILD(dims)[nth] = nsteps;
+                $PRIV(incs)[nth] *= step;
+                $PRIV(offs) += from * $PARENT(dimincs)[nth];
+                $SETDELTATHREADIDS(0);
+                $SETDIMS();
+        ',
+        FooCode => # This is why we have this stupid function
+        '       $COMP(from) = i1;
+                $COMP(step) = i2;
+                $COMP(nsteps) = i3;
+                printf("ONESLICE_FOOFUNC %d %d %d %d\n",
+                    $COMP(nth),$COMP(from),$COMP(step),$COMP(nsteps));
+        ',
 );
 
 
@@ -1632,17 +1728,21 @@ pp_addhdr << 'EOH';
 #define sign(x) ( (x) < 0 ? -1 : 1)
 EOH
 
-=head2 slice
+=head2 oslice
 =cut
 
 # I think the quotes in the =item ":" lines
 # confuse the perldoc stuff
 #
 pp_def(
-	'slice',
-	Doc => << 'EOD',
+        'oslice',
+        Doc => << 'EOD',
 =for ref
 
+DEPRECATED:  'oslice' is the original 'slice' routine in pre-2.006_006
+versions of PDL.  It is left here for reference but will disappear in
+PDL 3.000
+
 Extract a rectangular slice of a piddle, from a string specifier.
 
 C<slice> was the original Swiss-army-knife PDL indexing routine, but is
@@ -1694,6 +1794,7 @@ slices the range I<a> to I<b>, with step I<c> (i.e. C<3:7:2> gives the indices
 C<(3,5,7)>). This may be confusing to Matlab users but several other
 packages already use this syntax.
 
+
 =item '*'
 
 inserts an extra dimension of width 1 and
@@ -1713,259 +1814,272 @@ dimension that doesn't exist, but only index the 0th element, then
 C<slice> treats the source as if there were a dummy dimension there.
 The following are all equivalent:
 
-	xvals(5)->dummy(1,1)->slice('(2),0')  # Add dummy dim, then slice
-	xvals(5)->slice('(2),0')              # Out-of-bounds slice adds dim.
-	xvals(5)->slice((2),0)                # NiceSlice syntax
-	xvals(5)->((2))->dummy(0,1) 	      # NiceSlice syntax
+        xvals(5)->dummy(1,1)->slice('(2),0')  # Add dummy dim, then slice
+        xvals(5)->slice('(2),0')              # Out-of-bounds slice adds dim.
+        xvals(5)->slice((2),0)                # NiceSlice syntax
+        xvals(5)->((2))->dummy(0,1)           # NiceSlice syntax
 
 This is an error:
 
-	xvals(5)->slice('(2),1')	# nontrivial out-of-bounds slice dies
+        xvals(5)->slice('(2),1')        # nontrivial out-of-bounds slice dies
 
-Because slicing doesn't directly manipulate the source and destination 
-pdl -- it just sets up a transformation between them -- indexing errors 
+Because slicing doesn't directly manipulate the source and destination
+pdl -- it just sets up a transformation between them -- indexing errors
 often aren't reported until later.  This is either a bug or a feature,
 depending on whether you prefer error-reporting clarity or speed of execution.
 
 =cut
 
 EOD
-	P2Child => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	DefaultFlow => 1,
-	OtherPars => 'char* str',
-	Comp => 'int nnew; int nthintact; int intactnew; int ndum;
-	         int corresp[$COMP(intactnew)]; int start[$COMP(intactnew)];
-		 int inc[$COMP(intactnew)]; int end[$COMP(intactnew)];
-		 int nolddims;
-		 int whichold[$COMP(nolddims)]; int oldind[$COMP(nolddims)];
-		 ',
-	AffinePriv => 1,
-	MakeComp => q~
-		int i;
-		int nthnew; int nthold; int nthreal;
-		int dumsize;
-		char *s; char *ns;
-		int nums[3]; int nthnum;
-		$COMP(nnew)=0;
-		$COMP(ndum)=0;
-		$COMP(nolddims) = 0;
-		if(str[0] == '(')
-			$COMP(nolddims)++;
-		else if (str[0] == '*')
-			$COMP(ndum)++;
-		else if (str[0] != '\0') /* handle empty string */
-			$COMP(nnew)++;
-		for(i=0; str[i]; i++)
-			if(str[i] == ',') {
-				if(str[i+1] == '(')
-					$COMP(nolddims)++;
-				else if(str[i+1] == '*')
-					$COMP(ndum)++;
-				else
-					$COMP(nnew)++;
-			}
-		$COMP(nthintact) = $COMP(nolddims) + $COMP(nnew);
-		$COMP(intactnew) = $COMP(nnew)+$COMP(ndum);
-		$DOCOMPDIMS();
-		nthnew=0; nthold=0; i=0; nthreal=0;
-		s=str-1;
-		do {
-			s++;
-			if(isdigit(*s) || *s == '-') {
-				nthnew++; nthreal++;
-				$COMP(inc[nthnew-1]) = 1;
-				$COMP(corresp[nthnew-1]) = nthreal-1;
-				$COMP(start[nthnew-1]) = strtol(s,&s,10);
-				if(*s != ':') {
-					$COMP(end[nthnew-1]) =
-						$COMP(start[nthnew-1]);
-					goto outlab;
-				}
-				s++;
-				if(!isdigit(*s) && !(*s == '-')) {
-					barf("Invalid slice str ind1 '%s': '%s'",str,s);
-				}
-				$COMP(end[nthnew-1]) = strtol(s,&s,10);
-				if(*s != ':') {goto outlab;}
-				s++;
-				if(!isdigit(*s) && !(*s == '-')) {
-					barf("Invalid slice str ind2 '%s': '%s'",str,s);
-				}
-				$COMP(inc[nthnew-1]) = strtol(s,&s,10);
-			} else switch(*s) {
-			case ':':
-				s++;
-				/* FALLTHRU */
-			case ',': case '\0':  /* In these cases, no inc s */
-				if ($COMP(intactnew) > 0) {
-				  $COMP(start[nthnew]) = 0;
-				  $COMP(end[nthnew]) = -1;
-				  $COMP(inc[nthnew]) = 1;
-				  $COMP(corresp[nthnew]) = nthreal;
-				  nthnew++; nthreal++;
-				}
-				break;
-			case '(':
-				s++;
-				$COMP(oldind[nthold]) = strtol(s,&s,10);
-				$COMP(whichold[nthold]) = nthreal;
-				nthold++; nthreal++;
-				if(*s != ')') {
-					barf("Sliceoblit must end with ')': '%s': '%s'",str,s);
-				}
-				s++;
-				break;
-			case '*':
-				s++;
-				if(isdigit(*s)) {
-					dumsize = strtol(s,&s,10);
-				} else {dumsize = 1;}
-				$COMP(corresp[nthnew]) = -1;
-				$COMP(start[nthnew]) = 0;
-				$COMP(end[nthnew]) = dumsize-1;
-				$COMP(inc[nthnew]) = 1;
-				nthnew++;
-				break;
-			}
-		   outlab:
-			if(*s != ',' && *s != '\0') {
-				barf("Invalid slice str '%s': '%s'",str,s);
-			}
-		} while(*s);
-		$SETREVERSIBLE(1); /* XXX Only if incs>0, no dummies */
-	~,
-	RedoDims => '
-		int i; int start; int end; int inc;
-		if ($COMP(nthintact) > $PARENT(ndims)) {
-
-	/* Slice has more dims than parent.  Check that the extra dims are 		
+        DefaultFlow => 1,
+        OtherPars => 'char* str',
+        Comp => 'int nnew; int nthintact; int intactnew; int ndum;
+                 int corresp[$COMP(intactnew)]; PDL_Indx start[$COMP(intactnew)];
+                 PDL_Indx inc[$COMP(intactnew)]; PDL_Indx end[$COMP(intactnew)];
+                 int nolddims;
+                 int whichold[$COMP(nolddims)]; int oldind[$COMP(nolddims)];
+                 ',
+        AffinePriv => 1,
+        MakeComp => q~
+                int i;
+                int nthnew; int nthold; int nthreal;
+                PDL_Indx dumsize;
+                char *s; char *ns;
+                int nums[3]; int nthnum;
+                $COMP(nnew)=0;
+                $COMP(ndum)=0;
+                $COMP(nolddims) = 0;
+                if(str[0] == '(')
+                        $COMP(nolddims)++;
+                else if (str[0] == '*')
+                        $COMP(ndum)++;
+                else if (str[0] != '\0') /* handle empty string */
+                        $COMP(nnew)++;
+                for(i=0; str[i]; i++)
+                        if(str[i] == ',') {
+                                if(str[i+1] == '(')
+                                        $COMP(nolddims)++;
+                                else if(str[i+1] == '*')
+                                        $COMP(ndum)++;
+                                else
+                                        $COMP(nnew)++;
+                        }
+                $COMP(nthintact) = $COMP(nolddims) + $COMP(nnew);
+                $COMP(intactnew) = $COMP(nnew)+$COMP(ndum);
+                $DOCOMPDIMS();
+                nthnew=0; nthold=0; i=0; nthreal=0;
+                s=str-1;
+                do {
+                        s++;
+                        if(isdigit(*s) || *s == '-') {
+                                nthnew++; nthreal++;
+                                $COMP(inc[nthnew-1]) = 1;
+                                $COMP(corresp[nthnew-1]) = nthreal-1;
+                                $COMP(start[nthnew-1]) = strtoll(s,&s,10);
+                                if(*s != ':') {
+                                        $COMP(end[nthnew-1]) =
+                                                $COMP(start[nthnew-1]);
+                                        goto outlab;
+                                }
+                                s++;
+                                if(!isdigit(*s) && !(*s == '-')) {
+                                        barf("Invalid slice str ind1 '%s': '%s'",str,s);
+                                }
+                                $COMP(end[nthnew-1]) = strtoll(s,&s,10);
+                                if(*s != ':') {goto outlab;}
+                                s++;
+                                if(!isdigit(*s) && !(*s == '-')) {
+                                        barf("Invalid slice str ind2 '%s': '%s'",str,s);
+                                }
+                                $COMP(inc[nthnew-1]) = strtoll(s,&s,10);
+                        } else switch(*s) {
+                        case ':':
+                                s++;
+                                /* FALLTHRU */
+                        case ',': case '\0':  /* In these cases, no inc s */
+                                if ($COMP(intactnew) > 0) {
+                                  $COMP(start[nthnew]) = 0;
+                                  $COMP(end[nthnew]) = -1;
+                                  $COMP(inc[nthnew]) = 1;
+                                  $COMP(corresp[nthnew]) = nthreal;
+                                  nthnew++; nthreal++;
+                                }
+                                break;
+                        case '(':
+                                s++;
+                                $COMP(oldind[nthold]) = strtoll(s,&s,10);
+                                $COMP(whichold[nthold]) = nthreal;
+                                nthold++; nthreal++;
+                                if(*s != ')') {
+                                        barf("Sliceoblit must end with ')': '%s': '%s'",str,s);
+                                }
+                                s++;
+                                break;
+                        case '*':
+                                s++;
+                                if(isdigit(*s)) {
+                                        dumsize = strtoll(s,&s,10);
+                                } else {dumsize = 1;}
+                                $COMP(corresp[nthnew]) = -1;
+                                $COMP(start[nthnew]) = 0;
+                                $COMP(end[nthnew]) = dumsize-1;
+                                $COMP(inc[nthnew]) = 1;
+                                nthnew++;
+                                break;
+                        }
+                   outlab:
+                        if(*s != ',' && *s != '\0') {
+                                barf("Invalid slice str '%s': '%s'",str,s);
+                        }
+                } while(*s);
+                $SETREVERSIBLE(1); /* XXX Only if incs>0, no dummies */
+        ~,
+        RedoDims => '
+                int i; PDL_Indx start; PDL_Indx end; PDL_Indx inc;
+                if ($COMP(nthintact) > $PARENT(ndims)) {
+
+        /* Slice has more dims than parent.  Check that the extra dims are
          * all zero, and if they are then give back What You Probably Wanted,
-	 * which is a slice with dummy dimensions of order 1 in place of each excessive 
-	 * dimension.  (Note that there are two ways to indicate a zero index: "0" and "-<w>",
-	 * where <w> happens to be the order of that dimension in the original
-	 * piddle.  The latter case still causes an error.  That is a feature.)
-	 *    --CED 15-March-2002
-	 */
-			int ii,parentdim,ok;
-			int n_xtra_dims=0, n_xtra_olddims=0;
-
-			   /* Check index for each extra dim in the ordinary affine list */
-
-			for(ok=1, ii = 0; ok && ii < $COMP(intactnew) ; ii++) {
-				parentdim = $COMP(corresp[ii]);
-/*				fprintf(stderr,"ii=%d,parent=%d, ndum=%d, nnew=%d...",ii,parentdim,$COMP(ndum),$COMP(nnew));				*/
-				if(parentdim >= $PARENT(ndims)) {					
-
-					ok = ( ( $COMP(start[ii]) == 0 ) && 
-					  	( $COMP(end[ii]) == 0 || $COMP(end[ii])== -1 )
-					);
-					if(ok) {
-						/* Change this into a dummy dimension, rank 1 */
-						$COMP(corresp[ii]) = -1;
-						$COMP(start[ii])   = 0;
-						$COMP(end[ii])     = 0;
-						$COMP(inc[ii])     = 1;
-						$COMP(ndum)++;      /* One more dummy dimension... */
-						$COMP(nnew)--;      /* ... one less real dimension */
-						$COMP(nthintact)--; /* ... one less intact dim */
-/*						fprintf(stderr,"ok, ndum=%d, nnew=%d\n",$COMP(ndum), $COMP(nnew));*/
-					}
-/*				fflush(stderr);*/
-				}
-			}	
-			
-			  /* Check index for each indexed parent dimension */
-			for(ii=0; ok && ii < $COMP(nolddims); ii++) {
-				if($COMP(whichold[ii]) >= $PARENT(ndims)) {
-					ok = ( $COMP(whichold[ii]) < $PARENT(ndims) ) ||
-						( $COMP(oldind[ii]) == 0 ) ||
-						( $COMP(oldind[ii]) == -1) ;
-					if(ok) {
-					  int ij;
-					  /* crunch indexed dimensions -- slow but sure */
-					  $COMP(nolddims)--;
-					  for(ij=ii; ij<$COMP(nolddims); ij++) {
-						$COMP(oldind[ij]) = $COMP(oldind[ij+1]);
-					 	$COMP(whichold[ij]) = $COMP(whichold[ij+1]);
-					  }
-					  $COMP(nthintact)--;
-					}
-				}
-			}	
-/*	fprintf(stderr,"ok=%d\n",ok);fflush(stderr);*/
-			if(ok) {
-			   /* Valid slice: all extra dims are zero. Adjust indices accordingly. */
-/*			  $COMP(intactnew) -= $COMP(nthintact) - $PARENT(ndims); */
-/*			  $COMP(nthintact) = $PARENT(ndims);*/
-			} else { 	
-
-			   /* Invalid slice: nonzero extra dimension.  Clean up and die.  */
-
-  			 $SETNDIMS(0); /* dirty fix */
-			 $PRIV(offs) = 0;	
-			 $SETDIMS();
-			 $CROAK("Too many dims in slice");
-			}
- 	        }
-		$SETNDIMS($PARENT(ndims)-$COMP(nthintact)+$COMP(intactnew));
-		$DOPRIVDIMS();
-		$PRIV(offs) = 0;
-		for(i=0; i<$COMP(intactnew); i++) {
-			int parentdim = $COMP(corresp[i]);
-			start = $COMP(start[i]); end = $COMP(end[i]);
-			inc = $COMP(inc[i]);
-			if(parentdim!=-1) {
-				if(-start > $PARENT(dims[parentdim]) ||
-				   -end > $PARENT(dims[parentdim])) {
-					barf("Negative slice cannot start or end above limit");
+         * which is a slice with dummy dimensions of order 1 in place of each excessive
+         * dimension.  (Note that there are two ways to indicate a zero index: "0" and "-<w>",
+         * where <w> happens to be the size of that dim in the original
+         * piddle.  The latter case still causes an error.  That is a feature.)
+         *    --CED 15-March-2002
+         */
+                        int ii,parentdim,ok;
+                        int n_xtra_dims=0, n_xtra_olddims=0;
+
+                           /* Check index for each extra dim in the ordinary affine list */
+
+                        for(ok=1, ii = 0; ok && ii < $COMP(intactnew) ; ii++) {
+                                parentdim = $COMP(corresp[ii]);
+/*                              fprintf(stderr,"ii=%d,parent=%d, ndum=%d, nnew=%d...",ii,parentdim,$COMP(ndum),$COMP(nnew));                            */
+                                if(parentdim >= $PARENT(ndims)) {
+
+                                        ok = ( ( $COMP(start[ii]) == 0 ) &&
+                                                ( $COMP(end[ii]) == 0 || $COMP(end[ii])== -1 )
+                                        );
+                                        if(ok) {
+                                                /* Change this into a dummy dimension, rank 1 */
+                                                $COMP(corresp[ii]) = -1;
+                                                $COMP(start[ii])   = 0;
+                                                $COMP(end[ii])     = 0;
+                                                $COMP(inc[ii])     = 1;
+                                                $COMP(ndum)++;      /* One more dummy dimension... */
+                                                $COMP(nnew)--;      /* ... one less real dimension */
+                                                $COMP(nthintact)--; /* ... one less intact dim */
+/*                                              fprintf(stderr,"ok, ndum=%d, nnew=%d\n",$COMP(ndum), $COMP(nnew));*/
+                                        }
+/*                              fflush(stderr);*/
+                                }
+                        }
+
+                          /* Check index for each indexed parent dimension */
+                        for(ii=0; ok && ii < $COMP(nolddims); ii++) {
+                                if($COMP(whichold[ii]) >= $PARENT(ndims)) {
+                                        ok = ( $COMP(whichold[ii]) < $PARENT(ndims) ) ||
+                                                ( $COMP(oldind[ii]) == 0 ) ||
+                                                ( $COMP(oldind[ii]) == -1) ;
+                                        if(ok) {
+                                          int ij;
+                                          /* crunch indexed dimensions -- slow but sure */
+                                          $COMP(nolddims)--;
+                                          for(ij=ii; ij<$COMP(nolddims); ij++) {
+                                                $COMP(oldind[ij]) = $COMP(oldind[ij+1]);
+                                                $COMP(whichold[ij]) = $COMP(whichold[ij+1]);
+                                          }
+                                          $COMP(nthintact)--;
+                                        }
+                                }
+                        }
+/*      fprintf(stderr,"ok=%d\n",ok);fflush(stderr);*/
+                        if(ok) {
+                           /* Valid slice: all extra dims are zero. Adjust indices accordingly. */
+/*                        $COMP(intactnew) -= $COMP(nthintact) - $PARENT(ndims); */
+/*                        $COMP(nthintact) = $PARENT(ndims);*/
+                        } else {
+
+                           /* Invalid slice: nonzero extra dimension.  Clean up and die.  */
+
+                         $SETNDIMS(0); /* dirty fix */
+                         $PRIV(offs) = 0;
+                         $SETDIMS();
+                         $CROAK("Too many dims in slice");
+                        }
+                }
+                $SETNDIMS($PARENT(ndims)-$COMP(nthintact)+$COMP(intactnew));
+                $DOPRIVDIMS();
+                $PRIV(offs) = 0;
+                for(i=0; i<$COMP(intactnew); i++) {
+                        int parentdim = $COMP(corresp[i]);
+                        start = $COMP(start[i]); end = $COMP(end[i]);
+                        inc = $COMP(inc[i]);
+                        if(parentdim!=-1) {
+                                if(-start > $PARENT(dims[parentdim]) ||
+                                   -end > $PARENT(dims[parentdim])) {
+                                        /* set a state flag to re-trip the RedoDims code later, in
+                                         * case this barf is caught in an eval. This slice will
+                                         * always croak, so it may be smarter to find a way to
+                                         * replace this whole piddle with a "barf" piddle, but this
+                                         * will work for now. */
+                                        PDL->changed($CHILD_PTR(), PDL_PARENTDIMSCHANGED, 0);
+                                        barf("Negative slice cannot start or end above limit");
                                 }
-				if(start < 0)
-					start = $PARENT(dims[parentdim]) + start;
-				if(end < 0)
-					end = $PARENT(dims[parentdim]) + end;
-				if(start >= $PARENT(dims[parentdim]) ||
-				   end >= $PARENT(dims[parentdim])) {
-					barf("Slice cannot start or end above limit");
-				}
-				if(sign(end-start)*sign(inc) < 0)
-					inc = -inc;
-				$PRIV(incs[i]) = $PARENT(dimincs[parentdim]) * inc;
-				$PRIV(offs) += start * $PARENT(dimincs[parentdim]);
-			} else {
-				$PRIV(incs[i]) = 0;
-			}
-			$CHILD(dims[i]) = ((int)((end-start)/inc))+1;
+                                if(start < 0)
+                                        start = $PARENT(dims[parentdim]) + start;
+                                if(end < 0)
+                                        end = $PARENT(dims[parentdim]) + end;
+                                if(start >= $PARENT(dims[parentdim]) ||
+                                   end >= $PARENT(dims[parentdim])) {
+                                        /* set a state flag to re-trip the RedoDims code later, in
+                                         * case this barf is caught in an eval. This slice will
+                                         * always croak, so it may be smarter to find a way to
+                                         * replace this whole piddle with a "barf" piddle, but this
+                                         * will work for now. */
+                                        PDL->changed($CHILD_PTR(), PDL_PARENTDIMSCHANGED, 0);
+                                        barf("Slice cannot start or end above limit");
+                                }
+                                if(sign(end-start)*sign(inc) < 0)
+                                        inc = -inc;
+                                $PRIV(incs[i]) = $PARENT(dimincs[parentdim]) * inc;
+                                $PRIV(offs) += start * $PARENT(dimincs[parentdim]);
+                        } else {
+                                $PRIV(incs[i]) = 0;
+                        }
+                        $CHILD(dims[i]) = ((PDL_Indx)((end-start)/inc))+1;
                         if ($CHILD(dims[i]) <= 0)
                            barf("slice internal error: computed slice dimension must be positive");
-		}
-		for(i=$COMP(nthintact); i<$PARENT(ndims); i++) {
-			int cdim = i - $COMP(nthintact) + $COMP(intactnew);
-			$PRIV(incs[cdim]) = $PARENT(dimincs[i]);
-			$CHILD(dims[cdim]) = $PARENT(dims[i]);
-		}
-		for(i=0; i<$COMP(nolddims); i++) {
-			int oi = $COMP(oldind[i]);
-			int wo = $COMP(whichold[i]);
-			if(oi < 0)
-				oi += $PARENT(dims[wo]);
-			if( oi >= $PARENT(dims[wo]) )
-				$CROAK("Cannot obliterate dimension after end");
-			$PRIV(offs) += $PARENT(dimincs[wo])
-					* oi;
-		}
-	/*
-		for(i=0; i<$CHILD(ndims)-$PRIV(nnew); i++) {
-			$CHILD(dims[i+$COMP(intactnew)]) =
-				$PARENT(dims[i+$COMP(nthintact)]);
-			$PRIV(incs[i+$COMP(intactnew)]) =
-				$PARENT(dimincs[i+$COMP(nthintact)]);
-		}
-	*/
-		$SETDIMS();
-	',
+                }
+                for(i=$COMP(nthintact); i<$PARENT(ndims); i++) {
+                        int cdim = i - $COMP(nthintact) + $COMP(intactnew);
+                        $PRIV(incs[cdim]) = $PARENT(dimincs[i]);
+                        $CHILD(dims[cdim]) = $PARENT(dims[i]);
+                }
+                for(i=0; i<$COMP(nolddims); i++) {
+                        int oi = $COMP(oldind[i]);
+                        int wo = $COMP(whichold[i]);
+                        if(oi < 0)
+                                oi += $PARENT(dims[wo]);
+                        if( oi >= $PARENT(dims[wo]) )
+                                $CROAK("Cannot obliterate dimension after end");
+                        $PRIV(offs) += $PARENT(dimincs[wo])
+                                        * oi;
+                }
+        /*
+                for(i=0; i<$CHILD(ndims)-$PRIV(nnew); i++) {
+                        $CHILD(dims[i+$COMP(intactnew)]) =
+                                $PARENT(dims[i+$COMP(nthintact)]);
+                        $PRIV(incs[i+$COMP(intactnew)]) =
+                                $PARENT(dimincs[i+$COMP(nthintact)]);
+                }
+        */
+                $SETDIMS();
+        ',
 );
 
+
 pp_addpm(<<'EOD'
 
 =head2 using
@@ -2004,116 +2118,116 @@ pp_add_exported('', 'using');
 
 pp_addhdr(<<END
 static int cmp_pdll(const void *a_,const void *b_) {
-	PDL_Long *a = (PDL_Long *)a_; PDL_Long *b=(PDL_Long *)b_;
-	if(*a>*b) return 1;
-	else if(*a==*b) return 0;
-	else return -1;
+        int *a = (int *)a_; int *b=(int *)b_;
+        if(*a>*b) return 1;
+        else if(*a==*b) return 0;
+        else return -1;
 }
 END
 );
-	
+
 
 pp_def( 'affine',
-	P2Child => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	DefaultFlow => 1,
-	Reversible => 1,
-	AffinePriv => 1,
-	GlobalNew => 'affine_new',
-	OtherPars => 'int offspar; SV *dimlist; SV *inclist;',
-	Comp => 'int nd; PDL_Long offset; PDL_Long sdims[$COMP(nd)];
-		PDL_Long sincs[$COMP(nd)];',
-	MakeComp => '
-		int i,n2;
-		PDL_Long *tmpi;
-		PDL_Long *tmpd = PDL->packdims(dimlist,&($COMP(nd)));
-		tmpi = PDL->packdims(inclist,&n2);		
-		if ($COMP(nd) < 0) {
-		      $CROAK("Affine: can not have negative no of dims");
-		}
-		if ($COMP(nd) != n2)
-		      $CROAK("Affine: number of incs does not match dims");
-		$DOCOMPDIMS();
-		$COMP(offset) = offspar;
-		for (i=0; i<$COMP(nd); i++) {
-			$COMP(sdims)[i] = tmpd[i];
-			$COMP(sincs)[i] = tmpi[i];
-		}
-		',
-	RedoDims => '
-		int i;
-		$SETNDIMS($COMP(nd));
-		$DOPRIVDIMS();
-		$PRIV(offs) = $COMP(offset);
-		for (i=0;i<$CHILD(ndims);i++) {
-			$PRIV(incs)[i] = $COMP(sincs)[i];
-			$CHILD(dims)[i] = $COMP(sdims)[i];
-		}
-		$SETDIMS();
-		',
-	Doc => undef,
+        DefaultFlow => 1,
+        Reversible => 1,
+        AffinePriv => 1,
+        GlobalNew => 'affine_new',
+        OtherPars => 'PDL_Indx offspar; SV *dimlist; SV *inclist;',
+        Comp => 'int nd; PDL_Indx offset; PDL_Indx sdims[$COMP(nd)];
+                PDL_Indx sincs[$COMP(nd)];',
+        MakeComp => '
+                int i,n2;
+                PDL_Indx *tmpi;
+                PDL_Indx *tmpd = PDL->packdims(dimlist,&($COMP(nd)));
+                tmpi = PDL->packdims(inclist,&n2);
+                if ($COMP(nd) < 0) {
+                      $CROAK("Affine: can not have negative no of dims");
+                }
+                if ($COMP(nd) != n2)
+                      $CROAK("Affine: number of incs does not match dims");
+                $DOCOMPDIMS();
+                $COMP(offset) = offspar;
+                for (i=0; i<$COMP(nd); i++) {
+                        $COMP(sdims)[i] = tmpd[i];
+                        $COMP(sincs)[i] = tmpi[i];
+                }
+                ',
+        RedoDims => '
+                PDL_Indx i;
+                $SETNDIMS($COMP(nd));
+                $DOPRIVDIMS();
+                $PRIV(offs) = $COMP(offset);
+                for (i=0;i<$CHILD(ndims);i++) {
+                        $PRIV(incs)[i] = $COMP(sincs)[i];
+                        $CHILD(dims)[i] = $COMP(sdims)[i];
+                }
+                $SETDIMS();
+                ',
+        Doc => undef,
 );
 
 =head2 diagonalI
 =cut
 
 pp_def(
-	'diagonalI',
-	P2Child => 1,
+        'diagonalI',
+        P2Child => 1,
         NoPdlThread => 1,
-	DefaultFlow => 1,
-	Reversible => 1,
-	AffinePriv => 1,
-	OtherPars => 'SV *list',
-	Comp => 'int nwhichdims; PDL_Long whichdims[$COMP(nwhichdims)];',
-	MakeComp => '
-		int i,j;
-		PDL_Long *tmp= PDL->packdims(list,&($COMP(nwhichdims)));
-		if($COMP(nwhichdims) < 1) {
-			$CROAK("Diagonal: must have at least 1 dimension");
-		}
-		$DOCOMPDIMS();
-		for(i=0; i<$COMP(nwhichdims); i++)
-			$COMP(whichdims)[i] = tmp[i];
-		qsort($COMP(whichdims), $COMP(nwhichdims), sizeof(PDL_Long),
-			cmp_pdll);
-	',
-	RedoDims => '
-		int nthp,nthc,nthd; int cd = $COMP(whichdims[0]);
-		$SETNDIMS($PARENT(ndims)-$COMP(nwhichdims)+1);
-		$DOPRIVDIMS();
-		$PRIV(offs) = 0;
-		if ($COMP(whichdims)[$COMP(nwhichdims)-1] >= $PARENT(ndims) ||
-			$COMP(whichdims)[0] < 0)
-			$CROAK("Diagonal: dim out of range");
-		nthd=0; nthc=0;
-		for(nthp=0; nthp<$PARENT(ndims); nthp++)
-			if (nthd < $COMP(nwhichdims) &&
-			    nthp == $COMP(whichdims)[nthd]) {
-				if (!nthd) {
-					$CHILD(dims)[cd] = $PARENT(dims)[cd];
-					nthc++;
-					$PRIV(incs)[cd] = 0;
-				}
-				if (nthd && $COMP(whichdims)[nthd] ==
-				    $COMP(whichdims)[nthd-1])
-				       $CROAK("Diagonal: dims must be unique");
-				nthd++; /* advance pointer into whichdims */
-				if($CHILD(dims)[cd] !=
-				    $PARENT(dims)[nthp]) {
-					$CROAK("Different dims %d and %d",
-						$CHILD(dims)[cd],
-						$PARENT(dims)[nthp]);
-				}
-				$PRIV(incs)[cd] += $PARENT(dimincs)[nthp];
-			} else {
-				$PRIV(incs)[nthc] = $PARENT(dimincs)[nthp];
-				$CHILD(dims)[nthc] = $PARENT(dims)[nthp];
-				nthc++;
-			}
-		$SETDIMS();
-	',
-	Doc => << 'EOD',
+        DefaultFlow => 1,
+        Reversible => 1,
+        AffinePriv => 1,
+        OtherPars => 'SV *list',
+        Comp => 'int nwhichdims; int whichdims[$COMP(nwhichdims)];',
+        MakeComp => '
+                int i,j;
+                PDL_Indx *tmp= PDL->packdims(list,&($COMP(nwhichdims)));
+                if($COMP(nwhichdims) < 1) {
+                        $CROAK("Diagonal: must have at least 1 dimension");
+                }
+                $DOCOMPDIMS();
+                for(i=0; i<$COMP(nwhichdims); i++)
+                        $COMP(whichdims)[i] = tmp[i];
+                qsort($COMP(whichdims), $COMP(nwhichdims), sizeof(int),
+                        cmp_pdll);
+        ',
+        RedoDims => '
+                int nthp,nthc,nthd; int cd = $COMP(whichdims[0]);
+                $SETNDIMS($PARENT(ndims)-$COMP(nwhichdims)+1);
+                $DOPRIVDIMS();
+                $PRIV(offs) = 0;
+                if ($COMP(whichdims)[$COMP(nwhichdims)-1] >= $PARENT(ndims) ||
+                        $COMP(whichdims)[0] < 0)
+                        $CROAK("Diagonal: dim out of range");
+                nthd=0; nthc=0;
+                for(nthp=0; nthp<$PARENT(ndims); nthp++)
+                        if (nthd < $COMP(nwhichdims) &&
+                            nthp == $COMP(whichdims)[nthd]) {
+                                if (!nthd) {
+                                        $CHILD(dims)[cd] = $PARENT(dims)[cd];
+                                        nthc++;
+                                        $PRIV(incs)[cd] = 0;
+                                }
+                                if (nthd && $COMP(whichdims)[nthd] ==
+                                    $COMP(whichdims)[nthd-1])
+                                       $CROAK("Diagonal: dims must be unique");
+                                nthd++; /* advance pointer into whichdims */
+                                if($CHILD(dims)[cd] !=
+                                    $PARENT(dims)[nthp]) {
+                                        $CROAK("Different dims %d and %d",
+                                                $CHILD(dims)[cd],
+                                                $PARENT(dims)[nthp]);
+                                }
+                                $PRIV(incs)[cd] += $PARENT(dimincs)[nthp];
+                        } else {
+                                $PRIV(incs)[nthc] = $PARENT(dimincs)[nthp];
+                                $CHILD(dims)[nthc] = $PARENT(dims)[nthp];
+                                nthc++;
+                        }
+                $SETDIMS();
+        ',
+        Doc => << 'EOD',
 =for ref
 
 Returns the multidimensional diagonal over the specified dimensions.
@@ -2127,7 +2241,7 @@ C<(5,3,5,4,6,5)> then after
 
  $b = $a->diagonal(0,2,5);
 
-the piddle C<$b> has dimensions C<(5,3,4,6)> and 
+the piddle C<$b> has dimensions C<(5,3,4,6)> and
 C<$b-E<gt>at(2,1,0,1)> refers
 to C<$a-E<gt>at(2,1,2,0,1,2)>.
 
@@ -2140,8 +2254,8 @@ EOD
 =cut
 
 pp_def(
-	'lags',
-	Doc => <<'EOD',
+        'lags',
+        Doc => <<'EOD',
 =for ref
 
 Returns a piddle of lags to parent.
@@ -2175,52 +2289,52 @@ negative and will then be counted from the last dim backwards
 in the usual way (-1 = last dim).
 =cut
 EOD
-	P2Child => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	DefaultFlow => 1,
-	Reversible => 1, # XXX Not really
-	AffinePriv => 1,
-	OtherPars => 'int nthdim; int step; int n;',
-	RedoDims => '
-		int i;
-		if ($PRIV(nthdim) < 0)  /* the usual conventions */
-	           $PRIV(nthdim) = $PARENT(ndims) + $PRIV(nthdim);
-		if ($PRIV(nthdim) < 0 || $PRIV(nthdim) >= $PARENT(ndims))
-		   $CROAK("lags: dim out of range");
-		if ($COMP(n) < 1)
-		   $CROAK("lags: number of lags must be positive");
-		if ($COMP(step) < 1)
-		   $CROAK("lags: step must be positive");
-		$PRIV(offs) = 0;
-		$SETNDIMS($PARENT(ndims)+1);
-		$DOPRIVDIMS();
-		for(i=0; i<$PRIV(nthdim); i++) {
-			$CHILD(dims)[i] = $PARENT(dims)[i];
-			$PRIV(incs)[i] = $PARENT(dimincs)[i];
-		}
-		$CHILD(dims)[i] = $PARENT(dims)[i] - $COMP(step) * ($COMP(n)-1);
-		if ($CHILD(dims)[i] < 1)
-		  $CROAK("lags: product of step size and "
-			 "number of lags too large");
-		$CHILD(dims)[i+1] = $COMP(n);
-		$PRIV(incs)[i] = ($PARENT(dimincs)[i]);
-		$PRIV(incs)[i+1] = - $PARENT(dimincs)[i] * $COMP(step);
+        DefaultFlow => 1,
+        Reversible => 1, # XXX Not really
+        AffinePriv => 1,
+        OtherPars => 'int nthdim; int step; int n;',
+        RedoDims => '
+                int i;
+                if ($PRIV(nthdim) < 0)  /* the usual conventions */
+                   $PRIV(nthdim) = $PARENT(ndims) + $PRIV(nthdim);
+                if ($PRIV(nthdim) < 0 || $PRIV(nthdim) >= $PARENT(ndims))
+                   $CROAK("lags: dim out of range");
+                if ($COMP(n) < 1)
+                   $CROAK("lags: number of lags must be positive");
+                if ($COMP(step) < 1)
+                   $CROAK("lags: step must be positive");
+                $PRIV(offs) = 0;
+                $SETNDIMS($PARENT(ndims)+1);
+                $DOPRIVDIMS();
+                for(i=0; i<$PRIV(nthdim); i++) {
+                        $CHILD(dims)[i] = $PARENT(dims)[i];
+                        $PRIV(incs)[i] = $PARENT(dimincs)[i];
+                }
+                $CHILD(dims)[i] = $PARENT(dims)[i] - $COMP(step) * ($COMP(n)-1);
+                if ($CHILD(dims)[i] < 1)
+                  $CROAK("lags: product of step size and "
+                         "number of lags too large");
+                $CHILD(dims)[i+1] = $COMP(n);
+                $PRIV(incs)[i] = ($PARENT(dimincs)[i]);
+                $PRIV(incs)[i+1] = - $PARENT(dimincs)[i] * $COMP(step);
                 $PRIV(offs) += ($CHILD(dims)[i+1] - 1) * (-$PRIV(incs)[i+1]);
-		i++;
-		for(; i<$PARENT(ndims); i++) {
-			$CHILD(dims)[i+1] = $PARENT(dims)[i];
-			$PRIV(incs)[i+1] = $PARENT(dimincs)[i];
-		}
-		$SETDIMS();
-	'
+                i++;
+                for(; i<$PARENT(ndims); i++) {
+                        $CHILD(dims)[i+1] = $PARENT(dims)[i];
+                        $PRIV(incs)[i+1] = $PARENT(dimincs)[i];
+                }
+                $SETDIMS();
+        '
 );
 
 =head2 splitdim
 =cut
 
 pp_def(
-	'splitdim',
-	Doc => <<'EOD',
+        'splitdim',
+        Doc => <<'EOD',
 =for ref
 
 Splits a dimension in the parent piddle (opposite of L<clump|PDL::Core/clump>)
@@ -2238,61 +2352,61 @@ the expression
 is always true (C<x> has to be less than 3).
 =cut
 EOD
-	P2Child => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	DefaultFlow => 1,
-	Reversible => 1, # XXX Not really
-	OtherPars => 'int nthdim; int nsp;',
-	AffinePriv => 1,
-	RedoDims => '
-		int i = $COMP(nthdim);
-		int nsp = $COMP(nsp);
-		if(nsp == 0) {die("Splitdim: Cannot split to 0\n");}
-		if(i <0 || i >= $PARENT(ndims)) {
-			die("Splitdim: nthdim (%d) must not be negative or greater or equal to number of dims (%d)\n",
-				i, $PARENT(ndims));
-		}
-		if(nsp > $PARENT(dims[i])) {
-			die("Splitdim: nsp (%d) cannot be greater than dim (%d)\n",
-				nsp, $PARENT(dims[i]));
-		}
-		$PRIV(offs) = 0;
-		$SETNDIMS($PARENT(ndims)+1);
-		$DOPRIVDIMS();
-		for(i=0; i<$PRIV(nthdim); i++) {
-			$CHILD(dims)[i] = $PARENT(dims)[i];
-			$PRIV(incs)[i] = $PARENT(dimincs)[i];
-		}
-		$CHILD(dims)[i] = $COMP(nsp);
-		$CHILD(dims)[i+1] = $PARENT(dims)[i] / $COMP(nsp);
-		$PRIV(incs)[i] = $PARENT(dimincs)[i];
-		$PRIV(incs)[i+1] = $PARENT(dimincs)[i] * $COMP(nsp);
-		i++;
-		for(; i<$PARENT(ndims); i++) {
-			$CHILD(dims)[i+1] = $PARENT(dims)[i];
-			$PRIV(incs)[i+1] = $PARENT(dimincs)[i];
-		}
-		$SETDIMS();
-	',
+        DefaultFlow => 1,
+        Reversible => 1, # XXX Not really
+        OtherPars => 'int nthdim; int nsp;',
+        AffinePriv => 1,
+        RedoDims => '
+                int i = $COMP(nthdim);
+                int nsp = $COMP(nsp);
+                if(nsp == 0) {die("Splitdim: Cannot split to 0\n");}
+                if(i <0 || i >= $PARENT(ndims)) {
+                        die("Splitdim: nthdim (%d) must not be negative or greater or equal to number of dims (%d)\n",
+                                i, $PARENT(ndims));
+                }
+                if(nsp > $PARENT(dims[i])) {
+                        die("Splitdim: nsp (%d) cannot be greater than dim (%d)\n",
+                                nsp, $PARENT(dims[i]));
+                }
+                $PRIV(offs) = 0;
+                $SETNDIMS($PARENT(ndims)+1);
+                $DOPRIVDIMS();
+                for(i=0; i<$PRIV(nthdim); i++) {
+                        $CHILD(dims)[i] = $PARENT(dims)[i];
+                        $PRIV(incs)[i] = $PARENT(dimincs)[i];
+                }
+                $CHILD(dims)[i] = $COMP(nsp);
+                $CHILD(dims)[i+1] = $PARENT(dims)[i] / $COMP(nsp);
+                $PRIV(incs)[i] = $PARENT(dimincs)[i];
+                $PRIV(incs)[i+1] = $PARENT(dimincs)[i] * $COMP(nsp);
+                i++;
+                for(; i<$PARENT(ndims); i++) {
+                        $CHILD(dims)[i+1] = $PARENT(dims)[i];
+                        $PRIV(incs)[i+1] = $PARENT(dimincs)[i];
+                }
+                $SETDIMS();
+        ',
 );
 
 =head2 rotate
 =cut
 
 pp_def('rotate',
-	Doc => <<'EOD',
+        Doc => <<'EOD',
 =for ref
 
 Shift vector elements along with wrap. Flows data back&forth.
 =cut
 EOD
- 	Pars=>'x(n); int shift(); [oca]y(n)',
+        Pars=>'x(n); indx shift(); [oca]y(n)',
         DefaultFlow => 1,
         Reversible => 1,
         Code=>'
-        int i,j;
-        int n_size = $SIZE(n);
-	if (n_size == 0)
+        PDL_Indx i,j;
+        PDL_Indx n_size = $SIZE(n);
+        if (n_size == 0)
           barf("can not shift zero size piddle (n_size is zero)");
         j = ($shift()) % n_size;
         if (j < 0)
@@ -2303,8 +2417,8 @@ EOD
             $y(n=>j) = $x(n=>i);
         }',
         BackCode=>'
-        int i,j;
-        int n_size = $SIZE(n);
+        PDL_Indx i,j;
+        PDL_Indx n_size = $SIZE(n);
         j = ($shift()) % n_size;
         if (j < 0)
                 j += n_size;
@@ -2322,8 +2436,8 @@ EOD
 =cut
 
 pp_def(
-	'threadI',
-	Doc => <<'EOD',
+        'threadI',
+        Doc => <<'EOD',
 =for ref
 
 internal
@@ -2337,86 +2451,86 @@ Put some dimensions to a threadid.
 =cut
 
 EOD
-	P2Child => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	DefaultFlow => 1,
-	Reversible => 1,
-	AffinePriv => 1,
-	CallCopy => 0,  # Don't CallCopy for subclassed objects because PDL::Copy calls ThreadI
-			#  (Wouldn't cause recursive loop otherwise)
-	OtherPars => 'int id; SV *list',
-	Comp => 'int id; int nwhichdims; PDL_Long whichdims[$COMP(nwhichdims)];
-			int nrealwhichdims; ',
-	MakeComp => '
-		int i,j;
-		PDL_Long *tmp= PDL->packdims(list,&($COMP(nwhichdims)));
-		$DOCOMPDIMS();
-		for(i=0; i<$COMP(nwhichdims); i++)
-			$COMP(whichdims)[i] = tmp[i];
-		$COMP(nrealwhichdims) = 0;
-		for(i=0; i<$COMP(nwhichdims); i++) {
-			for(j=i+1; j<$COMP(nwhichdims); j++)
-				if($COMP(whichdims[i]) == $COMP(whichdims[j]) &&
-				   $COMP(whichdims[i]) != -1) {
-				$CROAK("Thread: duplicate arg %d %d %d",
-					i,j,$COMP(whichdims[i]));
-			}
-			if($COMP(whichdims)[i] != -1) {
-				$COMP(nrealwhichdims) ++;
-			}
-		}
-		$COMP(id) = id;
-		',
-	RedoDims => '
-		int nthc,i,j,flag;
-		$SETNDIMS($PARENT(ndims));
-		$DOPRIVDIMS();
-		$PRIV(offs) = 0;
-		nthc=0;
-		for(i=0; i<$PARENT(ndims); i++) {
-			flag=0;
-			if($PARENT(nthreadids) > $COMP(id) && $COMP(id) >= 0 &&
-			   i == $PARENT(threadids[$COMP(id)])) {
-			   nthc += $COMP(nwhichdims);
-			}
-			for(j=0; j<$COMP(nwhichdims); j++) {
-				if($COMP(whichdims[j] == i)) {flag=1; break;}
-			}
-			if(flag) {
-				continue;
-			}
-			$CHILD(dims[nthc]) = $PARENT(dims[i]);
-			$PRIV(incs[nthc]) = $PARENT(dimincs[i]);
-			nthc++;
-		}
-		for(i=0; i<$COMP(nwhichdims); i++) {
-			int cdim,pdim;
-			cdim = i +
-			 ($PARENT(nthreadids) > $COMP(id) && $COMP(id) >= 0?
-			  $PARENT(threadids[$COMP(id)]) : $PARENT(ndims))
-			  - $COMP(nrealwhichdims);
-			pdim = $COMP(whichdims[i]);
-			if(pdim == -1) {
-				$CHILD(dims[cdim]) = 1;
-				$PRIV(incs[cdim]) = 0;
-			} else {
-				$CHILD(dims[cdim]) = $PARENT(dims[pdim]);
-				$PRIV(incs[cdim]) = $PARENT(dimincs[pdim]);
-			}
-		}
-		$SETDIMS();
-		PDL->reallocthreadids($CHILD_PTR(),
-			($PARENT(nthreadids)<=$COMP(id) ?
-				$COMP(id)+1 : $PARENT(nthreadids)));
-		for(i=0; i<$CHILD(nthreadids); i++) {
-			$CHILD(threadids[i]) =
-			 ($PARENT(nthreadids) > i ?
-			  $PARENT(threadids[i]) : $PARENT(ndims)) +
-			 (i <= $COMP(id) ? - $COMP(nrealwhichdims) :
-			  $COMP(nwhichdims) - $COMP(nrealwhichdims));
-		}
-		$CHILD(threadids[$CHILD(nthreadids)]) = $CHILD(ndims);
-		',
+        DefaultFlow => 1,
+        Reversible => 1,
+        AffinePriv => 1,
+        CallCopy => 0,  # Don't CallCopy for subclassed objects because PDL::Copy calls ThreadI
+                        #  (Wouldn't cause recursive loop otherwise)
+        OtherPars => 'int id; SV *list',
+        Comp => 'int id; int nwhichdims; int whichdims[$COMP(nwhichdims)];
+                        int nrealwhichdims; ',
+        MakeComp => '
+                int i,j;
+                PDL_Indx *tmp= PDL->packdims(list,&($COMP(nwhichdims)));
+                $DOCOMPDIMS();
+                for(i=0; i<$COMP(nwhichdims); i++)
+                        $COMP(whichdims)[i] = tmp[i];
+                $COMP(nrealwhichdims) = 0;
+                for(i=0; i<$COMP(nwhichdims); i++) {
+                        for(j=i+1; j<$COMP(nwhichdims); j++)
+                                if($COMP(whichdims[i]) == $COMP(whichdims[j]) &&
+                                   $COMP(whichdims[i]) != -1) {
+                                $CROAK("Thread: duplicate arg %d %d %d",
+                                        i,j,$COMP(whichdims[i]));
+                        }
+                        if($COMP(whichdims)[i] != -1) {
+                                $COMP(nrealwhichdims) ++;
+                        }
+                }
+                $COMP(id) = id;
+                ',
+        RedoDims => '
+                int nthc,i,j,flag;
+                $SETNDIMS($PARENT(ndims));
+                $DOPRIVDIMS();
+                $PRIV(offs) = 0;
+                nthc=0;
+                for(i=0; i<$PARENT(ndims); i++) {
+                        flag=0;
+                        if($PARENT(nthreadids) > $COMP(id) && $COMP(id) >= 0 &&
+                           i == $PARENT(threadids[$COMP(id)])) {
+                           nthc += $COMP(nwhichdims);
+                        }
+                        for(j=0; j<$COMP(nwhichdims); j++) {
+                                if($COMP(whichdims[j] == i)) {flag=1; break;}
+                        }
+                        if(flag) {
+                                continue;
+                        }
+                        $CHILD(dims[nthc]) = $PARENT(dims[i]);
+                        $PRIV(incs[nthc]) = $PARENT(dimincs[i]);
+                        nthc++;
+                }
+                for(i=0; i<$COMP(nwhichdims); i++) {
+                        int cdim,pdim;
+                        cdim = i +
+                         ($PARENT(nthreadids) > $COMP(id) && $COMP(id) >= 0?
+                          $PARENT(threadids[$COMP(id)]) : $PARENT(ndims))
+                          - $COMP(nrealwhichdims);
+                        pdim = $COMP(whichdims[i]);
+                        if(pdim == -1) {
+                                $CHILD(dims[cdim]) = 1;
+                                $PRIV(incs[cdim]) = 0;
+                        } else {
+                                $CHILD(dims[cdim]) = $PARENT(dims[pdim]);
+                                $PRIV(incs[cdim]) = $PARENT(dimincs[pdim]);
+                        }
+                }
+                $SETDIMS();
+                PDL->reallocthreadids($CHILD_PTR(),
+                        ($PARENT(nthreadids)<=$COMP(id) ?
+                                $COMP(id)+1 : $PARENT(nthreadids)));
+                for(i=0; i<$CHILD(nthreadids); i++) {
+                        $CHILD(threadids[i]) =
+                         ($PARENT(nthreadids) > i ?
+                          $PARENT(threadids[i]) : $PARENT(ndims)) +
+                         (i <= $COMP(id) ? - $COMP(nrealwhichdims) :
+                          $COMP(nwhichdims) - $COMP(nrealwhichdims));
+                }
+                $CHILD(threadids[$CHILD(nthreadids)]) = $CHILD(ndims);
+                ',
 );
 
 
@@ -2426,25 +2540,25 @@ EOD
 # we don't really need this one since it can be achieved with
 # a ->threadI(-1,[])
 pp_def('identvaff',
-	P2Child => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	DefaultFlow => 1,
-	Reversible => 1,
-	AffinePriv => 1,
-	RedoDims => '
-		int i;
-		$SETNDIMS($PARENT(ndims));
-		$DOPRIVDIMS();
-		$PRIV(offs) = 0;
-		for(i=0; i<$PARENT(ndims); i++) {
-			$CHILD(dims[i]) = $PARENT(dims[i]);
-			$PRIV(incs[i]) = $PARENT(dimincs[i]);
-		}
-		$SETDIMS();
-		$SETDELTATHREADIDS(0);
-		$CHILD(threadids[$CHILD(nthreadids)]) = $CHILD(ndims);
-		',
-	Doc => <<'EOD',
+        DefaultFlow => 1,
+        Reversible => 1,
+        AffinePriv => 1,
+        RedoDims => '
+                int i;
+                $SETNDIMS($PARENT(ndims));
+                $DOPRIVDIMS();
+                $PRIV(offs) = 0;
+                for(i=0; i<$PARENT(ndims); i++) {
+                        $CHILD(dims[i]) = $PARENT(dims[i]);
+                        $PRIV(incs[i]) = $PARENT(dimincs[i]);
+                }
+                $SETDIMS();
+                $SETDELTATHREADIDS(0);
+                $CHILD(threadids[$CHILD(nthreadids)]) = $CHILD(ndims);
+                ',
+        Doc => <<'EOD',
 =for ref
 
 A vaffine identity transformation (includes thread_id copying).
@@ -2459,8 +2573,8 @@ EOD
 =cut
 
 pp_def(
-	'unthread',
-	Doc => <<'EOD',
+        'unthread',
+        Doc => <<'EOD',
 =for ref
 
 All threaded dimensions are made real again.
@@ -2468,31 +2582,31 @@ All threaded dimensions are made real again.
 See [TBD Doc] for details and examples.
 =cut
 EOD
-	P2Child => 1,
+        P2Child => 1,
         NoPdlThread => 1,
-	DefaultFlow => 1,
-	Reversible => 1,
-	AffinePriv => 1,
-	OtherPars => 'int atind;',
-	RedoDims => '
-		int i;
-		$SETNDIMS($PARENT(ndims));
-		$DOPRIVDIMS();
-		$PRIV(offs) = 0;
-		for(i=0; i<$PARENT(ndims); i++) {
-			int corc;
-			if(i<$COMP(atind)) {
-				corc = i;
-			} else if(i < $PARENT(threadids[0])) {
-				corc = i + $PARENT(ndims)-$PARENT(threadids[0]);
-			} else {
-				corc = i - $PARENT(threadids[0]) + $COMP(atind);
-			}
-			$CHILD(dims[corc]) = $PARENT(dims[i]);
-			$PRIV(incs[corc]) = $PARENT(dimincs[i]);
-		}
-		$SETDIMS();
-	',
+        DefaultFlow => 1,
+        Reversible => 1,
+        AffinePriv => 1,
+        OtherPars => 'int atind;',
+        RedoDims => '
+                int i;
+                $SETNDIMS($PARENT(ndims));
+                $DOPRIVDIMS();
+                $PRIV(offs) = 0;
+                for(i=0; i<$PARENT(ndims); i++) {
+                        int corc;
+                        if(i<$COMP(atind)) {
+                                corc = i;
+                        } else if(i < $PARENT(threadids[0])) {
+                                corc = i + $PARENT(ndims)-$PARENT(threadids[0]);
+                        } else {
+                                corc = i - $PARENT(threadids[0]) + $COMP(atind);
+                        }
+                        $CHILD(dims[corc]) = $PARENT(dims[i]);
+                        $PRIV(incs[corc]) = $PARENT(dimincs[i]);
+                }
+                $SETDIMS();
+        ',
 );
 
 
@@ -2514,7 +2628,7 @@ figure it out each time!
 
 This method is similar in functionality to the L<slice|/slice>
 method, but L<slice|/slice> requires that contiguous ranges or ranges
-with constant offset be extracted. ( i.e. L<slice|/slice> requires 
+with constant offset be extracted. ( i.e. L<slice|/slice> requires
 ranges of the form C<1,2,3,4,5> or C<2,4,6,8,10>). Because of this
 restriction, L<slice|/slice> is more memory efficient and slightly faster
 than dice
@@ -2525,13 +2639,13 @@ than dice
 
 The arguments to dice are arrays (or 1D PDLs) for each dimension
 in the PDL. These arrays are used as indexes to which rows/columns/cubes,etc
-to dice-out (or extract) from the C<$data> PDL. 
+to dice-out (or extract) from the C<$data> PDL.
 
 Use C<X> to select all indices along a given dimension (compare also
 L<mslice|PDL::Core/mslice>). As usual (in slicing methods) trailing
 dimensions can be omitted implying C<X>'es for those.
 
-=for example 
+=for example
 
  pdl> $a = sequence(10,4)
  pdl> p $a
@@ -2564,32 +2678,32 @@ slice change the parent (use the C<.=> operator).
 
 =cut
 
-sub PDL::dice { 
-
-	my $self = shift;
-	my @dim_indexes = @_;  # array of dimension indexes
-	
-	# Check that the number of dim indexes <=
-	#    number of dimensions in the PDL
-	my $no_indexes = scalar(@dim_indexes);
-	my $noDims = $self->getndims;
-	barf("PDL::dice: Number of index arrays ($no_indexes) not equal to the dimensions of the PDL ($noDims")
-			 if $no_indexes > $noDims;
-	my $index;
-	my $pdlIndex;
-	my $outputPDL=$self;
-	my $indexNo = 0;
-
-	# Go thru each index array and dice the input PDL:
-	foreach $index(@dim_indexes){
-		$outputPDL = $outputPDL->dice_axis($indexNo,$index)
-			unless !ref $index && $index eq 'X';
-
-		$indexNo++;
-	}
-
-	return $outputPDL;
-}  
+sub PDL::dice {
+
+        my $self = shift;
+        my @dim_indexes = @_;  # array of dimension indexes
+
+        # Check that the number of dim indexes <=
+        #    number of dimensions in the PDL
+        my $no_indexes = scalar(@dim_indexes);
+        my $noDims = $self->getndims;
+        barf("PDL::dice: Number of index arrays ($no_indexes) not equal to the dimensions of the PDL ($noDims")
+                         if $no_indexes > $noDims;
+        my $index;
+        my $pdlIndex;
+        my $outputPDL=$self;
+        my $indexNo = 0;
+
+        # Go thru each index array and dice the input PDL:
+        foreach $index(@dim_indexes){
+                $outputPDL = $outputPDL->dice_axis($indexNo,$index)
+                        unless !ref $index && $index eq 'X';
+
+                $indexNo++;
+        }
+
+        return $outputPDL;
+}
 *dice = \&PDL::dice;
 
 
@@ -2641,84 +2755,809 @@ slice change the parent.
 
 =cut
 
-sub PDL::dice_axis { 
+sub PDL::dice_axis {
   my($self,$axis,$idx) = @_;
-  
+
   # Convert to PDLs: array refs using new, otherwise use topdl:
   my $ix = (ref($idx) eq 'ARRAY') ? ref($self)->new($idx) : ref($self)->topdl($idx);
   my $n = $self->getndims;
   my $a = $ix->getndims;
   barf("index_axis: index must be <=1D") if $a>1;
-  for ($a..$n-1) {
-     $ix = $ix->dummy(0);
-  }
-  	
-  return $self->mv($axis,0)->index($ix)->mv($n-1,$axis);
-}  
+  return $self->mv($axis,0)->index1d($ix)->mv(0,$axis);
+}
 *dice_axis = \&PDL::dice_axis;
 
 
 EOD
 
-pp_done();
-__DATA__
+pp_addpm(<<'EOD-slice');
 
-# A very useful transformation for e.g. axis values: hexagonal
-# arrays can be made like this.
+=head2 slice
 
-if(0) {
-deftrans(
-	Name => 'repeat',
-	Pars => 'int whichind, int howmany',
-	MakeComp => '
-		$COMP(howmany) = howmany;
-		$COMP(whichind) = whichind;
-		$SETREVERSIBLE($COMP(howmany)==1);
-		',
-	Dims => '
-		$SETNDIMS($PARENT(ndims));
-		LOOPDIMS %{
-			$CHILD(dims[$DIM]) = $PARENT(dims[$DIM]);
-		%}
-		$CHILD(dims[$COMP(whichind)]) *= $PRIV(howmany);
-		$SETDIMS();
-		',
-	ParentInds =>
-		'$COPYINDS();
-		 $PARENTINDS($COMP(whichind)) %= $PARENT(dims[$PRIV(whichind)]);',
-	Print => 'printf("REPEAT: %d, %d\n",
-			$COMP(whichind), $COMP(howmany));'
-);
+=for usage
+
+  $slice = $data->slice([2,3],'x',[2,2,0],"-1:1:-1", "*3");
+
+=for ref
+
+Extract rectangular slices of a piddle, from a string specifier,
+an array ref specifier, or a combination.
+
+C<slice> is the main method for extracting regions of PDLs and
+manipulating their dimensionality.  You can call it directly or
+via he L<NiceSlice|PDL::NiceSlice> source prefilter that extends
+Perl syntax o include array slicing.
+
+C<slice> can extract regions along each dimension of a source PDL,
+subsample or reverse those regions, dice each dimension by selecting a
+list of locations along it, or basic PDL indexing routine.  The
+selected subfield remains connected to the original PDL via dataflow.
+In most cases this neither allocates more memory nor slows down
+subsequent operations on either of the two connected PDLs.
+
+You pass in a list of arguments.  Each term in the list controls
+the disposition of one axis of the source PDL and/or returned PDL.
+Each term can be a string-format cut specifier, a list ref that
+gives the same information without recourse to string manipulation,
+or a PDL with up to 1 dimension giving indices along that axis that
+should be selected.
+
+If you want to pass in a single string specifier for the entire
+operation, you can pass in a comma-delimited list as the first
+argument.  C<slice> detects this condition and splits the string
+into a regular argument list.  This calling style is fully
+backwards compatible with C<slice> calls from before PDL 2.006.
+
+B<STRING SYNTAX>
+
+If a particular argument to C<slice> is a string, it is parsed as a
+selection, an affine slice, or a dummy dimension depending on the
+form.  Leading or trailing whitespace in any part of each specifier is
+ignored (though it is not ignored within numbers).
+
+=over 3
+
+=item C<<  >>, C<< : >>, or C<< X >> -- keep
+
+The empty string, C<:>, or C<X> cause the entire corresponding
+dimension to be kept unchanged.
+
+
+=item C<< <n> >> -- selection
+
+A single number alone causes a single index to be selected from the
+corresponding dimension.  The dimension is kept (and reduced to size
+1) in the output.
+
+=item C<< (<n>) >> -- selection and collapse
+
+A single number in parenthesis causes a single index to be selected
+from the corresponding dimension.  The dimension is discarded
+(completely eliminated) in the output.
+
+=item C<< <n>:<m> >> -- select an inclusive range
+
+Two numbers separated by a colon selects a range of values from the
+corresponding axis, e.g. C<< 3:4 >> selects elements 3 and 4 along the
+corresponding axis, and reduces that axis to size 2 in the output.
+Both numbers are regularized so that you can address the last element
+of the axis with an index of C< -1 >.  If, after regularization, the
+two numbers are the same, then exactly one element gets selected (just
+like the C<< <n> >> case).  If, after regulariation, the second number
+is lower than the first, then the resulting slice counts down rather
+than up -- e.g. C<-1:0> will return the entire axis, in reversed
+order.
+
+=item C<< <n>:<m>:<s> >> -- select a range with explicit step
+
+If you include a third parameter, it is the stride of the extracted
+range.  For example, C<< 0:-1:2 >> will sample every other element
+across the complete dimension.  Specifying a stride of 1 prevents
+autoreversal -- so to ensure that your slice is *always* forward
+you can specify, e.g., C<< 2:$n:1 >>.  In that case, an "impossible"
+slice gets an Empty PDL (with 0 elements along the corresponding
+dimension), so you can generate an Empty PDL with a slice of the
+form C<< 2:1:1 >>.
+
+=item C<< *<n> >> -- insert a dummy dimension
+
+Dummy dimensions aren't present in the original source and are
+"mocked up" to match dimensional slots, by repeating the data
+in the original PDL some number of times.  An asterisk followed
+by a number produces a dummy dimension in the output, for
+example C<< *2 >> will generate a dimension of size 2 at
+the corresponding location in the output dim list.  Omitting
+the numeber (and using just an asterisk) inserts a dummy dimension
+of size 1.
+
+=back
+
+B<ARRAY REF SYNTAX>
+
+If you feed in an ARRAY ref as a slice term, then it can have
+0-3 elements.  The first element is the start of the slice along
+the corresponding dim; the second is the end; and the third is
+the stepsize.  Different combinations of inputs give the same
+flexibility as the string syntax.
+
+=over 3
+
+=item C<< [] >> - keep dim intact
+
+An empty ARRAY ref keeps the entire corresponding dim
+
+=item C<< [ 'X' ] >> - keep dim intact
+
+=item C<< [ '*',$n ] >> - generate a dummy dim of size $n
+
+If $n is missing, you get a dummy dim of size 1.
+
+=item C<< [ $dex, , 0 ] >> - collapse and discard dim
+
+C<$dex> must be a single value.  It is used to index
+the source, and the corresponding dimension is discarded.
+
+=item C<< [ $start, $end ] >> - collect inclusive slice
+
+In the simple two-number case, you get a slice that runs
+up or down (as appropriate) to connect $start and $end.
+
+=item C<< [ $start, $end, $inc ] >> - collect inclusive slice
+
+The three-number case works exactly like the three-number
+string case above.
+
+=back
+
+B<PDL args for dicing>
+
+If you pass in a 0- or 1-D PDL as a slicing argument, the
+corresponding dimension is "diced" -- you get one position
+along the corresponding dim, per element of the indexing PDL,
+e.g. C<< $a->slice( pdl(3,4,9)) >> gives you elements 3, 4, and
+9 along the 0 dim of C<< $a >>.
+
+Because dicing is not an affine transformation, it is slower than
+direct slicing even though the syntax is convenient.
+
+
+=for example
+
+ $a->slice('1:3');  #  return the second to fourth elements of $a
+ $a->slice('3:1');  #  reverse the above
+ $a->slice('-2:1'); #  return last-but-one to second elements of $a
+
+ $a->slice([1,3]);  # Same as above three calls, but using array ref syntax
+ $a->slice([3,1]);
+ $a->slice([-2,1]);
+
+=cut
+
+
+##############################
+# 'slice' is now implemented as a small Perl wrapper around
+# a PP call.  This permits unification of the former slice,
+# dice, and nslice into a single call.  At the moment, dicing
+# is implemented a bit kludgily (it is detected in the Perl
+# front-end), but it is serviceable.
+#  --CED 12-Sep-2013
+
+*slice = \&PDL::slice;
+sub PDL::slice (;@) {
+    my ($source, @others) = @_;
+
+    # Deal with dicing.  This is lame and slow compared to the
+    # faster slicing, but works okay.  It uses the same technique
+    # as dice_axis().
+
+    for my $i(0..$#others) {
+      if( ref $others[$i] eq 'PDL' ) {
+        my $idx = $others[$i];
+        if($idx->ndims > 1) {
+          barf("slice: dicing parameters must be at most 1D (arg $i)\n");
+        }
+        my $nlm = $idx->nelem;
+        if($nlm > 1) {
+           my $n = $source->getndims;
+           $source = $source->mv($i,0)->index1d($idx)->mv(0,$i);
+           $others[$i] = '';
+        } elsif($nlm) {
+           # One element - convert to a regular slice.
+           $others[$i] = $idx->flat->at(0);
+        } else {
+           # Zero elements -- force an extended empty.
+           $others[$i] = "1:0:1";
+        }
+      }
+    }
+
+    PDL::sliceb($source,\@others);
 }
 
-# Parent's first index is value of indices.
+EOD-slice
 
-if(0) {
-deftrans(
-	Name => 'indexed',
-	Pars => 'pdl* indices',
-	Dims => '
-		$SETNDIMS($COMP(indices)->ndims);
-		LOOPDIMS %{
-			$CHILD(dims[$DIM]) = $COMP(indices)->dims[$DIM];
-		%}
-		',
-	ParentInds =>
-		'$COPYINDS();
-		 $PARENTINDS(0) = PDL->get($COMP(indices),&($MYINDS(0)));'
-);
+pp_add_exported('', 'slice');
+
+##########
+# This is a kludge to pull arbitrary data out of a single-element PDL, using the Types.pm stuff,
+# to make it easier to slice using single-element PDL arguments inside a slice specifier.
+# The string $sliceb_data_kludge generates some code that physicalizes a PDL, ensures it has
+# only one element, and extracts that element in a type-independent manner.  It's a pain because
+# we have to generate the switch statement using information in the Config typehash.  But it saves
+# time compared to parsing out any passed-in PDLs on the Perl side.
+#
+use PDL::Types;
+$sliceb_data_kludge = <<'KLUDGE';
+    { pdl *p = PDL->SvPDLV( *svp );
+      int i;
+      PDL->make_physical(p);
+      if(p->nvals==0)
+        barf("slice: empty PDL in slice specifier");
+      if(p->nvals > 1)
+        barf("slice: multi-element PDL in slice specifier");
+      if( !(p->data) ) {
+         barf("slice: no data in slice specifier PDL! I give up.");
+      }
+      switch( p->datatype ) {
+KLUDGE
+
+for my $type(keys %PDL::Types::typehash) {
+    $sliceb_data_kludge .=
+"        case $type: nn = *( ($PDL::Types::typehash{$type}->{realctype} *)(p->data) ); break;\n";
 }
 
+$sliceb_data_kludge .= <<'KLUDGE';
+         default: barf("Unknown PDL type in slice specifier!  This should never happen."); break;
+      }
+    }
+KLUDGE
+
+
+##############################
+# sliceb is the core of slice.  The "foo/foob" nomenclature is used to avoid the argument
+# counting inherent in a PP PMCode section -- "slice" is a front-end that just rolls up a
+# whole variable-length argument list into a single AV reference.
+#
+# (The real reason for foo/foob architecture, as with range/rangeb, is that I'm too stoopid to figure
+# out how to make the PMCode+Code hack work with PP for dataflow operators... --CED)
+#
+
+pp_def(
+        'sliceb',
+        P2Child => 1,
+        NoPdlThread => 1,
+        DefaultFlow => 1,
+        OtherPars => 'SV *args;',
+#
+# Comp stash definitions:
+#  nargs - number of args in original call
+#  odim[]   - maps argno to output dim (or -1 for squished dims)
+#  idim[]   - maps argno to input dim  (or -1 for squished dims)
+#  odim_top - one more than the highest odim encountered
+#  idim_top - one more than the highest idim encountered
+#  start[]  - maps argno to start index of slice range (inclusive)
+#  inc[]    - maps argno to increment of slice range
+#  end[]    - maps argno to end index of slice range (inclusive)
+#
+        Comp => 'int nargs;
+                 int odim[$COMP(nargs)];
+                 int idim[$COMP(nargs)];
+                 int idim_top;
+                 int odim_top;
+                 PDL_Indx start[$COMP(nargs)];
+                 PDL_Indx inc[$COMP(nargs)];
+                 PDL_Indx end[$COMP(nargs)];
+                 ',
+        AffinePriv => 1,
+        MakeComp => <<'SLICE-MC'
+                int i;
+                int idim;
+                int odim;
+                int imax;
+                int nargs;
+                AV *arglist;
+
+                /*** Make sure we got an array ref as input and turn it into an AV ***/
+                if(!(  args   &&
+                       SvROK(args)   &&
+                       SvTYPE(SvRV(args))==SVt_PVAV  )){
+                     barf("slice requires an ARRAY ref containing zero or more arguments");
+                }
+
+                arglist = (AV *)(SvRV(args));
+
+                /* Detect special case of a single comma-delimited string; in that case, */
+                /* split out our own arglist */
+
+                if( (av_len(arglist) == 0) ) {
+                  /* single-element list: pull first element */
+                  SV **svp;
+                  svp = av_fetch(arglist, 0, 0);
+
+                  if(svp && *svp && *svp != &PL_sv_undef && SvPOKp(*svp)) {
+
+                    /* The element exists and is not undef and has a cached string value */
+                    char *s,*ss;
+                    s = ss = SvPVbyte_nolen(*svp);
+                    for(;  *ss && *ss != ',';  ss++) {}
+
+                    if(*ss == ',') {
+
+                      /* the string contains at least one comma.  ATTACK!    */
+                      /* We make a temporary array and populate it with      */
+                      /* SVs containing substrings -- basically split(/\,/), */
+                      /* but without the overhead of a perl call             */
+
+                      AV *al = (AV *)sv_2mortal((SV *)(newAV()));
+
+                      do {
+                        SV *sv;
+                        char *s1;
+                        for(s1=s; *s1 && *s1 != ','; s1++);
+
+                        av_push(al, newSVpvn(s, s1-s));
+                        if(*s1==',')
+                          s = ++s1;
+                        else
+                          s = s1;
+                      } while(*s);
+
+                      arglist = al;  /* al is ephemeral and will evaporate at the next perl gc */
+
+                    } /* end of contains-comma case */
+                  } /* end of nontrivial single-element detection */
+                }/* end of single-element detection */
+
+                nargs = $COMP(nargs) = av_len( arglist ) + 1;
+                $DOCOMPDIMS();
+
+                /**********************************************************************/
+                /**** Loop over the elements of the AV input and parse into values ****/
+                /**** in the start/inc/end array                                   ****/
+
+                for(odim=idim=i=0; i<nargs; i++) {
+                   SV *this;
+                   SV **thisp;
+                   SV *sv, **svp;
+                   char all_flag = 0;
+                   char squish_flag = 0;
+                   char dummy_flag = 0;
+                   char *str;
+                   PDL_Indx n0 = 0;
+                   PDL_Indx n1 = -1;
+                   PDL_Indx n2 = 0;  /* n2 is inc - defaults to 0 (i.e. calc in RedoDims) */
+
+                   thisp = av_fetch( arglist, i, 0 );
+                   this = (thisp  ?  *thisp  : 0 );
+
+                   /** Keep the whole dimension if the element is undefined or missing **/
+                   all_flag = (  (!this)   ||   (this==&PL_sv_undef)  );
+
+                   if(!all_flag)   {
+                     /*
+                      * Main branch -- this element is not an empty string
+                      */
+
+                     if(SvROK(this)) {
+
+                       /*
+                        * It's a reference - it better be an array ref.
+                        * (Note: PDLs are refs too and are allowed (they cause dicing) --
+                        * but those are parsed out in the Perl-side preprocessor
+                        * (PDL::slice, declared above).
+                        */
+                       int nelem;
+                       AV *sublist;
+
+                       if( SvTYPE(SvRV(this)) != SVt_PVAV ) {
+                         barf("slice: non-ARRAY ref in the argument list!");
+                       }
+
+                       /*
+                        * It *is* an array ref!  Expand it into an AV so we can read it.
+                        */
+                       sublist = (AV *)(SvRV(this));
+                       if(!sublist) {
+                         nelem = 0;
+                       } else {
+                         nelem = av_len(sublist) + 1;
+                       }
+
+                       if(nelem > 3) {
+                         barf("slice: array refs can have at most 3 elements!");
+                       }
+
+                       if(nelem==0) {      /* No elements - keep it all */
+                         all_flag = 1;
+
+                       } else /* Got at least one element */{
+
+
+                         /* Load the first into n0 and check for dummy or all-clear */
+                         /* (if element is missing use the default value already in n0) */
+
+                         svp = av_fetch(sublist, 0, 0);
+                         if(svp && *svp && *svp != &PL_sv_undef) {
+
+			    /* There is a first element.  Check if it's a PDL, then a string, then an IV */
+
+                            if(SvROK(*svp) && sv_isa(*svp, "PDL")) {
+                              PDL_Indx nn;
+SLICE-MC
+. $sliceb_data_kludge  # Quick and dirty single-element parser (from above)
+. <<'SLICE-MC'
+                              n0 = nn;
+                            } else if( SvPOKp(*svp)) {
+
+                               /* Not a PDL but has associated string */
+
+                               char *str = SvPVbyte_nolen(*svp);
+                               switch(*str) {
+                                 case 'X':
+                                      all_flag = 1; break;
+                                 case '*':
+                                      dummy_flag = 1;
+                                      n0 = 1;         /* n0 is 1 so 2nd field is element count */
+                                      n1 = 1;         /* size defaults to 1 for dummy dims */
+                                      n2 = 1;         /* n2 is forced to 1 so ['*',0] gives an empty */
+                                      break;
+                                 default:             /* Doesn't start with '*' or 'X' */
+                                      n0 = SvIV(*svp);
+                                      n1 = n0;         /* n1 defaults to n0 if n0 is present */
+                                      break;
+                               }
+                           } else /* the element has no associated string - just parse */ {
+                                n0 = SvIV(*svp);
+                                n1 = n0;           /* n1 defaults to n0 if n0 is present */
+                           }
+                        } /* end of defined check.  if it's undef, leave the n's at their default value.
+
+
+                        /* Read the second element into n1 and check for alternate squish syntax */
+                        if( (nelem > 1) && (!all_flag) ) {
+                          svp = av_fetch(sublist, 1, 0);
+
+                          if( svp && *svp && *svp != &PL_sv_undef ) {
+
+			    if( SvROK(*svp) && sv_isa(*svp, "PDL")) {
+			      PDL_Indx nn;
+SLICE-MC
+. $sliceb_data_kludge
+. <<'SLICE-MC'
+                              n1 = nn;
+
+                            } else if( SvPOKp(*svp) ) {
+			      /* Second element has a string - make sure it's not 'X'. */
+                              char *str = SvPVbyte_nolen(*svp);
+                              if(*str == 'X') {
+                                squish_flag = 1;
+                                n1 = n0;
+                              } else {
+			        n1 = SvIV(*svp);
+			      }
+                            } else {
+			       /* Not a PDL, no string -- just get the IV */
+                               n1 = SvIV(*svp);
+                            }
+                          } /* If not defined, leave at the default */
+                        } /* End of second-element check */
+
+
+                        /*** Now try to read the third element (inc).  ***/
+                        if( (nelem > 2) && !(all_flag) && !(squish_flag) && !(dummy_flag) ) {
+                          svp = av_fetch(sublist, 2, 0);
+                          if( svp && *svp && *svp != &PL_sv_undef ) {
+
+			    if(SvROK(*svp) && sv_isa(*svp, "PDL")) {
+			      PDL_Indx nn;
+SLICE-MC
+. $sliceb_data_kludge
+. << 'SLICE-MC'
+                              n2 = nn;
+			    } else {
+                              STRLEN len;
+                              SvPV( *svp, len );
+                              if(len>0) {           /* nonzero length -> actual value given */
+                                n2 = SvIV(*svp);    /* if the step is passed in as 0, it is a squish */
+                                if(n2==0) {
+                                  n1 = n0;
+                                  squish_flag = 1;
+                                }
+                              }
+			    }
+                          } /* end of nontrivial third-element parsing */
+                        } /* end of third-element parsing  */
+                       } /* end of nontrivial sublist parsing */
+
+                     } else /* this argument is not an ARRAY ref - parse as a scalar */ {
+
+                        /****************************************************************/
+                        /*** String handling part of slice is here.  Parse out each   ***/
+                        /*** term:                                                    ***/
+                        /***   <n> (or NV) - extract one element <n> from this dim    ***/
+                        /***   <n>:<m>     - extract <n> to <m>; autoreverse if nec.  ***/
+                        /***   <n>:<m>:<s> - extract <n> to <m>, stepping by <s>      ***/
+                        /***  (<n>)        - extract element and discard this dim     ***/
+                        /***  *<n>         - insert a dummy dimension of size <n>     ***/
+                        /***  :            - keep this dim in its entirety            ***/
+                        /***  X            - keep this dim in its entirety            ***/
+                        /****************************************************************/
+
+                        if(SvPOKp(this)) {
+                          /* this argument has a cached string */
+
+                          char *s;
+                          IV len;
+                          int subargno = 0;
+                          int flagged = 0;
+                          int squish_closed = 0;
+                          char buf[161];
+                          char ii;
+                          s = SvPVbyte(this, len);
+
+                          /* Very stoopid parsing - should probably make some calls to perl string utilities... */
+                          while(*s) {
+                            if( isspace( *s ) ) {
+                              s++;  /* ignore and loop again */
+                            } else {
+                              /* not whitespace */
+
+                              switch(*(s++)) {
+                                case '*':
+                                  if(flagged || subargno)
+                                    barf("slice: Erroneous '*' (arg %d)",i);
+                                  dummy_flag = flagged = 1;
+                                  n0 = 1;  /* default this number to 1 (size 1); '*0' yields an empty */
+                                  n1 = 1;  /* no second arg allowed - default to 1 so n0 is element count */
+                                  n2 = -1; /* -1 so we count down to n1 from n0 */
+                                  break;
+
+                                case '(':
+                                  if(flagged || subargno)
+                                    barf("slice: Erroneous '(' (arg %d)",i);
+                                  squish_flag = flagged = 1;
+
+                                  break;
+
+                                case 'X': case 'x':
+                                  if(flagged || subargno > 1)
+                                    barf("slice: Erroneous 'X' (arg %d)",i);
+                                    if(subargno==0) {
+                                      all_flag = flagged = 1;
+                                    }
+                                    else /* subargno is 1 - squish */ {
+                                      squish_flag = squish_closed = flagged = 1;
+                                    }
+                                  break;
+
+                                case '+': case '-':
+                                case '0': case '1': case '2': case '3': case '4':
+                                case '5': case '6': case '7': case '8': case '9':
+                                 switch(subargno) {
+
+                                   case 0: /* first arg - change default to 1 element */
+                                           n0 = strtoll(--s, &s, 10);
+                                           n1 = n0;
+                                           if(dummy_flag) {
+                                             n0 = 1;
+                                           }
+                                           break;
+
+                                   case 1: /* second arg - parse and keep end */
+                                           n1 = strtoll(--s, &s, 10);
+                                           break;
+
+                                   case 2: /* third arg - parse and keep inc */
+                                           if( squish_flag || dummy_flag ) {
+                                            barf("slice: erroneous third field in slice specifier (arg %d)",i);
+                                           }
+                                           n2 = strtoll(--s, &s, 10);
+                                           break;
+
+                                   default: /* oops */
+                                     barf("slice: too many subargs in scalar slice specifier %d",i);
+                                     break;
+                                 }
+                                 break;
+
+                                case ')':
+                                 if( squish_closed || !squish_flag || subargno > 0) {
+                                  barf("nslice: erroneous ')' (arg %d)",i);
+                                 }
+                                 squish_closed = 1;
+                                 break;
+
+                                case ':':
+                                 if(squish_flag && !squish_closed) {
+                                   barf("slice: must close squishing parens (arg %d)",i);
+                                 }
+				 if( subargno == 0 ) {
+				   n1 = -1;   /* Set "<n>:" default to get the rest of the range */
+				 }
+                                 if( subargno > 1 ) {
+                                   barf("slice: too many ':'s in scalar slice specifier %d",i);
+                                 }
+                                 subargno++;
+                                 break;
+
+                                case ',':
+                                 barf("slice: ','  not allowed (yet) in scalar slice specifiers!");
+                                 break;
+
+                                default:
+                                 barf("slice: unexpected '%c' in slice specifier (arg %d)",*s,i);
+                                 break;
+                              }
+                            } /* end of conditional in parse loop */
+
+                          } /* end of parse loop */
+
+                        } else /* end of string parsing */ {
+
+                          /* Simplest case -- there's no cached string, so it   */
+                          /* must be a number.  In that case it's a simple      */
+                          /* extraction.  Treated as a separate case for speed. */
+                          n0 = SvNV(this);
+                          n1 = SvNV(this);
+                          n2 = 0;
+                        }
+
+                     } /* end of scalar handling */
+
+                  } /* end of defined-element handling (!all_flag) */
+
+                  if( (!all_flag) + (!squish_flag) + (!dummy_flag) < 2 ) {
+                    barf("Looks like you triggered a bug in  slice.  two flags set in dim %d",i);
+                  }
+
+                  /* Force all_flag case to be a "normal" slice */
+                  if(all_flag) {
+                    n0 = 0;
+                    n1 = -1;
+                    n2 = 1;
+                  }
+
+                  /* Copy parsed values into the limits */
+                  $COMP(start[i]) = n0;
+                  $COMP(end[i])   = n1;
+                  $COMP(inc[i])   = n2;
+
+                  /* Deal with dimensions */
+                  if(squish_flag) {
+                    $COMP(odim[i]) = -1;
+                  } else {
+                    $COMP(odim[i]) = odim++;
+                  }
+                  if(dummy_flag) {
+                    $COMP(idim[i]) = -1;
+                  } else {
+                    $COMP(idim[i]) = idim++;
+                  }
+
+                } /* end of arg-parsing loop */
+
+                $COMP(idim_top) = idim;
+                $COMP(odim_top) = odim;
+
+                $SETREVERSIBLE(1);
+
+             /*** End of MakeComp for slice       */
+             /****************************************/
+SLICE-MC
+           ,
+           RedoDims => q{
+                  int o_ndims_extra = 0;
+                  PDL_Indx i;
+
+                  if( $COMP(idim_top) < $PARENT(ndims) ) {
+                    o_ndims_extra = $PARENT(ndims) - $COMP(idim_top);
+                  }
+
+                  /* slurped dims from the arg parsing, plus any extra thread dims */
+                  $SETNDIMS( $COMP(odim_top) + o_ndims_extra );
+                  $DOPRIVDIMS();
+                  $PRIV(offs) = 0;  /* Offset vector to start of slice */
+
+                  for(i=0; i<$COMP(nargs); i++) {
+                      PDL_Indx start, end;
+
+                      /** Belt-and-suspenders **/
+                      if( ($COMP(idim[i]) < 0)  && ($COMP(odim[i]) < 0)  ) {
+                        PDL->changed($CHILD_PTR(), PDL_PARENTDIMSCHANGED, 0);
+                        barf("slice: Hmmm, both dummy and squished -- this can never happen.  I quit.");
+                      }
+
+                      /** First handle dummy dims since there's no input from the parent **/
+                      if( $COMP(idim[i]) < 0 ) {
+                         /* dummy dim - offset or diminc. */
+                         $CHILD( dims[ $COMP(odim[i]) ] ) = $COMP(end[i]) - $COMP(start[i]) + 1;
+                         $PRIV( incs[ $COMP(odim[i]) ] ) = 0;
+                      } else {
+                        PDL_Indx pdsize;
+
+                        /** This is not a dummy dim -- deal with a regular slice along it.     **/
+                        /** Get parent dim size for this idim, and/or allow permissive slicing **/
+
+                        if( $COMP(idim[i]) < $PARENT(ndims)) {
+                          pdsize = $PARENT( dims[$COMP(idim[i])] );
+                        } else {
+                          pdsize = 1;
+                        }
+
+                        /** Regularize and bounds-check the start location **/
+                        start = $COMP(start[i]);
+                        if(start < 0)
+                          start += pdsize;
+                        if( (start < 0) || (start >= pdsize) ) {
+                          PDL->changed($CHILD_PTR(), PDL_PARENTDIMSCHANGED, 0);
+                          if(i >= $PARENT( ndims )) {
+                            barf("slice: slice has too many dims (indexes dim %d; highest is %d)",i,$PARENT( ndims )-1);
+                          } else {
+                            barf("slice: slice starts out of bounds in pos %d (start is %d; source dim %d runs 0-%d)",i,start,$COMP(idim[i]),pdsize-1);
+                          }
+                        }
+
+                        if( $COMP(odim[i]) < 0) {
+
+                         /* squished dim - just update the offset. */
+                         /* start is always defined and regularized if we are here here, since */
+                         /* both idim[i] and odim[i] can't be <0 */
+
+                         $PRIV(offs) += start * $PARENT( dimincs[ $COMP(idim[i]) ] );
+
+                        } else /* normal operation */ {
+                          PDL_Indx siz;
+                          PDL_Indx inc;
+
+                          /** Regularize and bounds-check the end location **/
+                          end = $COMP(end[i]);
+                          if(end<0)
+                            end += pdsize;
+                          if( (end < 0) || (end >= pdsize) ) {
+                            PDL->changed($CHILD_PTR(), PDL_PARENTDIMSCHANGED, 0);
+                            barf("slice: slice ends out of bounds in pos %d (end is %d; source dim %d runs 0-%d)",i,end,$COMP(idim[i]),pdsize-1);
+                          }
+
+                          /* regularize inc */
+
+                          inc = $COMP(inc[i]);
+                          if(!inc)
+                            inc = (start <= end) ? 1 : -1;
+
+                          siz = (end - start + inc) / inc ;
+                          if(siz<0)
+                            siz=0;
+                          $CHILD( dims[ $COMP(odim[i]) ] ) = siz;
+                          $PRIV(  incs[ $COMP(odim[i]) ] ) = $PARENT( dimincs[ $COMP(idim[i]) ] ) * inc;
+                          $PRIV(offs) += start * $PARENT( dimincs[ $COMP(idim[i]) ] );
+                        } /* end of normal slice case */
+                      } /* end of non-dummy slice case */
+                  } /* end of nargs loop */
+
+                  /* Now fill in thread dimensions as needed.  idim and odim persist from the parsing loop */
+                  /* up above. */
+                  for(i=0; i<o_ndims_extra; i++) {
+                    $CHILD( dims   [ $COMP(odim_top) + i ] ) = $PARENT( dims   [ $COMP(idim_top) + i ] );
+                    $PRIV( incs[ $COMP(odim_top) + i ] ) = $PARENT( dimincs[ $COMP(idim_top) + i ] );
+                  }
+
+                $SETDIMS();
+
+        } # end of RedoDims for slice
+);
+
+
 pp_addpm({At => 'Bot'},<< 'EOD');
 
-=head1 BUGS 
+=head1 BUGS
 
-For the moment, you can't slice the empty piddle.  This should probably
-change:  slices of the empty piddle should probably return the empty piddle.
+For the moment, you can't slice one of the zero-length dims of an
+empty piddle.  It is not clear how to implement this in a way that makes
+sense.
 
 Many types of index errors are reported far from the indexing
 operation that caused them.  This is caused by the underlying architecture:
-slice() sets up a mapping between variables, but that mapping isn't 
+slice() sets up a mapping between variables, but that mapping isn't
 tested for correctness until it is used (potentially much later).
 
 =head1 AUTHOR
@@ -2735,3 +3574,6 @@ the copyright notice should be included in the file.
 =cut
 
 EOD
+
+
+pp_done();
@@ -3,14 +3,15 @@
 use Filter::Simple;
 
 FILTER_ONLY
+   all => sub { s/\r\n/\n/g if $^V lt v5.14.0 and $^O eq 'MSWin32'; },
    code_no_comments =>
-   # all =>
       sub {
       my ($text1,$text2) = ($_,'');
       ## print STDERR "**************** Input: \n$text1\n";
       $text2 = perldlpp('PDL::NiceSlice', $text1);
       ## print STDERR "**************** Output: $text2\n";
       $_ = $text2;
-   };
+   },
+   all => sub { print if $PDL::NiceSlice::debug_filter };
 
 1;
@@ -7,11 +7,12 @@ WriteMakefile(
       'NiceSlice.pm' => '$(INST_LIBDIR)/NiceSlice.pm',
       'FilterUtilCall.pm' => '$(INST_LIBDIR)/NiceSlice/FilterUtilCall.pm',
       'FilterSimple.pm' => '$(INST_LIBDIR)/NiceSlice/FilterSimple.pm',
+      'ModuleCompile.pm' => '$(INST_LIBDIR)/NiceSlice/ModuleCompile.pm',
    },
    PREREQ_PM => {
       Filter::Util::Call => 0,
       Text::Balanced => 0,
-      PDL => 2.3,
+      PDL => 2.003000,
    },
 );
 
@@ -0,0 +1,11 @@
+## package Foo;
+use Module::Compile -base;
+
+sub pmc_compile {
+    my ($class, $source) = @_;
+    # Convert $source into (most likely Perl 5) $compiled_output
+    my $filtered = perldlpp('PDL::NiceSlice', $source);
+    return $filtered;
+}
+
+1;
@@ -2,8 +2,11 @@ BEGIN {
    my %engine_ok = (
       'Filter::Util::Call' => 'PDL/NiceSlice/FilterUtilCall.pm',
       'Filter::Simple'     => 'PDL/NiceSlice/FilterSimple.pm',
+      'Module::Compile'     => 'PDL/NiceSlice/ModuleCompile.pm',
    );  # to validate names
 
+   ## $PDL::NiceSlice::engine = $engine_ok{'Filter::Simple'};  # default engine type
+   ## TODO: Add configuration argument to perldl.conf
    $PDL::NiceSlice::engine = $engine_ok{'Filter::Util::Call'};  # default engine type
 
    if ( exists $ENV{PDL_NICESLICE_ENGINE} ) {
@@ -23,6 +26,10 @@ no warnings;
 
 package PDL::NiceSlice;
 
+our $VERSION = '1.000_003';
+$VERSION = eval $VERSION;
+
+$PDL::NiceSlice::debug = defined($PDL::NiceSlice::debug) ? $PDL::NiceSlice::debug : 0;
 # replace all occurences of the form
 #
 #   $pdl(args);
@@ -30,7 +37,7 @@ package PDL::NiceSlice;
 #   $pdl->(args);
 # with
 #
-#   $pdl->nslice(processed_args);
+#   $pdl->slice(processed_args);
 #
 #
 # Modified 2-Oct-2001: don't modify $var(LIST) if it's part of a
@@ -38,8 +45,6 @@ package PDL::NiceSlice;
 #
 # Modified 5-Nov-2007: stop processing if we encounter m/^no\s+PDL\;:\;:NiceSlice\;\s*$/.
 
-$PDL::NiceSlice::VERSION = '1.0.3';
-$PDL::NiceSlice::debug = 0;
 # the next one is largely stolen from Regexp::Common
 my $RE_cmt = qr'(?:(?:\#)(?:[^\n]*)(?:\n))';
 
@@ -159,8 +164,7 @@ my $prefixpat = qr/.*?  # arbitrary leading stuff
 		    \s*          # more whitespace
                    (?=\()/smx;   # directly followed by open '(' (look ahead)
 
-# translates a single arg into corresponding
-# mslice format
+# translates a single arg into corresponding slice format
 sub onearg ($) {
   my ($arg) = @_;
   print STDERR "processing arg '$arg'\n" if $PDL::NiceSlice::debug;
@@ -174,12 +178,12 @@ sub onearg ($) {
       if @args > 3;
     $args[0] = 0 if !defined $args[0] || $args[0] =~ /^\s*$/;
     $args[1] = -1 if !defined $args[1] || $args[1] =~ /^\s*$/;
-    $args[2] = 1  if !defined $args[2] || $args[2] =~ /^\s*$/;
+    $args[2] = undef if !defined $args[2] || $args[2] =~ /^\s*$/;
     return "[".join(',',@args)."]"; # replace single ':' with ','
   }
   # the (pos) syntax, i.e. 0D slice
   return "[$arg,0,0]" if $arg =~ s/^\s*\((.*)\)\s*$/$1/; # use the new [x,x,0]
-  # we don't allow [] syntax (although that's what nslice internally uses)
+  # we don't allow [] syntax (although that's what slice uses)
   filterdie "invalid slice expression containing '[', expression was '".
     curarg()."'" if $arg =~ /^\s*\[/;
 
@@ -199,13 +203,19 @@ sub procargs {
   # push @callstack, $txt; # for later error reporting
   my $args = $txt =~ /^\s*$/s ? '' :
     join ',', map {onearg $_} splitprotected ',', $txt;
-  $args =~ s/\s//sg; # get rid of whitespace
+    ## Leave whitespace/newlines in so line count
+    ## is preserved in error messages.  Makes the
+    ## filtered output ugly---iffi the input was
+    ## ugly...
+    ## 
+    ## $args =~ s/\s//sg; # get rid of whitespace
   # pop @callstack; # remove from call stack
+  print STDERR "procargs: returned '($args)'\n" if $PDL::NiceSlice::debug;
   return "($args)";
 }
 
 # this is the real workhorse that translates occurences
-# of $a(args) into $args->nslice(processed_arglist)
+# of $a(args) into $args->slice(processed_arglist)
 #
 sub findslice {
   my ($src,$verb) = @_;
@@ -221,7 +231,7 @@ sub findslice {
       if $verb;
 
 #  Do final check for "for $var(LIST)" and "foreach $var(LIST)" syntax. 
-#  Process into an 'nslice' call only if it's not that.
+#  Process into an 'slice' call only if it's not that.
 
     if ($prefix =~ m/for(each)?(\s+(my|our))?\s+\$\w+(\s|$RE_cmt)*$/s ||
       # foreach statement: Don't translate
@@ -247,7 +257,7 @@ sub findslice {
       # filterdie "invalid modifier $1"
       #	if $found =~ /(;\s*[[:graph:]]{2,}?\s*)\)$/;
       print STDERR "MODS: " . join(',',@mods) . "\n" if $PDL::NiceSlice::debug;
-      my @post = (); # collects all post nslice operations
+      my @post = (); # collects all post slice operations
       my @pre = ();
       if (@mods) {
 	(my $mod = $mods[0]) =~ s/\s//sg; # eliminate whitespace
@@ -266,17 +276,17 @@ sub findslice {
 	    } elsif ($mod1 eq '_') {
 	      $seen{$mod1}++ && filterdie "modifier $mod1 used twice or more";
 	      push @pre, 'flat->';
-	      $call ||= 'nslice';       # do only once
+	      $call ||= 'slice';       # do only once
 	      $arg = procargs($slicearg);
 	      # $post = ''; # no post action required
 	    } elsif ($mod1 eq '|') {
 	      $seen{$mod1}++ && filterdie "modifier $mod1 used twice or more";
-	      $call ||= 'nslice';
+	      $call ||= 'slice';
 	      $arg ||= procargs($slicearg);
 	      push @post, '->sever';
 	    } elsif ($mod1 eq '-') {
 	      $seen{$mod1}++ && filterdie "modifier $mod1 used twice or more";
-	      $call ||= 'nslice';
+	      $call ||= 'slice';
 	      $arg ||= procargs($slicearg);
 	      push @post, '->reshape(-1)';
 	    } else {
@@ -284,15 +294,15 @@ sub findslice {
 	    }
 	  }
 	} else { # empty modifier block
-	  $call = 'nslice';
+	  $call = 'slice';
 	  $arg = procargs($slicearg);
 	  # $post = '';
 	}
       } else { # no modifier block
-         $call = 'nslice';
+         $call = 'slice';
          $arg = procargs($slicearg);
          # $post = '';
-         # $call = 'nslice_if_pdl';     # handle runtime checks for $self type
+         # $call = 'slice_if_pdl';     # handle runtime checks for $self type
          # $arg =~ s/\)$/,q{$found})/;  # add original argument string
                                         # in case $self is not a piddle
                                         # and the original call must be
@@ -338,7 +348,7 @@ sub reinstator_regexp{
 # as a preprocessor
 sub perldlpp {
  my ($class, $txt) = @_;
-
+ local($_);
  ##############################
  # Backwards compatibility to before the two-parameter form. The only
  # call should be around line 206 of PDL::AutoLoader, but one never
@@ -475,7 +485,7 @@ syntax directly into the language via a perl I<source filter> (see
 L<the perlfilter man page|perlfilter>).  NiceSlice adds no new functionality, only convenient syntax.
 
 NiceSlice is loaded automatically in the perldl or pdl2 shell, but (to avoid
-conflicts with other modules) must be loaded automatically in standalone
+conflicts with other modules) must be loaded explicitly in standalone
 perl/PDL scripts (see below).  If you prefer not to use a prefilter on
 your standalone scripts, you can use the L<slice|PDL::Slices/slice>
 method in those scripts,
@@ -1024,16 +1034,11 @@ C<PDL::NiceSlice> exploits the ability of Perl to use source filtering
 rewrites) your perl code before it is seen by the
 compiler. C<PDL::NiceSlice> searches through your Perl source code and when
 it finds the new slicing syntax it rewrites the argument list
-appropriately and splices a call to the C<nslice> method using the
+appropriately and splices a call to the C<slice> method using the
 modified arg list into your perl code. You can see how this works in
 the L<perldl|perldl> or L<pdl2|PDL::Perldl2> shells by switching on
 reporting (see above how to do that).
 
-The C<nslice> method is an extended version of L<mslice|PDL::Core/mslice> that
-knows how to deal with index piddles (and therefore combines
-slicing and dicing). Full documentation of C<nslice> will
-be in the next PDL release.
-
 =head1 BUGS
 
 =head2 Conditional operator
@@ -22,6 +22,9 @@ Strictly speaking this module shouldn't be installed with a
 
 EOPM
 
+# make sure the deprecation mechanism throws warnings
+pp_deprecate_module( infavor => "PDL::Test::Fancy" );
+
 sub pp_deft {
     my ($name,%hash) = @_;
 ##    $hash{Doc} = "=for ref\n\ninternal\n\nonly for internal testing purposes\n";
@@ -61,7 +61,7 @@ I<any> dimension.
 
 =for usage
 
- \$a = $op(\$b);
+ \$b = $op(\$a);
 
 =for example
 
@@ -96,7 +96,7 @@ is the first element of the parameter.
 
 =for usage
 
- \$a = $op(\$b);
+ \$b = $op(\$a);
 
 =for example
 
@@ -295,7 +295,7 @@ pp_def(
        Pars => 'a(n); int+ [o]b();',
        Code =>
        '$GENERIC(b) tmp = 0;
-       int ns = $SIZE(n), nn;
+       PDL_Indx ns = $SIZE(n), nn;
        /* Integration formulae from Press et al 2nd Ed S 4.1 */
        switch (ns) {
       case 1:
@@ -368,7 +368,7 @@ pp_def(
 
 	BadCode => 
 	'$GENERIC(b) tmp = 0;
-         long cnt = 0;
+         PDL_Indx cnt = 0;
 	 loop(n) %{ 
             if ( $ISGOOD(a()) ) { tmp += $a(); cnt++; }
          %}
@@ -391,7 +391,7 @@ pp_def(
 	  else { $b() = 0; }',
 	BadCode => 
 	'double tmp = 0;
-         long cnt = 0;
+         PDL_Indx cnt = 0;
 	 loop(n) %{ 
             if ( $ISGOOD(a()) ) { tmp += $a(); cnt++; }
          %}
@@ -416,9 +416,9 @@ for (keys %PDL::Types::typehash) {
 
     pp_addhdr(<<"FOO"
 
-      void pdl_qsort_$ppsym($ctype* xx, int a, int b) {
+      void pdl_qsort_$ppsym($ctype* xx, PDL_Indx a, PDL_Indx b) {
 
-         int i,j;
+         PDL_Indx i,j;
 
          $ctype t, median;
 
@@ -442,11 +442,11 @@ for (keys %PDL::Types::typehash) {
 
       }
 
-      void pdl_qsort_ind_$ppsym($ctype* xx,  int* ix, int a, int b) {
+      void pdl_qsort_ind_$ppsym($ctype* xx,  PDL_Indx* ix, PDL_Indx a, PDL_Indx b) {
 
-         int i,j;
+         PDL_Indx i,j;
 
-         int t;
+         PDL_Indx t;
         $ctype median;
 
          i = a; j = b;
@@ -479,8 +479,8 @@ for (keys %PDL::Types::typehash) {
 	/* Compare a vector in lexicographic order, returning the
 	 *  equivalent of "<=>". 
  	 */
-      signed char pdl_cmpvec_$ppsym($ctype *a, $ctype *b, int n) {
-	int i;
+      signed char pdl_cmpvec_$ppsym($ctype *a, $ctype *b, PDL_Indx n) {
+	PDL_Indx i;
 	for(i=0; i<n; a++,b++,i++) {
 	 if( *a < *b ) return -1;
 	 if( *a > *b ) return 1;
@@ -488,9 +488,9 @@ for (keys %PDL::Types::typehash) {
 	return 0;
      }	
 	
-      void pdl_qsortvec_$ppsym($ctype *xx, int n, int a, int b) {
+      void pdl_qsortvec_$ppsym($ctype *xx, PDL_Indx n, PDL_Indx a, PDL_Indx b) {
 		
-	int i,j, median_ind;
+	PDL_Indx i,j, median_ind;
 
 	$ctype t;
 	i = a; 
@@ -504,7 +504,7 @@ for (keys %PDL::Types::typehash) {
 	  while( pdl_cmpvec_$ppsym( &(xx[n*j]), &(xx[n*median_ind]), n )  >  0 ) 
 		j--;
 	  if(i<=j) {
-		int k;
+		PDL_Indx k;
 		$ctype *aa = &xx[n*i];
 	        $ctype *bb = &xx[n*j];
 		for( k=0; k<n; aa++,bb++,k++ ) {
@@ -531,9 +531,9 @@ for (keys %PDL::Types::typehash) {
 	
       }
 
-      void pdl_qsortvec_ind_$ppsym($ctype *xx, int *ix, int n, int a, int b) {
+      void pdl_qsortvec_ind_$ppsym($ctype *xx, PDL_Indx *ix, PDL_Indx n, PDL_Indx a, PDL_Indx b) {
 		
-	int i,j, median_ind;
+	PDL_Indx i,j, median_ind;
 
 	$ctype t;
 	i = a; 
@@ -547,7 +547,7 @@ for (keys %PDL::Types::typehash) {
 	  while( pdl_cmpvec_$ppsym( &(xx[n*ix[j]]), &(xx[n*ix[median_ind]]), n )  >  0 ) 
 		j--;
 	  if(i<=j) {
-		int k;
+		PDL_Indx k;
 	        k = ix[i];
 	        ix[i] = ix[j];
 		ix[j] = k;	        
@@ -580,28 +580,28 @@ FOO
 
 sub generic_qsort {
     my $pdl = shift;
-    return '$TBSULQFD(pdl_qsort_B,pdl_qsort_S,pdl_qsort_U,
-             pdl_qsort_L,pdl_qsort_Q,pdl_qsort_F,pdl_qsort_D) ($P(' . $pdl . '), 0, nn);';
+    return '$TBSULNQFD(pdl_qsort_B,pdl_qsort_S,pdl_qsort_U,
+             pdl_qsort_L,pdl_qsort_N,pdl_qsort_Q,pdl_qsort_F,pdl_qsort_D) ($P(' . $pdl . '), 0, nn);';
 }
 
 sub generic_qsortvec {
     my $pdl = shift;
     my $ndim = shift;
-    return '$TBSULQFD(pdl_qsortvec_B,pdl_qsortvec_S,pdl_qsortvec_U,
-             pdl_qsortvec_L,pdl_qsortvec_Q,pdl_qsortvec_F,pdl_qsortvec_D) ($P(' . $pdl . '), '. $ndim.', 0, nn);';
+    return '$TBSULNQFD(pdl_qsortvec_B,pdl_qsortvec_S,pdl_qsortvec_U,
+             pdl_qsortvec_L,pdl_qsortvec_N,pdl_qsortvec_Q,pdl_qsortvec_F,pdl_qsortvec_D) ($P(' . $pdl . '), '. $ndim.', 0, nn);';
 }
 
 
 # should use threadloop ?
 #
 my $copy_to_temp_good = '
-           int nn, nn1;
+           PDL_Indx nn, nn1;
 	   loop(n) %{ $tmp() = $a(); %}
            nn = $COMP(__n_size)-1; ' .
        generic_qsort('tmp');
 
 my $copy_to_temp_bad = '
-        register int nn = 0;
+        register PDL_Indx nn = 0;
 	loop(n) %{ 
            if ( $ISGOOD(a()) ) { $tmp(n=>nn) = $a(); nn++; }
         %}
@@ -629,10 +629,10 @@ pp_def(
        Pars => 'a(n); [o]b(); [t]tmp(n);',
        Doc => projectdocs('median','medover',''),
        Code => 
-       "int nn2;\n" . $copy_to_temp_good . $find_median_average,
+       "PDL_Indx nn2;\n" . $copy_to_temp_good . $find_median_average,
        BadCode =>
        $copy_to_temp_bad . 
-       '   int nn1, nn2;
+       '   PDL_Indx nn1, nn2;
            nn -= 1; ' .
        generic_qsort('tmp') .
        $find_median_average . '}',
@@ -656,12 +656,57 @@ some circumstances.
        $copy_to_temp_good . $find_median_lower,
        BadCode =>
        $copy_to_temp_bad . 
-       '   int nn1;
+       '   PDL_Indx nn1;
            nn -= 1; '.
        $find_median_lower . '}',
 
 ); # pp_def: oddmedover
 
+
+pp_def('modeover',
+       HandleBad=>undef,
+       Pars => 'data(n); [o]out(); [t]sorted(n);',
+       GenericTypes=>['B','S','U','L','Q','N'],
+       Doc=>projectdocs('mode','modeover','
+
+The mode is the single element most frequently found in a 
+discrete data set.
+
+It I<only> makes sense for integer data types, since
+floating-point types are demoted to integer before the
+mode is calculated.
+
+C<modeover> treats BAD the same as any other value:  if
+BAD is the most common element, the returned value is also BAD.
+'),
+	 Code => <<'EOCODE',
+	       PDL_Indx i = 0;
+	       PDL_Indx most = 0;
+	       $GENERIC() curmode;
+               $GENERIC() curval;
+
+               /* Copy input to buffer for sorting, and sort it */
+               loop(n) %{ $sorted() = $data(); %}
+               PDL->$TBSULNQ(qsort_B,qsort_S,qsort_U,qsort_L,qsort_N,qsort_Q)($P(sorted),0,$SIZE(n)-1);
+      
+               /* Walk through the sorted data and find the most common elemen */
+               loop(n) %{
+                   if( n==0 || curval != $sorted() ) {
+	             curval = $sorted();
+	             i=0;
+	           } else {
+	             i++;
+	             if(i>most){
+	                most=i;
+                        curmode = curval;
+	             }
+	          }
+               %}
+               $out() = curmode;
+EOCODE
+    );
+
+
 my $find_pct_interpolate = '
            np = nn * $p();
            nn1 = np;
@@ -703,7 +748,7 @@ pp_def('pctover',
 
 =for ref
 
-  Project via percentile to N-1 dimensions
+Project via percentile to N-1 dimensions
 
 This function reduces the dimensionality of a piddle by one by finding
 the specified percentile (p) along the 1st dimension.  The specified
@@ -719,11 +764,11 @@ I<any> dimension.
 
 =for usage
 
-$a = pctover($b, $p);
+ $b = pctover($a, $p);
 
 =for example
 
-$spectrum = pctover $image->xchg(0,1) $p
+ $spectrum = pctover $image->xchg(0,1), $p
 
 =cut
 
@@ -731,12 +776,12 @@ $spectrum = pctover $image->xchg(0,1) $p
 ',
         Code => '
            double np, pp1, pp2;
-           int nn2;
+           PDL_Indx nn2;
 	   ' . $copy_to_temp_good .
            $find_pct_interpolate,
        BadCode =>
        $copy_to_temp_bad .  '
-           int nn1, nn2;
+           PDL_Indx nn1, nn2;
            double np, pp1, pp2;
            nn -= 1; ' .  generic_qsort('tmp') .
            $find_pct_interpolate . '}',
@@ -763,25 +808,25 @@ I<any> dimension.
 
 =for usage
 
- $a = oddpctover($b, $p);
+ $b = oddpctover($a, $p);
 
 =for example
 
- $spectrum = oddpctover $image->xchg(0,1) $p
+ $spectrum = oddpctover $image->xchg(0,1), $p
 
 =cut
 
 
 ',
         Code => '
-           int np;
+           PDL_Indx np;
 	   ' . $copy_to_temp_good . '
            np = (nn+1)*$p();
            if (np > nn) np = nn;
            if (np < 0) np = 0;
 	   $b() = $tmp(n => np);
 ',
-       BadCode => 'int np;
+       BadCode => 'PDL_Indx np;
        ' . $copy_to_temp_bad . '
            nn -= 1;
            ' .  generic_qsort('tmp') . '
@@ -870,6 +915,7 @@ for my $op ( ['avg','average','average'],
 	     ['min','minimum','minimum'],
 	     ['max','maximum','maximum'],
 	     ['median', 'medover', 'median'],
+	     ['mode', 'modeover', 'mode'],
 	     ['oddmedian','oddmedover','oddmedian']) {
     my $name = $op->[0];
     my $func = $op->[1];
@@ -882,7 +928,9 @@ for my $op ( ['avg','average','average'],
 
 =for ref
 
-Return the $text of all elements in a piddle
+Return the $text of all elements in a piddle.
+
+See the documentation for L<$func|/$func> for more information.
 
 =for usage
 
@@ -896,13 +944,7 @@ EOD
 	pp_addpm(<<"EOD");
 =for bad
 
-This routine handles bad values (see the
-documentation for L<$func|/$func>).
-I still need to decide how to handle the case when 
-the return value is a bad value (eg to make sure it
-has the same type as the input piddle OR 
-perhaps we should die - makes sense for the conditional
-ops but not things like sum)
+This routine handles bad values.
 
 =cut
 
@@ -1036,14 +1078,15 @@ pp_add_exported('', 'minmax');
 pp_def(
     'qsort',
     HandleBad => 1,
+    Inplace => 1,
     Pars => 'a(n); [o]b(n);',
     Code => 
-    'int nn;
+    'PDL_Indx nn;
      loop(n) %{ $b() = $a(); %}
      nn = $COMP(__n_size)-1;
     ' . generic_qsort('b'),
     BadCode =>
-    'register int nn = 0, nb = $SIZE(n) - 1;
+    'register PDL_Indx nn = 0, nb = $SIZE(n) - 1;
      loop(n) %{ 
         if ( $ISGOOD(a()) ) { $b(n=>nn) = $a(); nn++; }
         else                { $SETBAD(b(n=>nb)); nb--; }
@@ -1075,24 +1118,24 @@ Bad values are moved to the end of the array:
     ); # pp_def qsort
 
 sub generic_qsort_ind {
-    return '$TBSULQFD(pdl_qsort_ind_B,pdl_qsort_ind_S,pdl_qsort_ind_U,
-            pdl_qsort_ind_L,pdl_qsort_ind_Q,pdl_qsort_ind_F,pdl_qsort_ind_D) ($P(a), $P(indx),
+    return '$TBSULNQFD(pdl_qsort_ind_B,pdl_qsort_ind_S,pdl_qsort_ind_U,
+            pdl_qsort_ind_L,pdl_qsort_ind_N,pdl_qsort_ind_Q,pdl_qsort_ind_F,pdl_qsort_ind_D) ($P(a), $P(indx),
             0, nn);';
 }
 
 pp_def(
        'qsorti',
        HandleBad => 1,
-       Pars => 'a(n); int [o]indx(n);',
+       Pars => 'a(n); indx [o]indx(n);',
        Code => 
-       'int nn = $COMP(__n_size)-1;
+       'PDL_Indx nn = $COMP(__n_size)-1;
         if ($SIZE(n) == 0) return;
         loop(n) %{ 
            $indx() = n; 
         %}
        ' . generic_qsort_ind(),
        BadCode =>
-       'register int nn = 0, nb = $SIZE(n) - 1;
+       'register PDL_Indx nn = 0, nb = $SIZE(n) - 1;
         if ($SIZE(n) == 0) return;
         loop(n) %{ 
            if ( $ISGOOD(a()) ) { $indx(n=>nn) = n; nn++; } /* play safe since nn used more than once */ 
@@ -1131,10 +1174,11 @@ Quicksort a vector and return index of elements in ascending order.
 pp_def(
     'qsortvec',
     HandleBad => 1,
+    Inplace => 1,
     Pars => 'a(n,m); [o]b(n,m);',
     Code => 
-    'int nn;
-     int nd;
+    'PDL_Indx nn;
+     PDL_Indx nd;
      loop(n,m) %{ $b() = $a(); %}
      nn = ($COMP(__m_size))-1;
      nd = $COMP(__n_size);
@@ -1172,17 +1216,17 @@ Vectors with bad components should be moved to the end of the array:
 sub generic_qsortvec_ind {
     my $pdl = shift;
     my $ndim = shift;
-    return '$TBSULQFD(pdl_qsortvec_ind_B,pdl_qsortvec_ind_S,pdl_qsortvec_ind_U,
-             pdl_qsortvec_ind_L,pdl_qsortvec_ind_Q,pdl_qsortvec_ind_F,pdl_qsortvec_ind_D) ($P(' . $pdl . '), $P(indx), '. $ndim.', 0, nn);';
+    return '$TBSULNQFD(pdl_qsortvec_ind_B,pdl_qsortvec_ind_S,pdl_qsortvec_ind_U,
+             pdl_qsortvec_ind_L,pdl_qsortvec_ind_N,pdl_qsortvec_ind_Q,pdl_qsortvec_ind_F,pdl_qsortvec_ind_D) ($P(' . $pdl . '), $P(indx), '. $ndim.', 0, nn);';
 }
 
 pp_def(
     'qsortveci',
     HandleBad => 1,
-    Pars => 'a(n,m); int [o]indx(m);',
+    Pars => 'a(n,m); indx [o]indx(m);',
     Code => 
-    'int nd;
-     int nn=$COMP(__m_size)-1;
+    'PDL_Indx nd;
+     PDL_Indx nn=$COMP(__m_size)-1;
      loop(m) %{
         $indx()=m;
      %}
@@ -1264,10 +1308,10 @@ for ways of masking NaNs.
     pp_def( 
 	    "${name}_ind",
 	    HandleBad => 1,
-	    Pars => 'a(n); int [o] c();', 
+	    Pars => 'a(n); indx [o] c();', 
 	    Code => 
 	    '$GENERIC() cur;
-             int curind;
+             PDL_Indx curind;
 	     loop(n) %{
 	 	if(!n || $a() '.$op.' cur ' . $nan_check . ')
 		   {cur = $a(); curind = n;}
@@ -1275,7 +1319,7 @@ for ways of masking NaNs.
 	     $c() = curind;',
 	    BadCode => 
 	    '$GENERIC() cur;
-             int curind, flag = 0; /* should set curind to -1 and check for that, then do not need flag */
+             PDL_Indx curind; int flag = 0; /* should set curind to -1 and check for that, then do not need flag */
 	     loop(n) %{
 	 	if( $ISGOOD(a()) && (!flag || $a() '.$op.' cur)) 
                    {cur = $a(); curind = n; flag = 1;}
@@ -1292,14 +1336,14 @@ otherwise the bad flag is cleared for the output piddle.',
     pp_def( 
 	    "${name}_n_ind",
 	    HandleBad => 0,   # just a marker 
-	    Pars => 'a(n); int[o]c(m);',
+	    Pars => 'a(n); indx [o]c(m);',
 	    Code =>
-	    '$GENERIC() cur; int curind; register int ns = $SIZE(n);
+	    '$GENERIC() cur; PDL_Indx curind; register PDL_Indx ns = $SIZE(n);
 	     if($SIZE(m) > $SIZE(n)) $CROAK("n_ind: m_size > n_size");
 	     loop(m) %{
 		 curind = ns;
 		 loop(n) %{
-		 	int nm; int flag=0;
+		 	PDL_Indx nm; int flag=0;
 		 	for(nm=0; nm<m; nm++) {
 				if($c(m=>nm) == n) {flag=1; break;}
 			}
@@ -1326,10 +1370,10 @@ otherwise the bad flag is cleared for the output piddle.',
 pp_def( 
 	'minmaximum',
 	HandleBad => 1,
-	Pars => 'a(n); [o]cmin(); [o] cmax(); int [o]cmin_ind(); int [o]cmax_ind();',
+	Pars => 'a(n); [o]cmin(); [o] cmax(); indx [o]cmin_ind(); indx [o]cmax_ind();',
 	Code => 
 	'$GENERIC() curmin, curmax;
-         int curmin_ind, curmax_ind;
+         PDL_Indx curmin_ind, curmax_ind;
 
  	 curmin = curmax = 0; /* Handle null piddle --CED */
 
@@ -1347,7 +1391,7 @@ pp_def(
 	CopyBadStatusCode => '',
 	BadCode => 
 	'$GENERIC() curmin, curmax;
-         int curmin_ind, curmax_ind, flag = 0;
+         PDL_Indx curmin_ind, curmax_ind; int flag = 0;
 	
 	 loop(n) %{
             if ( $ISGOOD(a()) ) {
@@ -0,0 +1,177 @@
+package PDL::Bugs;
+
+# How to get help diagnosing PDL problems and
+# how to make and submit a useful bug report
+
+__END__
+
+=pod
+
+=head1 NAME
+
+PDL::Bugs - How to diagnose and report PDL problems
+
+=head1 VERSION
+
+version 1.0000
+
+=head1 DESCRIPTION
+
+This module explains how to get help with a PDL problem
+and how, when, and where to submit a bug report.  In the
+future it may be extended to provide some sort of automated
+bug reporting capability.
+
+=head1 IF YOU HAVE A PDL PROBLEM
+
+The primary resource for support for the Perl Data Language
+is via the PDL mailing lists.  The perldl list is for general
+use and discussions and is the one to use for questions about
+problems with PDL or PDL use for computation.  This
+I<is almost always> the list to post to for PDL problems.
+
+The pdl-porters list is I<specifically> for PDL development
+and often contains discussions of a rather technical nature
+relating to PDL internals.  This is I<not> the list for
+general PDL discussion or questions.
+
+   http://pdl.perl.org/?page=mailing-lists
+
+B<NOTE>: Both perldl and pdl-porters are read by the PDL
+developers so you don't save time or increase the probability
+of response by posting to pdl-porters or by cross-posting
+to pdl-porters.  Please stick to perldl list posts unless
+you want to talk PDL implementation and development.
+
+B<NOTE>: There is also a PDL IRC channel which can be useful
+for immediate questions if populated.  However, it has the
+big disadvantage of not being easily searched or routinely
+read by all PDL developers and users.  As a result, if you
+get an answer there, it may be incorrect or incomplete
+depending on who happens to be chatting at the time.  It
+is definitely not readily searchable.
+
+=head1 REPORTING BUGS
+
+Please submit bug reports via the sourceforge bug tracker
+interface at
+
+   http://sourceforge.net/p/pdl/bugs/
+
+where you can review the previously submitted bug reports.
+Click on C<Create Ticket> to generate a bug report.  If you do not
+already have a sourceforge.net account, you will need to
+get one to submit the report:
+
+   http://sourceforge.net/account/registration/
+
+Please provide a way for the PDL developers to contact you
+regarding the problem.
+
+Try to include any information you think might help someone
+isolate, reproduce, and fix your problem.
+
+At a I<minimum>, include the following information:
+
+=over
+
+=item *
+
+PDL version number (e.g. PDL-2.007)
+
+=item *
+
+Perl version information.  Output from C<perl -v> or C<perl -V> (even better!)
+
+=item *
+
+Your operating System.  You can run the C<uname -a> command on many unix systems
+
+=item *
+
+The full output of C<perldl -V> 
+
+If you are reporting a bug with an already installed PDL.  If the PDL
+has compiled and built but not been installed, you may run
+C<perl -Mblib perldl -V> from the top level of the PDL build directory.
+
+=item *
+
+The bug description and how to reproduce it.
+
+Short examples using the PDL shells, C<pdl2> or C<perldl>, are excellent!
+Don't forget to include needed input data (as small as possible) so that
+the code can be run with a cut and paste.
+
+=back
+
+Other things that are often helpful:
+
+=over
+
+=item *
+
+Details about your operating environment that might be related to the problem
+
+=item *
+
+Exact cut and pasted error or warning messages
+
+=item *
+
+The shortest, clearest code you can manage to write which reproduces the bug described.
+
+=item *
+
+A patch against the latest released version of this distribution which fixes this bug.
+
+=back
+
+Alternatively, send an e-mail report with the above
+information (including the output of C<perldl -V>)
+to C<pdl-porters@jach.hawaii.edu>. See
+
+   http://pdl.perl.org/?page=mailing-lists
+
+for info on how to subscribe to this list.
+
+
+=head1 BEFORE YOU SEND A REPORT
+
+BEFORE you report a bug make sure you got the latest
+release version of PDL, always available from CPAN,
+check
+
+   http://search.cpan.org/search?dist=PDL
+
+Also, you can check the FAQ at
+
+   http://pdl.perl.org/?docs=FAQ&title=PDL::FAQ
+
+and the mailing list archives for hints. You can find links to the
+searchable archives at 
+
+   http://pdl.perl.org/?page=mailing-lists
+
+and there is a Google enable search box on the top right of
+L<http://pdl.perl.org> which usually gives the best results.
+
+
+=head1 PATCHES
+
+Patches can be sent to the pdl-porters mailing list
+(see above) or can be directly submitted to the
+patch manager
+
+   http://sourceforge.net/p/pdl/patches/
+
+Patches should be made against the latest released
+PDL or, ideally, against the current git sources
+which you can browse and check out at
+
+   git://git.code.sf.net/p/pdl/code
+
+Thanks,
+The pdl-porters team.
+
+=cut
@@ -1,3 +1,4873 @@
+commit b1d2c53432d954e3ae4a1889b6a0d1dbf7039731
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Oct 12 12:20:54 2013 -0400
+
+    Final updates and Release_Notes for PDL-2.007 release
+
+ DEPENDENCIES   |   10 +-
+ Known_problems |   17 +--
+ Makefile.PL    |    2 +-
+ README         |    2 +-
+ Release_Notes  |  553 +++++++-------------------------------------------------
+ 5 files changed, 75 insertions(+), 509 deletions(-)
+
+commit bc864bc43e1d04169d742c5c3c9015d04b75b374
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Fri Oct 11 16:53:33 2013 -0700
+
+    pdl_trans is now properly defined as a flexible array
+    
+    pdl_trans was intended to have a variable number of pdl objects in it, but the
+    code defined this number as 1. This causes issues with gcc4.8, which is more
+    aggressive at optimizing the code based on what the programmer tells it. In this
+    case, the pdl[1] that the code had was taken literally. The new flexible array
+    implementation tells the compiler exactly what is happening, and all is well.
+    
+    See this thread:
+    
+    http://mailman.jach.hawaii.edu/pipermail/perldl/2013-October/008191.html
+
+ Basic/Core/pdl.h.PL |   56 +++++++++++++++++++++++++++++++-------------------
+ 1 files changed, 35 insertions(+), 21 deletions(-)
+
+commit a36eb5dc841ea50f60bad4cab5e8560b6b128820
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Fri Oct 11 15:52:14 2013 -0700
+
+    clarified how _MSC_VER affects PDL_TRANS_START()
+
+ Basic/Core/pdl.h.PL |   20 +++++---------------
+ 1 files changed, 5 insertions(+), 15 deletions(-)
+
+commit 028a725c9ef8b174d645f503a7af2fe254547374
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Fri Oct 11 15:40:29 2013 -0700
+
+    removed needless cast from pointer to (wrong-sized) int
+
+ Basic/Core/pdlapi.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 56d6cc355d7585114e4f76ed4bf0d5fb3f6f28bd
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Fri Oct 11 15:39:32 2013 -0700
+
+    PDL_CHKMAGIC...() now uses a pointer-specific printf() format
+
+ Basic/Core/pdl.h.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit cd1a4334d906b3d733973b5b553fc5f189747a87
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Fri Oct 11 15:33:44 2013 -0700
+
+    consolidated the two PDL_CHKMAGIC macros into one
+
+ Basic/Core/pdl.h.PL |   18 ++++++++----------
+ 1 files changed, 8 insertions(+), 10 deletions(-)
+
+commit ed50f5c07faefc5fc9eeda020f91b3ed4d2a3cc9
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Oct 11 01:58:37 2013 -0400
+
+    Update DEPENDENCIES and Known_problems
+
+ DEPENDENCIES   |    5 +++++
+ Known_problems |   12 ++++++++++++
+ 2 files changed, 17 insertions(+), 0 deletions(-)
+
+commit 5dcbdf268739fd26fa7a009bd2d1620c1d22067c
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Oct 10 09:48:54 2013 -0400
+
+    Update VERISON to 2.006_93 for PDL-2.007 release candidate
+    
+    Assuming PDL-2.006_92 tests well, the PDL-2.006_93 release
+    will be the release candidate for PDL-2.007.  We're in code
+    freeze so work from now to PDL-2.007 should be only documentation
+    and the ilk.
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    6 +++++-
+ Release_Notes  |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 54 insertions(+), 2 deletions(-)
+
+commit 880a98229711e9e36b6f92c3b74194bbdb09a6c2
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Oct 10 09:42:48 2013 -0400
+
+    Update Known_problems and Release_Notes for PDL-2.006_92 release
+
+ Known_problems |    8 --------
+ Release_Notes  |   14 +++++++++++++-
+ 2 files changed, 13 insertions(+), 9 deletions(-)
+
+commit b2c4c726cff6f458ed945626c1f99b1832e9b378
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Oct 7 17:01:26 2013 -0400
+
+    Add g to substitute for pod obfuscation fix
+
+ Basic/Gen/PP.pm |   10 ++++++++--
+ 1 files changed, 8 insertions(+), 2 deletions(-)
+
+commit 9f6bd7d0964a64648c586d91c9a4da6d351a5959
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Oct 7 16:57:09 2013 -0400
+
+    Add Bugs.pod to MAN1PODS hash
+
+ Makefile.PL |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+commit 1c30a6f9faa13d2ef8a923b3d31b7a73f6a94650
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Oct 7 12:27:00 2013 -0400
+
+    Put map in list context for pdldoc obfuscation
+
+ Basic/Gen/PP.pm |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 8ae1f0059ef5dfc161d651952d03750cd2b6bad3
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Oct 7 10:16:30 2013 -0400
+
+    Add PDL::Doc compatible function refs to PP.pod
+    
+    We might want to revisit the PDL::Doc implementation to
+    make it easier to mark items for the pdldoc database.
+
+ Basic/Pod/PP.pod |  140 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
+ 1 files changed, 135 insertions(+), 5 deletions(-)
+
+commit 46468fb511ed5ed9d67905039f227234a3306ffb
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Mon Oct 7 21:33:13 2013 +1100
+
+    Graphics/PLplot/plplot.pd - address portability issue
+    
+    Define "c_plwid" to "c_plwidth" iff "plwidth" is
+    defined.
+
+ Graphics/PLplot/plplot.pd |   41 +++++++++++++++++++++++------------------
+ 1 files changed, 23 insertions(+), 18 deletions(-)
+
+commit 69331eedde82efd3a94f88668e377b01757b81e3
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Oct 6 16:04:23 2013 -0400
+
+    Obfuscate pod constructs so perldoc doesn't see them
+    
+    Some of the PP commands generate POD and the format of
+    the text pieces used to produce the generated POD looked
+    like valid POD since they were in heredocs at the first char.
+    Added a prefix and map command to hide them.  Now only PP.pod
+    shows as having docs.  Still need to add POD for the various
+    pp_xxx routines in a form so pdldoc (especially with -a will
+    find the references).
+
+ Basic/Gen/PP.pm |   14 +++++++-------
+ 1 files changed, 7 insertions(+), 7 deletions(-)
+
+commit 7ac6a050d4daaf65451de82644495d7edc9b6cc6
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Oct 6 15:34:06 2013 -0400
+
+    Move BUGS to Bugs.pod for discoverable documentation
+    
+    This should make it easier for non-hand-install PDLers
+    to find instructions for submitting problem reports or
+    where to ask questions.
+
+ BUGS        |   99 ---------------------------------
+ Bugs.pod    |  177 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ MANIFEST    |    2 +-
+ Makefile.PL |    2 +-
+ 4 files changed, 179 insertions(+), 101 deletions(-)
+
+commit 6a2ed5e50019686dd783cf005cb79fb6bb2648c6
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Oct 6 10:44:24 2013 -0400
+
+    Make PDL::NiceSlice preserve line numbering (sf.net feature #75)
+    
+    Now niceslice processing leaves whitespace (and newlines) in
+    place so that line numbering is preserved by the preprocessor
+    and hence debug messages refer to the correct line in the
+    original, unfiltered code.
+
+ Basic/SourceFilter/NiceSlice.pm |    7 ++++++-
+ 1 files changed, 6 insertions(+), 1 deletions(-)
+
+commit f2b71efe391ecb335d57007eabf8167154de3d66
+Merge: 6872726 8fefb6d
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Oct 6 10:43:54 2013 -0400
+
+    Merge branch 'master' of ssh://git.code.sf.net/p/pdl/code
+
+commit 8fefb6da5e599646e0285660176020f1a7f06afc
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Sun Oct 6 10:20:51 2013 -0400
+
+    Added simple CLONE_SKIP to PDL.pm
+
+ Basic/PDL.pm |   18 +++++++++++++++++-
+ 1 files changed, 17 insertions(+), 1 deletions(-)
+
+commit 68727266edcadd25866da38897ba7b4f864d0672
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Oct 6 10:08:34 2013 -0400
+
+    Update needed version of Perl OpenGL to 0.6702
+    
+    Be sure to add warning of change to Release_Notes so no-one is
+    caught by surprise.
+
+ Basic/SourceFilter/NiceSlice.pm |    1 +
+ Graphics/TriD/POGL/Makefile.PL  |   16 ++++++++--------
+ perldl.conf                     |    2 +-
+ 3 files changed, 10 insertions(+), 9 deletions(-)
+
+commit 9ced359cfe2c569c735636590d4978f18adb3b63
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Oct 1 19:01:38 2013 -0400
+
+    Update typemap.pdl from typemap
+    
+    The PP typemap that is used is the typemap.pdl file installed in
+    the PDL/Core directory.  This updates that file with the new
+    PDL_Indx type for index data values.
+
+ Basic/Core/typemap.pdl |   10 ++++++++++
+ 1 files changed, 10 insertions(+), 0 deletions(-)
+
+commit 4dbb2444329d141f42aebc89c0a13641d70c73a4
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Sep 29 15:04:34 2013 -0400
+
+    Update VERSION to 2.006_092 for more PDL-2.007 final development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   41 +++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 43 insertions(+), 2 deletions(-)
+
+commit f86080a9f8b3083790da09fb025f4827f8d8d5de
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 28 18:28:42 2013 -0400
+
+    Update Known_problems and Release_Notes.
+
+ Known_problems |   10 ----------
+ Release_Notes  |   16 +++++++++++++++-
+ 2 files changed, 15 insertions(+), 11 deletions(-)
+
+commit 4409c513f722eac54de1ff601b004e7752fbe9d3
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 28 17:48:21 2013 -0400
+
+    Update ExtUtils::MakeMaker required to 6.56
+    
+    To enable support for CONFIGURE_REQUIRES option.  This allows
+    us to stop having a local copy of Devel::CheckLib in inc/
+
+ MANIFEST.SKIP |    1 +
+ Makefile.PL   |    3 ++-
+ 2 files changed, 3 insertions(+), 1 deletions(-)
+
+commit 5214b23d6ecdb690077fcbd59c71c6561d1c40de
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Sep 26 09:01:08 2013 -0400
+
+    Fix some missing int->indx/PDL_Indx conversions in primitive.pd
+    
+    vsearch, which, and which_both.  Thanks to Edward Baudrez for
+    reporting the problem.
+
+ Basic/Primitive/primitive.pd |   14 +++++++-------
+ 1 files changed, 7 insertions(+), 7 deletions(-)
+
+commit cccb2f201dc7417e478ddf3165ded290ca9f8586
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Sep 25 13:28:42 2013 -0400
+
+    Add some tapprox() to floating point equality tests.
+
+ t/ufunc.t |   20 ++++++++++----------
+ 1 files changed, 10 insertions(+), 10 deletions(-)
+
+commit 6c60172f3ae7e40f1f0f65432dbb3e2135abcf27
+Merge: 0fe3d13 9b6954b
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Sep 24 07:02:54 2013 -0400
+
+    Merge branch 'master' of ssh://git.code.sf.net/p/pdl/code
+
+commit 0fe3d138f1def45e5e524ec105caa65eecd0761e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Sep 24 07:02:06 2013 -0400
+
+    Remove ref to previous indx conversion routines: ind and index
+
+ Basic/Gen/PP/PDLCode.pm |    2 --
+ 1 files changed, 0 insertions(+), 2 deletions(-)
+
+commit 9b6954b494f488090ce18f59886aa3278e2b3769
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Tue Sep 24 11:19:14 2013 +0200
+
+    add "afh" option to rfits to allow explicit use of legacy hash
+    parser for performance reasons.  (This was possible before but
+    only by localizing the undocumented global variable $PDL::Astro_Fits_Header).
+
+ IO/FITS/FITS.pm |   17 ++++++++++++++---
+ 1 files changed, 14 insertions(+), 3 deletions(-)
+
+commit 83001b7445fe893c7035e14434645bb040c4bb9e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Sep 22 07:18:13 2013 -0400
+
+    Update VERSION to 2.006_91 for finishing PDL-2.007 development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   41 +++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 43 insertions(+), 2 deletions(-)
+
+commit ad25b02188eb877a8ccf6bacc4560205daf9aaf2
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 21 21:17:19 2013 -0400
+
+    Update Known_problems for CPAN Developers release 2.006_90
+
+ Known_problems |    5 -----
+ 1 files changed, 0 insertions(+), 5 deletions(-)
+
+commit 13936b313be1571a401b7dedc07b8ac9f4deae6b
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 21 21:17:00 2013 -0400
+
+    Fix a few missed modover->modeover changes
+
+ Basic/Ufunc/ufunc.pd |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 40ba95910e61ab74aa59010a2d714572e890ea63
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 21 20:44:38 2013 -0400
+
+    Change modover to modeover in t/ufunc.t
+
+ t/ufunc.t |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 00d436d11f93ae87a8530c4ee81879b69e046b3e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 21 17:45:41 2013 -0400
+
+    Update Release_Notes
+
+ Release_Notes |   12 +++++++++++-
+ 1 files changed, 11 insertions(+), 1 deletions(-)
+
+commit f32707688ec90d8eac96f2884b81768037177645
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 21 17:44:34 2013 -0400
+
+    Use mode/modeover rather than mode/modover
+    
+    To avoid confusion---even if it looks a bit odd, rpic() doesn't
+    read like a real word either.
+
+ Basic/Ufunc/ufunc.pd |   12 +++++++-----
+ 1 files changed, 7 insertions(+), 5 deletions(-)
+
+commit ed84ab3d297cf9803d9af0ae3eed35ad53e741e5
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 21 10:37:10 2013 -0400
+
+    Minor update to PDL FAQ
+
+ Basic/Pod/FAQ.pod |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit acee3e1925772addf3f66afded29ff48de9419d5
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 21 10:26:57 2013 -0400
+
+    More explanation for PDL_Indx type use and meaning
+
+ Basic/Pod/API.pod        |    7 ++++---
+ Basic/Pod/QuickStart.pod |   10 +++++++---
+ 2 files changed, 11 insertions(+), 6 deletions(-)
+
+commit f50b4051105fe7bbbdd89cac6a3224cf486a6627
+Merge: 2d1c198 571f925
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Wed Sep 18 18:12:14 2013 -0600
+
+    Merge branch 'master' of ssh://git.code.sf.net/p/pdl/code
+
+commit 2d1c198fc25a49d8f718daa81c71abe1fb03ced8
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Wed Sep 18 18:11:08 2013 -0600
+
+    add mode/modover and appropriate tests; clarify generic ufunc docs slightly.
+
+ Basic/Ufunc/ufunc.pd |   56 ++++++++++++++++++++++++++++++++++++++++++-------
+ t/ufunc.t            |    7 +++++-
+ 2 files changed, 54 insertions(+), 9 deletions(-)
+
+commit 571f925226abeb29b0bbb754673a603988fa19c8
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Wed Sep 18 09:32:00 2013 +1000
+
+    Basic/Slices/slices.pd - Fix for MSVC++ 6.0
+    
+    VC6 doesn't have either strtoll or _strtoi64. Thankfully,
+    neither is needed for a PDL build using VC6 compiler
+
+ Basic/Slices/slices.pd |  488 ++++++++++++++++++++++++------------------------
+ 1 files changed, 246 insertions(+), 242 deletions(-)
+
+commit 07b3012f36a5b3df228f688e42173baa9f8d11bf
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Sep 16 14:23:26 2013 -0400
+
+    Update *.pod files to cover new PDL_Indx and slice support
+
+ Basic/Pod/API.pod        |   24 ++++++++++++++----------
+ Basic/Pod/FAQ.pod        |   18 +++++++++---------
+ Basic/Pod/Internals.pod  |   31 ++++++++++++++++---------------
+ Basic/Pod/QuickStart.pod |   11 ++++-------
+ Basic/Pod/Scilab.pod     |    2 +-
+ 5 files changed, 44 insertions(+), 42 deletions(-)
+
+commit 48c5ae54f5214e89a033ba05a4882c1c6c371c9c
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Sep 16 13:07:12 2013 -0400
+
+    Replace nslice and mslice refs by new, improved slice()
+
+ Basic/SourceFilter/NiceSlice.pm |   32 +++++++++++++-------------------
+ 1 files changed, 13 insertions(+), 19 deletions(-)
+
+commit bf76feeaaf29a09436121abbcad89bcf060bcb08
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Sep 16 08:51:23 2013 -0400
+
+    Update some items in PDL/TODO
+
+ TODO |   20 +++++++++++++++++---
+ 1 files changed, 17 insertions(+), 3 deletions(-)
+
+commit 88f6b7c9ab77af2b1c5b77d2523b2c35f8e4e7ec
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Sun Sep 15 23:28:13 2013 -0600
+
+    clean up slice tests; add test for ignoring whitespace; add docs about whitespace to slices.pd
+
+ Basic/Slices/slices.pd |    7 +++--
+ t/slice.t              |   59 ++++++++++++++++++------------------------------
+ 2 files changed, 26 insertions(+), 40 deletions(-)
+
+commit 956b68bd63dbbfa84315ecf38905da4769c3b941
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 14 12:39:42 2013 -0400
+
+    Update VERSION to 2.006_90 for final PDL-2.007 development
+    
+    This release will be PDL-2.007 pre1.
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   41 +++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 43 insertions(+), 2 deletions(-)
+
+commit 09a6ab3c7b75d5132e9e1a06f673ad5619fbe4c3
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 14 11:55:01 2013 -0400
+
+    Update Known_problems and Release_Notes for CPAN devel release
+
+ Known_problems |   11 ++++++++---
+ Release_Notes  |    6 ++++++
+ 2 files changed, 14 insertions(+), 3 deletions(-)
+
+commit e48c63190f113150c7df6d7622e16a401093c8c3
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 14 11:28:37 2013 -0400
+
+    Fix OpenBSD pthread build problem for non-threaded perls
+    
+    There is an open Feature Request ticket to improve the
+    pthreads detection and build for PDL.  For OpenBSD 5.3
+    and non-threaded perls, the current build fails.  For
+    that case, I now disable the pthreads building.  This
+    can be re-enabled when the pthreads detection is revisited,
+    perhaps during the PDL-2.008 clean-up release.
+
+ Basic/Core/Makefile.PL |   19 ++++++++++++-------
+ 1 files changed, 12 insertions(+), 7 deletions(-)
+
+commit eb26375c3907bfe4bf900f2ad09df2f61c56cd4a
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Sep 14 11:27:18 2013 -0400
+
+    Add pp_add_exported for new PDL::slice wrapper
+
+ Basic/Slices/slices.pd |    3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+commit 8eb34aa174f3fa7a9434532205b3ba32ecd4874b
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Fri Sep 13 23:34:22 2013 -0600
+
+    multiple-extension writing for FITS; clean up multiple-extension reading in list context.
+
+ IO/FITS/FITS.pm |  723 ++++++++++++++++++++++++++++++-------------------------
+ t/fits.t        |   25 ++-
+ 2 files changed, 415 insertions(+), 333 deletions(-)
+
+commit 5512e36f690a5d57c51dd7fe7a41efdf72850ece
+Merge: 7294fae f2a00d8
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Fri Sep 13 16:18:24 2013 -0600
+
+    Merge branch 'master' of ssh://git.code.sf.net/p/pdl/code
+    fell behind due to internet outage (Boulder, CO flooding!)
+
+commit f2a00d87b478b4daa935c282e538cbeb741efa95
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Sep 13 09:15:04 2013 -0400
+
+    Update Release_Notes and Known_problems
+
+ Known_problems |    8 +++++---
+ Release_Notes  |   13 ++++++++++++-
+ 2 files changed, 17 insertions(+), 4 deletions(-)
+
+commit 7294fae6fc451f68c31dfebd021ce65f585ed96e
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Thu Sep 12 23:48:40 2013 -0600
+
+    clean slice docs some.
+
+ Basic/Slices/slices.pd |   55 ------------------------------------------------
+ 1 files changed, 0 insertions(+), 55 deletions(-)
+
+commit 47ec8f062578e262f2959b946c7a88da02f1d404
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Thu Sep 12 23:46:09 2013 -0600
+
+    migrate nnslice to replace nslice and slice.  move slice to oslice.
+    New documentation, some new tests to handle slightly different error
+    messages and regularized behavior in some odd corner cases.
+
+ Basic/Core/Core.pm.PL           |   92 +-
+ Basic/Slices/slices.pd          | 3310 +++++++++++++++++++++------------------
+ Basic/SourceFilter/NiceSlice.pm |    2 +-
+ t/croak.t                       |    2 +-
+ t/niceslice.t                   |    1 +
+ t/slice.t                       |  369 +----
+ 6 files changed, 1813 insertions(+), 1963 deletions(-)
+
+commit b3960c3897b6c29f1cbbbe0c06c40e56d953987a
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Sep 12 10:42:19 2013 -0400
+
+    Replace PDL_Index by PDL_Indx to fix Types.pm.PL
+    
+    NOTE: The choice of the typename is a result of the current hack
+    for generating the various type conversion routines from some of
+    the fields in Types.pm.PL structures.  I hope we can clean this
+    up for PDL3 to avoid the confusing mess.  Another goal for PDL3
+    might be to collect all the type generation and use code into a
+    real PDL core.  Right now it is spread amongst PDL/Basic/Core,
+    PDL/Basic/Gen and PDL/Basic/Slices (at least!).
+
+ Basic/Core/Core.xs.PL        |   56 ++++++------
+ Basic/Core/Types.pm.PL       |   35 +++++---
+ Basic/Core/pdl.h.PL          |   16 ++--
+ Basic/Core/pdl_hfiles.p      |    4 +-
+ Basic/Core/pdlapi.c          |   26 +++---
+ Basic/Core/pdlconv.c.PL      |    2 +-
+ Basic/Core/pdlcore.c.PL      |   70 ++++++++--------
+ Basic/Core/pdlcore.h.PL      |   80 +++++++++---------
+ Basic/Core/pdlhash.c         |    4 +-
+ Basic/Core/pdlsections.g     |   40 +++++-----
+ Basic/Core/pdlsimple.h.PL    |    4 +-
+ Basic/Core/pdlthread.c       |   40 +++++-----
+ Basic/Core/pdlthread.h       |   10 +-
+ Basic/Core/typemap           |    2 +-
+ Basic/Gen/PP.pm              |    8 +-
+ Basic/Gen/PP/Dims.pm         |    2 +-
+ Basic/Gen/PP/PDLCode.pm      |   18 ++--
+ Basic/Gen/PP/PdlParObj.pm    |    6 +-
+ Basic/Primitive/primitive.pd |   38 ++++----
+ Basic/Slices/slices.pd       |  190 +++++++++++++++++++++---------------------
+ Basic/Ufunc/ufunc.pd         |   88 ++++++++++----------
+ IO/Storable/storable.pd      |    2 +-
+ Lib/ImageND/imagend.pd       |   46 +++++-----
+ Lib/Minuit/FCN.c             |    6 +-
+ 24 files changed, 402 insertions(+), 391 deletions(-)
+
+commit 0e438f0c40e3ca209ecb4d6bc41a520cd0cfa3a4
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Mon Sep 9 10:08:31 2013 -0600
+
+    fix nnslice indexing
+
+ Basic/Slices/slices.pd |    6 +++++-
+ 1 files changed, 5 insertions(+), 1 deletions(-)
+
+commit ef5728b56ed998658c774f3abe8c7598d471f2dd
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Fri Sep 6 17:00:15 2013 -0600
+
+    add index1d; change dice_axis engine and nnslice dicing engine to index1d
+    (greatly speeds up dicing)
+
+ Basic/Slices/slices.pd |  145 ++++++++++++++++++++++++++++++++++++++---------
+ 1 files changed, 117 insertions(+), 28 deletions(-)
+
+commit 18f3a4c71e21994abbda7cefeaa487abfe1d4eb7
+Merge: f1ec747 dfa7a0e
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Fri Sep 6 16:53:48 2013 -0600
+
+    Merge branch 'master' of ssh://git.code.sf.net/p/pdl/code
+    out of sync again...
+
+commit f1ec7474b35a68c2d914e68a426d0f48ab708415
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Fri Sep 6 16:51:43 2013 -0600
+
+    add more permissive parsing to SvPDLV - autopromote array refs to PDLs
+    (so you can say, e.g., "$a->index([2,3])" instead of "$a->index(pdl(2,3))").
+
+ Basic/Core/pdlcore.c.PL |  169 ++++++++++++++++++++--------------------------
+ t/argtest.t             |   15 +++--
+ 2 files changed, 84 insertions(+), 100 deletions(-)
+
+commit dfa7a0eb5047aa7bb9df7a0fcc7e49e4497e1944
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Thu Sep 5 23:21:27 2013 -0600
+
+    Convert basic.t to Test::More. Add tests for (x|y|z)(lin|log) vals and axisvals.
+    
+    Devel::Cover showed that xlinvals etc were never tested at all.  While I was in there, I converted it to Test::More (I think I got all the pieces!).
+
+ t/basic.t |   52 +++++++++++++++++++++++++++++++++++++++-------------
+ 1 files changed, 39 insertions(+), 13 deletions(-)
+
+commit 0845f0f22a08b547253a2f098b486efe859becb8
+Merge: 19f6ed8 449f9a1
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Thu Sep 5 22:29:03 2013 -0600
+
+    Got a little out of sync updating Transform.
+    Merge branch 'master' of ssh://git.code.sf.net/p/pdl/code
+
+commit 19f6ed8d1523ea7fa834509efad9103cf66fe2f9
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Thu Sep 5 22:28:03 2013 -0600
+
+    minor bugfix to new map code
+
+ Lib/Transform/transform.pd |   11 ++++-------
+ t/transform.t              |    2 +-
+ 2 files changed, 5 insertions(+), 8 deletions(-)
+
+commit ddc1a46b3a5e9f6b45a530fc11a031ccc9e0cd15
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Thu Sep 5 17:51:25 2013 -0600
+
+    Two bug fixes to transform.pd, and an augmentation:
+    
+        - t_fits now parses CDi_j header fields correctly for modern WCS.
+        - apply() and invert() check for undefined fields before trying to execute them.
+            (this works around a perl bug that causes "&$a" to hang if $a is undefined)
+        - map() now has a "rectify" flag that affects whether autoscaling attempts
+            to rectify the coordinate system when autoscaling, or no.  This is useful
+    	because sometimes you want that (the former default behavior) and sometimes
+    	you want to preserve the original skew or rotation of the scientific coordinate
+    	system while rescaling an image. (e.g. $a->match([100,100]) formerly rectified $a;
+    	now by default it simply rescales $a.  map itself keeps the old behavior by default.)
+
+ Lib/Transform/transform.pd |  302 ++++++++++++++++++++++++++++++--------------
+ 1 files changed, 207 insertions(+), 95 deletions(-)
+
+commit 449f9a1afd7dfa51d09646de87cc581556b35834
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Sep 5 09:37:12 2013 -0400
+
+    Update VERSION to 2.006_07 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   39 +++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 41 insertions(+), 2 deletions(-)
+
+commit 201ffef8ecff7db02561bd0a12eeb6f73b8bc9e8
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Sep 5 09:34:45 2013 -0400
+
+    Update Release_Notes and Known_problems for CPAN release
+
+ Known_problems |   14 +++++++++-----
+ Release_Notes  |    9 ++++++---
+ 2 files changed, 15 insertions(+), 8 deletions(-)
+
+commit 84d21012b371821c0df0d98192c9ec8065f7b30a
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Sep 5 09:07:24 2013 -0400
+
+    Clean up t/fits.t, t/iotypes.t and t/ufunc.t
+    
+    Put failing PDL_IND vs PDL_L / PDL_LL tests in TODO blocks
+    for t/fits.t and t/iotypes.t.  Made diagnostic output from
+    tapprox() in t/ufunc.t conditional on whether the threshhold
+    was exceeded or not.
+
+ t/fits.t    |    6 +++++-
+ t/iotypes.t |    9 ++++++---
+ t/ufunc.t   |    5 +++--
+ 3 files changed, 14 insertions(+), 6 deletions(-)
+
+commit 30b2b9ca9c4e41763f5f3548616bde61b52f729e
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Wed Sep 4 14:34:25 2013 -0600
+
+    add tests for nnslice boundary case that wasn't caught earlier
+
+ t/slice.t |    7 ++++++-
+ 1 files changed, 6 insertions(+), 1 deletions(-)
+
+commit 0e618d72dd31ff3b27be1e895edf5cbd45283211
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Wed Sep 4 14:23:37 2013 -0600
+
+    update graticule() in Cartography to support NaN-delimited output
+
+ Lib/Transform/Cartography/Cartography.pm |   93 +++++++++++++++++++-----------
+ 1 files changed, 59 insertions(+), 34 deletions(-)
+
+commit 8117c727353cf5c0385ccb9e1b6598c43183e596
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Wed Sep 4 14:19:29 2013 -0600
+
+    Fix edge-case bug in nnslice: $a->nnslice([-1,0,0]) [equiv to $a->((-1))]
+    offset was not being regularized, but is now.
+
+ Basic/Slices/slices.pd |    7 +++++--
+ 1 files changed, 5 insertions(+), 2 deletions(-)
+
+commit 23fad884deebd20893826deba6aec36a6185dc59
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Tue Sep 3 14:27:02 2013 -0600
+
+    add documentation for dicing to nnslice
+
+ Basic/Slices/slices.pd |    7 ++++++-
+ 1 files changed, 6 insertions(+), 1 deletions(-)
+
+commit 5fa25a501c6761f7e01960dc35bf6beefada24a6
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Tue Sep 3 14:21:24 2013 -0600
+
+    add dicing to nnslice (uses current dice_axis mechanism, which is cheesy
+    but proven -- should really be put into the C code...)
+
+ Basic/Slices/slices.pd |   29 ++++++++++++++++++++++++++++-
+ 1 files changed, 28 insertions(+), 1 deletions(-)
+
+commit 6b9654c8575b8cf74e003bcadf7da8684224e347
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Tue Sep 3 13:50:31 2013 -0600
+
+    add nnslice declaration to PDL::Lvalue
+
+ Basic/Lvalue.pm |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 51b80cb9347dad49f00caa12c6e9e1051290de84
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Tue Sep 3 11:32:24 2013 -0600
+
+    update rangeb docs to reflect new dimincs ordering (should break cache less)
+
+ Basic/Slices/slices.pd |    4 ----
+ 1 files changed, 0 insertions(+), 4 deletions(-)
+
+commit 4a566b471bd2a39714f7698872b2dc1ffa5009fb
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Tue Sep 3 11:29:06 2013 -0600
+
+    Potential fix to rangeb bug on 64/32 hybrid systems (convert everything
+    to PDL_IND instead of PDL_LL).
+
+ Basic/Slices/slices.pd |   39 +++++++++++++++++++++------------------
+ 1 files changed, 21 insertions(+), 18 deletions(-)
+
+commit 28805ee28693a2a989812263f9bdd76567d0fcd4
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Fri Aug 30 11:56:43 2013 -0600
+
+    copied all 'slice' tests to also test 'nnslice' as a drop-in replacement.
+    ('nnslice' passes all tests)
+
+ Basic/Slices/slices.pd |    8 +-
+ t/slice.t              |  283 +++++++++++++++++++++++++++++++++++++++++++++++-
+ 2 files changed, 287 insertions(+), 4 deletions(-)
+
+commit 32037af2b225e65fd9b63ea230125a2a1ee3d9f9
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Fri Aug 30 01:15:10 2013 -0600
+
+    add slice-like parsing and test suite for nnslice
+
+ Basic/Slices/slices.pd |  217 ++++++++++++++++++++++++++++++++++++++++++------
+ t/slice.t              |   71 ++++++++++++++--
+ 2 files changed, 256 insertions(+), 32 deletions(-)
+
+commit d4e67b1e9f4d156d9ebe6d2f40c0d2d65c45c109
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Thu Aug 29 16:43:39 2013 -0600
+
+    remove debugging prints
+
+ Basic/Slices/slices.pd |   13 +------------
+ 1 files changed, 1 insertions(+), 12 deletions(-)
+
+commit 14f3c97c7a892fc96a579397a1656a8e9e30c1f9
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Thu Aug 29 11:16:08 2013 -0600
+
+    add nnslice and nnsliceb for development
+
+ Basic/Slices/slices.pd |  433 ++++++++++++++++++++++++++++++++++++++++++-----
+ 1 files changed, 387 insertions(+), 46 deletions(-)
+
+commit 95ef33692b20d65efc675f9d78f323194fdeb122
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Aug 29 13:06:42 2013 -0400
+
+    Add note about problems with 64bit index support for 32bit perls
+
+ Release_Notes |    3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+commit aa3e6795dddd3aa6bc9fa9b097e2c8a4ecbe4fe7
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Aug 28 11:13:25 2013 -0400
+
+    Update VERSION to 2.006_06 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   39 +++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 41 insertions(+), 2 deletions(-)
+
+commit 8c814b0416023a87dcb963b593bba7b471fbdf9a
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Aug 28 11:07:47 2013 -0400
+
+    Update Known_problems and Release_Notes for 2.00605 release
+
+ Known_problems |    1 +
+ Release_Notes  |    2 ++
+ 2 files changed, 3 insertions(+), 0 deletions(-)
+
+commit ce989507756166a7fcc98603ddc7d072e9b32bd1
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Aug 27 18:14:36 2013 -0400
+
+    Remove FFTW files from MANIFEST and add t/slice-exceptions.t
+
+ MANIFEST |    5 +----
+ 1 files changed, 1 insertions(+), 4 deletions(-)
+
+commit 9517bd226779286c5580739ea433dda856496339
+Author: William Parker <wparker30@yahoo.com>
+Date:   Tue Aug 27 09:51:54 2013 -0400
+
+    updated test script for Ufunc.pm
+    
+    I added in some test cases for the percentile and median calculations.
+    My changes are at the end-all that was modified in the rest was the
+    number of tests planned to reflect those changes.
+
+ t/ufunc.t |   31 +++++++++++++++++++++++++++++--
+ 1 files changed, 29 insertions(+), 2 deletions(-)
+
+commit ffebecab5fbe6e1af966002c3037f513ce00cc68
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Fri Aug 23 14:22:57 2013 -0400
+
+    Tweaked GSL::MROOT and Minuit to mark pdl wrappers as DONTTOUCHDATA
+
+ Lib/GSL/MROOT/FUNC.c |    2 +-
+ Lib/Minuit/FCN.c     |    4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+commit 27bfadcde7f00ccfe566da3097702cab8be80f35
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Fri Aug 23 14:11:05 2013 -0400
+
+    Noted slice stuff in release notes
+
+ Release_Notes |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+commit 00b8d148ce6cbda6d0827562db3fa5ad518d513e
+Merge: 33e4875 cdf8733
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Fri Aug 23 14:06:10 2013 -0400
+
+    Merge Derek's recent docs tweaks with David's slices work
+
+commit 33e4875bc8a3b290dd45a18f104af20b7416597b
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Fri Aug 23 13:53:08 2013 -0400
+
+    Fix inconsistent internal state due to exceptions from out-of-bounds slices.
+    
+    Out-of-bounds slices are not caught at creation time, but later during the
+    evaluation of RedoDims. During the RedoDims code, exceptions were thrown
+    after the slice piddle's internal state was partially setup, and usually
+    after it was setup enough to masquerade as a functional piddle. This led
+    to erroneous dimension size reporting, and potentially to segmentation
+    faults. The best solution is probably to magically swap out the slice
+    piddle with a "barf" slice, which would just always barf with the given
+    error message when any of its methods were invoked. As a stop gap, I
+    here reset one of the internal flags so that the RedoDims code is invoked
+    on any other operations on the piddle, ensuring that any data access or
+    dimension calculations retrip the barf.
+
+ Basic/Slices/slices.pd |   12 ++++++++++++
+ t/slice-exceptions.t   |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 60 insertions(+), 0 deletions(-)
+
+commit cdf87334b3c6d584d2c8113636abd0e72b0bbe22
+Merge: 02c2a4d 609bed4
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Fri Aug 23 10:38:55 2013 -0600
+
+    Merge branch 'master' of ssh://git.code.sf.net/p/pdl/code
+
+commit 609bed4fee561c2963ea878b26be2df4c10a45c4
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Aug 16 13:20:33 2013 -0400
+
+    Remove FFTW subdir reference from Lib/Makefile.PL
+
+ Lib/Makefile.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 5287a048343041a80705066e1baee26556866840
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Aug 16 13:19:03 2013 -0400
+
+    Purge PDL::FFTW files and refs from the git repository
+
+ DEPENDENCIES         |   11 -
+ Lib/FFTW/Makefile.PL |  199 ---------
+ Lib/FFTW/Readme      |   14 -
+ Lib/FFTW/fftw.pd     | 1099 --------------------------------------------------
+ t/fftw.t             |  137 -------
+ 5 files changed, 0 insertions(+), 1460 deletions(-)
+
+commit bc7f3327de6f990c0b6798cf19ef6083780a1dbe
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Aug 16 13:18:41 2013 -0400
+
+    Update VERSION to 2.006_05 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    9 +--------
+ Release_Notes  |   46 ++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 48 insertions(+), 9 deletions(-)
+
+commit 0c583f9720334f00aceaaf64c1b92dc1a0ef337f
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Aug 16 13:03:02 2013 -0400
+
+    Fix sf.net bug #338 PDL::FFT uses backwards sign convention from FFTW
+    
+    Also clarified some of the docs, added some signatures for the
+    routines, and a WARNING at the top regarding the change in sign
+    convention between forward and reverse FFTs.
+    
+    NOTE: The inverse FFT is normalized so that FFT followed by IFFT
+    are true inverses.  This is different from the unnormalized transform
+    calculated by FFTW.
+
+ Lib/FFT/fft.pd |   30 +++++++++++++++++++++++-------
+ 1 files changed, 23 insertions(+), 7 deletions(-)
+
+commit 378da964582a1975cdaa36f84b248b27237a9bb8
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Aug 10 09:41:17 2013 -0400
+
+    Update Known_problems and Release_Notes for 2.006_04 relase
+
+ Known_problems |   12 ++++++------
+ Release_Notes  |    6 ++++++
+ 2 files changed, 12 insertions(+), 6 deletions(-)
+
+commit 02c2a4db08093ce1fc854a41c362b745e9fc6571
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Thu Aug 8 11:30:20 2013 -0600
+
+    Small spelling, grammar, punctuation changes in Basic.pm and BadValues.pod
+
+ Basic/Core/Basic.pm     |    8 ++++----
+ Basic/Pod/BadValues.pod |    6 +++---
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+
+commit 35d719c6deeeeba8574b5c0939fc7a4c34b55842
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Aug 6 17:52:37 2013 -0400
+
+    Partial fix for tempfile problems in t/flexraw_fortran.t
+    
+    This is some bullet-proofing that shouldn't be needed but
+    some OSes apparently have trouble cleaning things up in
+    a timely fashion. Work around is to use separate tempfiles
+    to reduce impact of the hangs.
+
+ t/flexraw_fortran.t |   13 +++++++------
+ 1 files changed, 7 insertions(+), 6 deletions(-)
+
+commit 8ccb4d2bced306eb73fee05b3cd39974a5834234
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Aug 6 17:25:12 2013 -0400
+
+    Fix verbose output from mn_init()
+    
+    Now it goes to STDERR by default and is prepended by a #
+    which means it won't affect the standard test harness for perl.
+
+ Lib/Minuit/minuit.pd |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 2c0dda61eb18507436cc5c0f819ca536461b215d
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Aug 6 17:15:08 2013 -0400
+
+    Change PDL_Long usage to PDL_Index to handle 64bit index support
+
+ Lib/Minuit/FCN.c |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+commit f63f3450d99610b696b8bdae584db11af6c91b83
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Aug 6 17:14:36 2013 -0400
+
+    Add File::Temp for tempfile generation
+
+ t/minuit.t |    4 ++-
+ t/misc.t   |   86 ++++++++++++++++++++++++++++-------------------------------
+ 2 files changed, 44 insertions(+), 46 deletions(-)
+
+commit 530cebf7e43503758ce61d815ffee727a25ef7b8
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Aug 6 14:35:09 2013 -0400
+
+    Deprecate PDL::FFTW and prepare for removal
+
+ Lib/FFTW/Readme |    6 ++++++
+ Makefile.PL     |    1 +
+ perldl.conf     |   13 ++++---------
+ 3 files changed, 11 insertions(+), 9 deletions(-)
+
+commit 4e4618a974cf449f58b842672583178c753fff99
+Merge: 6a9ff91 6549191
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Aug 2 13:57:43 2013 -0400
+
+    Merge branch 'master' of ssh://git.code.sf.net/p/pdl/code
+
+commit 6a9ff91087432ba7d73ae3ae6095a3274ef4ca4b
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Aug 2 13:56:43 2013 -0400
+
+    Fix PDL_Long usages to PDL_Index
+    
+    Still have to deal with all the int usages as well.
+
+ Basic/Primitive/primitive.pd |   12 +++++-----
+ Lib/ImageND/imagend.pd       |   47 +++++++++++++++++++++--------------------
+ 2 files changed, 30 insertions(+), 29 deletions(-)
+
+commit 65491919c2e8e35e9f5d108183e3de3d94332803
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Jul 29 17:49:57 2013 -0400
+
+    Update CPAN metadata for git repo on sf.net
+    
+    This should make the link from the http://search.cpan.org PDL
+    release page point to the correct location.  Thanks to Christian
+    Walde for reporting the problem.
+
+ Makefile.PL |    6 +++++-
+ 1 files changed, 5 insertions(+), 1 deletions(-)
+
+commit 147b9a44f9f295a174d6bc585f050f9ecdd63555
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Jul 28 10:53:02 2013 -0400
+
+    Fix long usage in PP code to PDL_Index type
+    
+    This usage was found in the following routines
+    in primitive.pd: interpolate, matmult, vsearch
+
+ Basic/Primitive/primitive.pd |   18 +++++++++---------
+ 1 files changed, 9 insertions(+), 9 deletions(-)
+
+commit 1b8b2bf222b1ecb3f465d5cfe1672350cb723786
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Thu Jul 25 22:08:43 2013 -0600
+
+    Remove the TODOs from gd_oo_tests.t
+    
+    It seems that this test failure has been resolved.  Commenting out
+    all the TODO lines for BSD, dragonfly, etc and we'll see if anything
+    breaks on next developer release.
+
+ t/gd_oo_tests.t |   32 ++++++++++++++++----------------
+ 1 files changed, 16 insertions(+), 16 deletions(-)
+
+commit be6021d46553e8f20941532086991227eb7ada83
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Thu Jul 25 22:04:59 2013 -0600
+
+    Fix modulo operator to work on PDL_Index piddles.
+    
+    Since we handle signed and unsigned datatypes separately, and since
+    there was no N type in the typeloop, modulo was just picking up
+    garbage values. Do we need to also add longlong ('Q') types or longdouble?
+    
+    Also added a simple test to ops.t for PDL_Index types.
+
+ Basic/Ops/ops.pd |    2 +-
+ t/ops.t          |    8 ++++++--
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+commit 9b3dc036bd3a1411438815c96928046f297682e4
+Merge: c7edeb2 28092fb
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Sat Jul 13 22:31:10 2013 -0600
+
+    Merge branch 'master' of ssh://git.code.sf.net/p/pdl/code
+
+commit 28092fbc0863a505d324a82c0d7e1d76bd082a40
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jul 9 09:34:47 2013 -0400
+
+    Update/Clean-up some readme-type files
+
+ Known_problems |   13 +--------
+ Perldl2/README |   20 ++++++++-----
+ Perldl2/TODO   |   26 +++++++++---------
+ Release_Notes  |   10 ++++++-
+ TODO           |   80 ++++++++++++++++++++++++-------------------------------
+ 5 files changed, 70 insertions(+), 79 deletions(-)
+
+commit 4d7725723eb5cffc04a08f535acad492d732b0ba
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Sun Jul 7 11:56:02 2013 +0200
+
+    update debian/perldl.conf from perldl.conf
+
+ debian/perldl.conf |   12 +++++++-----
+ 1 files changed, 7 insertions(+), 5 deletions(-)
+
+commit c7edeb27fcf27b6b00bb4fe1c918e39079d61914
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Sat Jul 6 22:06:56 2013 -0600
+
+    Update some links in FAQ.pod.
+    
+    Some changes from the SF.net project platform change.
+
+ Basic/Pod/FAQ.pod |   15 +++++++--------
+ 1 files changed, 7 insertions(+), 8 deletions(-)
+
+commit e4de37f8ff4a5aa7b03d5d91db2fe1d4e4884357
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Jul 6 15:41:36 2013 -0400
+
+    Fix sf.net bug #331 "uniq does not always return proper object"
+    
+    The problem was that for some combinations of input, the output
+    was generated by calling pdl() directly which uses class PDL by
+    default.  I changed the call from pdl([$stuff]) to
+    PDL::pdl(ref($stuff),[$stuff]) and now the appropriate class
+    is obtained.  We probably should scrub the PDL sources for any
+    other raw uses of the pdl() constructor that should be made
+    object type safe.
+
+ Basic/Primitive/primitive.pd |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit f4fb0672f92fe42c6ad49e5c14952564fa2129c4
+Author: Craig DeForest <zowie@z5.boulder.swri.edu>
+Date:   Fri Jul 5 22:54:22 2013 -0600
+
+    Fix fencepost error in coeffs array (apologies if dup - problems with git configuration)
+
+ Lib/Slatec/slatec.pd |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 3e7d2227ff085774327c527089135c0190fb3853
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Tue Jul 2 13:29:57 2013 -0600
+
+    more updates to slatec.pd - handle nonbad cases the same as bad ones.
+
+ Lib/Slatec/slatec.pd |  134 +++++++++++++++++++++++++++++++++-----------------
+ 1 files changed, 88 insertions(+), 46 deletions(-)
+
+commit fdb24f6149fa0105d6eef4bf61573a0095283862
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Wed Jun 26 17:11:04 2013 -0400
+
+    Fix fencepost error for edge case with polyfit() in slatec.pd
+
+ Lib/Slatec/slatec.pd |   29 +++++++++++++++++++++--------
+ 1 files changed, 21 insertions(+), 8 deletions(-)
+
+commit fe0a4857460ef2fcaf03756ec846af80e780fd93
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Mon Jun 24 01:10:56 2013 -0600
+
+    Fix BAD bug in polyfit -- BAD values in Y should not make the correspondin
+    values in R (the fitted output) go BAD.
+
+ Lib/Slatec/slatec.pd |   37 ++++++++++++++++++++++++++++++++++++-
+ 1 files changed, 36 insertions(+), 1 deletions(-)
+
+commit 63263141bac37c85d548281084c7bacc56d1a800
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Jun 12 16:03:09 2013 -0400
+
+    Refactor subclass*.t to use Test::More
+
+ t/subclass.t  |   26 +++++++++-----------------
+ t/subclass2.t |   42 +++++++++++++++++-------------------------
+ t/subclass3.t |   37 ++++++++++++-------------------------
+ t/subclass4.t |   20 ++++----------------
+ 4 files changed, 42 insertions(+), 83 deletions(-)
+
+commit 5a142c42fb6b44137798e866a582c13fa7337e3f
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Tue Jun 4 14:06:50 2013 -0600
+
+    Update some old links in the documentation.
+    
+    Some of these links went bad with the website rewrite a few years ago,
+    some went bad (or can now be improved/shortened) with the sf.net
+    project system upgrade from earlier this year.
+
+ BUGS           |   14 +++++++-------
+ DEVELOPMENT    |    4 ++--
+ Known_problems |    2 +-
+ Makefile.PL    |    4 ++--
+ README         |    4 ++--
+ Release_Notes  |    2 +-
+ 6 files changed, 15 insertions(+), 15 deletions(-)
+
+commit ba6b3abc0a07281314358a3e2b40d09916f3788d
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Mon Jun 3 22:29:27 2013 -0600
+
+    small grammar correction in bad.pd docs
+
+ Basic/Bad/bad.pd |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit c3eaca6210eec0cb4155fc27664134643d2f2a87
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Tue May 28 20:44:15 2013 +1000
+
+    t/callext.t - include the pdlsimple.h that's in blib.
+    
+    Previously Basic/Core/pdlsimple.h was being included.
+    It should be the same as blib/lib/PDL/Core/pdlsimple.h,
+    but it's the *latter* that we really should be testing.
+    I think this is a portable solution. If I'm wrong about
+    that, I'm sure we'll soon find out. (We would then
+    probably have to revert to including the former.)
+
+ t/callext.t |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+commit a9402af6e8f89708728397f1fbd3119aadcd8597
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Tue May 28 20:44:15 2013 +1000
+
+    Lib/CallExt/CallExt.pm - In callext_cc(), place $ccflags before installesitelib/PDL/Core
+    
+    Otherwise the pdlsimple.h that gets included during the t/callext.t 'make test' stage
+    is one that has been previously intalled - not the one that's about to be installed.
+
+ Lib/CallExt/CallExt.pm |    6 ++++--
+ 1 files changed, 4 insertions(+), 2 deletions(-)
+
+commit 514520e2d3d09ec21eb3d4d88d99d9d3348f9ec8
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Fri May 3 02:32:36 2013 -0700
+
+    added unit test for the pp_deprecate_module() warning
+
+ Basic/Test/tests.pd |    3 +++
+ Makefile.PL         |    1 +
+ debian/control      |    3 ++-
+ t/pptest.t          |   12 ++++++++++--
+ 4 files changed, 16 insertions(+), 3 deletions(-)
+
+commit c1b8b40b55a033b733e18f8387f06d34e2408e75
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Fri May 3 01:37:03 2013 -0700
+
+    added pp_deprecate_module() to PDL::PP
+
+ Basic/Gen/PP.pm  |   52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ Basic/Pod/PP.pod |   11 +++++++++++
+ 2 files changed, 62 insertions(+), 1 deletions(-)
+
+commit 5bd7ce43ec7ddff8ca5092ddb9a5951833150f4c
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 26 10:39:58 2013 -0400
+
+    Prepare to deprecate unix only direct mmap code support
+    
+    Adding a warning for now that will be seen if you for some
+    reason are not using the portable File::Map based implementation.
+    The current duplication is confusing and the direct mmap support
+    has not been actively maintained.  This is a final nudge in case
+    anyone still uses the legacy/non-portable implementation.
+
+ IO/FastRaw/FastRaw.pm |    3 ++-
+ IO/FlexRaw/FlexRaw.pm |    3 ++-
+ t/fastraw.t           |    2 --
+ t/flexraw.t           |    2 --
+ 4 files changed, 4 insertions(+), 6 deletions(-)
+
+commit 0d0e8076e00728fef12f19b492519dfac99d4fb2
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 26 10:27:42 2013 -0400
+
+    Update File::Map required version to 0.57
+    
+    This fixes map_anonymous() support for >2**32 sizes and
+    is needed for true 64bit support.
+
+ Makefile.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 9e26c515f32e0b77a12b03773ae29ca261e257ce
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 19 17:44:06 2013 -0400
+
+    Update VERSION to 2.006_04 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |   51 +++++++++++++++++++++++++----------------------
+ MANIFEST.SKIP  |    2 +
+ Release_Notes  |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 4 files changed, 89 insertions(+), 26 deletions(-)
+
+commit f61c938f9c14fb51bf6b735ce0b6188faf4fd972
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat May 18 15:21:18 2013 -0400
+
+    Clean out old CPAN developers release notes from Release_Notes
+    
+    It is useful to have the notes for current development but
+    once an official release is made, it only makes it difficult
+    to figure out what happened when.
+
+ Release_Notes | 5131 +++++++--------------------------------------------------
+ 1 files changed, 557 insertions(+), 4574 deletions(-)
+
+commit b7985c85374287efee954d2993678215d67887be
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat May 18 14:58:13 2013 -0400
+
+    Update $pdl_core_version to 10
+    
+    This marks the merge of the 64bit-index-support branch
+    into our git master development branch.
+
+ Basic/Core/pdlcore.h.PL |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+commit 1669960c0fa394809abeac334af29f9f5fcbd6dc
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri May 17 09:36:07 2013 -0400
+
+    More int to PDL_Index fixes for ufunc.pd
+
+ Basic/Ufunc/ufunc.pd |   16 ++++++++--------
+ 1 files changed, 8 insertions(+), 8 deletions(-)
+
+commit 9f5201dfca23e774a2eb69745b41af66e824569e
+Merge: bd68e02 baf30c6
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 15 22:26:24 2013 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit baf30c665dfb79afb2201fdba5e0750809432baf
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 15 22:25:45 2013 -0400
+
+    Update VERSION to 2.006_03 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   31 +++++++++++++++++++++++++++++++
+ 3 files changed, 33 insertions(+), 2 deletions(-)
+
+commit bd68e02f8599fe0112f842e964c7d44b61b0e855
+Merge: 085eb14 b1d627e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 15 22:21:44 2013 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit b1d627ef3edc94d8122737438d4cf4583c9a758f
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 15 22:21:07 2013 -0400
+
+    Update Release_Notes for another CPAN devel release
+
+ Release_Notes |   11 ++++++++---
+ 1 files changed, 8 insertions(+), 3 deletions(-)
+
+commit 085eb1447ffae46a11abcb6e05270245476453b3
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 15 22:17:10 2013 -0400
+
+    Add some test skips for non-working PDL_Index
+
+ t/gsl_mroot.t       |    3 +-
+ t/iotypes.t         |    5 ++-
+ t/pdl_from_string.t |   52 ++++++++++++++++++++++++++------------------------
+ 3 files changed, 32 insertions(+), 28 deletions(-)
+
+commit 07121370a3f0481eaea7b4fc51e612a37db2288a
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 15 17:56:54 2013 -0400
+
+    Fix problems with missing convertfunc for PDL_Index
+    
+    As in it is *not* lc($type=~s/PDL_/) when $type is 'PDL_Index'
+    I think it is coming along but the entire generation and use
+    of the Types.pm and the PDLCode.pm use of same is entirely too
+    hard to follow and needs to be cleaned up for PDL-3 to really
+    go anywhere.
+
+ Basic/Core/Types.pm.PL  |    6 ++++--
+ Basic/Gen/PP/PDLCode.pm |    4 +++-
+ Basic/Slices/slices.pd  |   10 +++++-----
+ Basic/Ufunc/ufunc.pd    |   42 +++++++++++++++++++++---------------------
+ Lib/Slatec/slatec.pd    |    2 +-
+ 5 files changed, 34 insertions(+), 30 deletions(-)
+
+commit 4e967900516281e15462bb0fcb780bf862e8d05e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 15 13:00:33 2013 -0400
+
+    Turn off pp_def debug output from Lib/Slatec/slatec.pd
+
+ Lib/Slatec/slatec.pd |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 253542e6af17d9f3b9b6e535d4a57ea023c857c7
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 15 12:48:02 2013 -0400
+
+    Add (int) cast to t/callext.c in case PDL_Index is 64bit
+
+ t/callext.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit b94c5e8481e59b374150b3b4dbb0510070a39784
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 15 10:34:31 2013 -0400
+
+    More fixes to support PDL_Index as a full type
+    
+    Seems to work now but I'm thinking it may make sense
+    that PDL_Index is actually a typesynonym for either
+    PDL_Long or PDL_LongLong rather than having a type of
+    its own.  Not sure how that will affect the code gen
+    machinery.
+
+ Basic/Slices/slices.pd |   10 +++++-----
+ Basic/Ufunc/ufunc.pd   |   28 ++++++++++++++--------------
+ Lib/Image2D/image2d.pd |    2 +-
+ 3 files changed, 20 insertions(+), 20 deletions(-)
+
+commit a6a69f2140cdff9bb0fd2bc04589d274dc8bd5fd
+Merge: cba1bba 47de79d
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 15 09:15:29 2013 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit cba1bba8f73bb96c571300dd00bc04473f64d450
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 15 08:09:49 2013 -0400
+
+    Add PDL_Index type to Types.pm.PL
+    
+    And make other mods to support.  Making perldl.conf WITH_*
+    to undef to more general testing takes place and to fix
+    the problem with missing ExtUtils::F77 and fortran.
+
+ Basic/Core/Types.pm.PL  |   22 +++++++++++-----------
+ Basic/Core/pdl_hfiles.p |    2 +-
+ Lib/Image2D/image2d.pd  |    2 +-
+ perldl.conf             |   16 ++++++++--------
+ 4 files changed, 21 insertions(+), 21 deletions(-)
+
+commit 47de79da6c288f1cf144977dbc594cd60224ea44
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Mon May 13 14:37:25 2013 -0400
+
+    use _strtoi64 instead of strtoll for MSVC
+
+ Basic/Slices/slices.pd |    8 ++++++++
+ 1 files changed, 8 insertions(+), 0 deletions(-)
+
+commit 5307029ecdb5132db217b6d83ea54f1bda8586e4
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 12 17:04:08 2013 -0400
+
+    Skip t/minuit.t unless WITH_MINUIT was true
+
+ t/minuit.t |   22 +++++++++++++---------
+ 1 files changed, 13 insertions(+), 9 deletions(-)
+
+commit b89dd783a6d020a6bc518556110a0a5e034b4159
+Merge: 367a224 1660c0c
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 12 16:14:09 2013 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit 1660c0c804601d8f06cfe2a9424a86500fb39415
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 12 16:13:08 2013 -0400
+
+    Update VERSION to 2.006_02 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   44 ++++++++++++++++++++++++++++++++++++++++++--
+ 3 files changed, 44 insertions(+), 4 deletions(-)
+
+commit 367a224778fa335348b3b44870624929dc68edb7
+Merge: b42154e 721d11d
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 12 16:04:06 2013 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit b42154ec7f0775ad9c70434a2f1a23982acd389a
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 12 15:40:01 2013 -0400
+
+    Mention perldl.conf has options off
+
+ Release_Notes |    3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+commit 07a7823353b866b9145965c57f3e72712e9a9007
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 12 15:36:55 2013 -0400
+
+    Update Known_problems and Release_Notes for 2.006_01 release
+    
+    This is a CPAN developers release to allow for general
+    testing and exercise of the new 64bit index support code.
+
+ Known_problems |    7 +++----
+ Release_Notes  |    8 +++++++-
+ 2 files changed, 10 insertions(+), 5 deletions(-)
+
+commit ce266b85f199e0a65bae67383d5923942d2e9882
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 12 15:26:22 2013 -0400
+
+    Set type of PDL_Index from $Config{ivtype}
+
+ Basic/Core/Types.pm.PL  |   27 ++++++++++++++++-----------
+ Basic/Core/pdl_hfiles.p |    8 +++++++-
+ 2 files changed, 23 insertions(+), 12 deletions(-)
+
+commit 721d11d8d51fa5b5e22382b88749896d4f358f7b
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Fri May 10 11:08:23 2013 -0600
+
+    Fix to make Inline::Pdlpp visible in the docs
+    
+    Problem arose because POD for Inline::Pdlpp was in file PP-Inline.pod,
+    which made the doc generator/html linkifier not work too well.  Now
+    Inline::Pdlpp shows up in PDL::Index, and links correctly in the HTML
+    documentation.
+
+ Doc/Doc.pm       |    4 ++--
+ Doc/mkhtmldoc.pl |   22 ++++++++++++++++++++++
+ 2 files changed, 24 insertions(+), 2 deletions(-)
+
+commit d47eca06ce07d0dfda3e87b6ed0b00ca248573ea
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Fri May 10 11:06:38 2013 -0600
+
+    Some documentation fixes.
+
+ Basic/Core/Core.pm.PL |    6 +++++-
+ Basic/Ops/ops.pd      |    6 +++---
+ Doc/Doc.pm            |    6 +++---
+ 3 files changed, 11 insertions(+), 7 deletions(-)
+
+commit 65194303cb7256184bb7dfd2a84ea4c5ae80548d
+Merge: e31cb3a cde0c39
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon May 6 19:17:20 2013 -0400
+
+    Merge branch '64bit-index-support' of ssh://git.code.sf.net/p/pdl/code into 64bit-index-support
+
+commit cde0c3967c19758546a97745c93c91023cd92753
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon May 6 13:15:11 2013 -0400
+
+    Replace int by PDL_Index for threadloop code indexing
+    
+    Looks like I missed these.  There may be more...
+
+ Basic/Gen/PP/PDLCode.pm |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 6003a27f1440853c21a7b31e19f1c6fb0b24bc0d
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon May 6 13:14:49 2013 -0400
+
+    Clean up some warning in t/proj_transform.t
+
+ t/proj_transform.t |    9 ++++++---
+ 1 files changed, 6 insertions(+), 3 deletions(-)
+
+commit e31cb3a0d8d93d5d6b30dfc66a5239f0b4fae560
+Merge: 378252d 05a10e7
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 5 20:17:53 2013 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit 378252de6f9d6053ff6df05b382b1d2120c1ed6b
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 5 20:15:50 2013 -0400
+
+    Fix use of int for loop with $pdl->nvals
+    
+    Should be PDL_Index type since nvals is now of PDL_Index type.
+
+ Basic/Gen/PP.pm |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit a5d4239b7535423f496629a817bb2a4a2d3ae213
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 5 20:15:18 2013 -0400
+
+    Apply Dima fix for int/PDL_Index confusion
+
+ Basic/Slices/slices.pd |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 05a10e766d0af1833a65b981dd3ad57cbe4f598a
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Fri May 3 02:09:27 2013 -0700
+
+    spelling fix
+
+ t/complex.t |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit cf14c9978aa8e9217b853af6de264df355e872a2
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Apr 28 10:25:09 2013 -0400
+
+    Set some options for SLATEC debugging w 64bit
+
+ Lib/Slatec/slatec.pd |    2 +-
+ perldl.conf          |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit af69f3a1534d39fa1b552fdc9533c637ac657063
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Apr 28 10:22:25 2013 -0400
+
+    More PDL_Long to PDL_Index fixes
+    
+    Still getting test failures and trying to track them
+    down.  What I'm seeing with cygwin/win7 is tests pass
+    when run via 'perl -Mblib t/testname.t' while if run
+    using 'prove -b t/testname.t' then they fail.  Probably
+    still some index/datatype that is still not consistent.
+
+ Basic/Gen/PP/Dims.pm      |    2 +-
+ Basic/Gen/PP/PdlParObj.pm |    4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+commit 38ebc589f0503693d2064252a6d7a30434a0973b
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Apr 28 10:21:52 2013 -0400
+
+    Clean up some test output for better debugging
+
+ t/limits_ulimits.t |    2 +-
+ t/slatec.t         |   40 ++++++++++++++++++++--------------------
+ 2 files changed, 21 insertions(+), 21 deletions(-)
+
+commit 7876fc6405af6a05d943d284980229881720b8b9
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Fri Apr 12 00:01:09 2013 -0700
+
+    fixed incorrect URL in the known problems file
+
+ Known_problems |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit a71300329c88c2ecd2493d1b2a8c966ba25901c3
+Merge: 046745a 9c66b0a
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Apr 26 10:47:05 2013 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit 9c66b0a5f9cd90c102654d24c0882b738a8b311f
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Apr 26 10:45:52 2013 -0400
+
+    Fix PDL::shape to return vector for 1-D piddles
+
+ Basic/Core/Core.pm.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit e78ef4c02f13171e3108c79f1aae2dc24c2f5c0d
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Sat Apr 13 00:11:24 2013 -0600
+
+    Changed minimum version of PDL in PDL::NiceSlice Makefile.PL
+    
+    No change in actual number, just in the representation to agree with the current usage.
+    This was triggering a warning during Makefile.PL
+
+ Basic/SourceFilter/Makefile.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 092cd754d5534107a2f83671156989be4cf707aa
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Sat Apr 13 00:10:48 2013 -0600
+
+    Re-add some tests to transform.t that got overwritten recently.
+
+ t/transform.t |    9 ++++++++-
+ 1 files changed, 8 insertions(+), 1 deletions(-)
+
+commit b05be75d2affd589680cd808d0db93e14acb79d0
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Apr 11 10:05:24 2013 -0400
+
+    Add PDL::NiceSlice line offset to Known_problems
+
+ Known_problems |    7 +++++++
+ 1 files changed, 7 insertions(+), 0 deletions(-)
+
+commit 85ebb8e4a6909e9047207f5eb47ed3f988054fda
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Wed Apr 10 18:21:54 2013 -0700
+
+    fftw.pd: fixed typo
+
+ Lib/FFTW/fftw.pd |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit c3e2206d40d71998c92c4ebd133b267d00fe6d22
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Wed Apr 10 04:26:45 2013 -0700
+
+    fftw: improved an error message
+
+ Lib/FFTW/fftw.pd |    5 +++--
+ 1 files changed, 3 insertions(+), 2 deletions(-)
+
+commit 535bf65896d00d1bd549cff0c3bd4fdcb243fab8
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Wed Apr 10 04:23:48 2013 -0700
+
+    unduplicated a type check in fftw.pd
+
+ Lib/FFTW/fftw.pd |   45 +++++++++++++++++----------------------------
+ 1 files changed, 17 insertions(+), 28 deletions(-)
+
+commit 3622ff94ac63453547453e80e909bca4fb7e18c6
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Wed Apr 10 02:54:07 2013 -0700
+
+    fixed incorrect docs in PDL::Complex, and added modern example
+
+ Basic/Complex/complex.pd |   56 ++++++++++++++++++++++++++++++++++++++-------
+ 1 files changed, 47 insertions(+), 9 deletions(-)
+
+commit 4746843c81ff0e615749e795dc2ae3d006dbe0f2
+Author: Diab Jerius <djerius@cfa.harvard.edu>
+Date:   Wed Apr 10 16:49:55 2013 -0400
+
+    fix rare "Bizarre copy of HASH in scalar assignment"
+    
+    On rare occasions Perl would emit a fatal "Bizarre copy of HASH in
+    scalar assignment" error.  This is "solved" by lexicalizing the hash
+    passed to WriteMakefile.  Makefile.PL now passes strict & warnings.
+
+ Lib/Transform/Proj4/Makefile.PL |   35 ++++++++++++++++++++++-------------
+ 1 files changed, 22 insertions(+), 13 deletions(-)
+
+commit 3c1d64f6991e1cb7989811e0038efd64dd7aaacd
+Author: Diab Jerius <djerius@cfa.harvard.edu>
+Date:   Wed Apr 10 16:48:39 2013 -0400
+
+    fix copy&paste error; gis_proj_lib_path => transform_proj4_lib_path
+
+ Lib/Transform/Proj4/Makefile.PL |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 9d8ee08cf29fc20b601d2bd2c3d1c5550f516b0b
+Author: Dima Kogan <dima@secretsauce.net>
+Date:   Tue Apr 9 04:24:14 2013 -0700
+
+    PDL::IO::GD->new() is now less picky about it args, and no longer crashes
+    
+    Previously PDL::IO::GD->new() accepted ONLY a hashref as an argument. Given
+    anything else, a segfault resulted. With this patch segfaults no longer happen.
+    Also, in addition to accepting a hashref, it is now possible to pass in inline
+    hashes or just a single-argument filename.
+
+ IO/GD/GD.pd     |   45 ++++++++++++++++++++++++++++++++++++++++++---
+ t/gd_oo_tests.t |   29 +++++++++++++++++++++++++++--
+ 2 files changed, 69 insertions(+), 5 deletions(-)
+
+commit 046745a99caa8e2ba14d54833061ec2801030fc2
+Merge: 22af89b 12910e7
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Apr 5 10:36:57 2013 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit 12910e7f5491836936a00445876373f031d7f205
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Thu Apr 4 22:10:34 2013 -0600
+
+    shut up warning about nonlinear FITS transformations
+
+ Lib/Transform/transform.pd |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+commit 3de9f56dbbf9fc7a81aad6564b4c03dc085f0627
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Thu Apr 4 14:29:27 2013 -0600
+
+    oops - fix merge
+
+ t/transform.t |   11 -----------
+ 1 files changed, 0 insertions(+), 11 deletions(-)
+
+commit fd6f2d2c6832f2983dc029d8a2a74645c1fae92c
+Merge: 4af8e15 6961caa
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Thu Apr 4 14:27:46 2013 -0600
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+    
+    Conflicts:
+    	t/transform.t
+
+commit 4af8e15a2aec78f388bd96021395d51ab35e2192
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Thu Apr 4 14:25:32 2013 -0600
+
+    fix badvalue-on-truncate support for map and for interpND
+
+ Basic/Primitive/primitive.pd |   10 ++++++-
+ Lib/Transform/transform.pd   |   55 ++++++++++++++++++++++++++---------------
+ t/transform.t                |   31 +++++++++++++++++++++--
+ 3 files changed, 71 insertions(+), 25 deletions(-)
+
+commit 6961caafb349a78aa163dc7cf1c36f3cb75e00fd
+Merge: a0a9e52 2a14ed6
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Thu Apr 4 11:45:42 2013 -0600
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit a0a9e52ff0cb05b597bcc4441f1b5fff2b7023dc
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Thu Apr 4 11:44:56 2013 -0600
+
+    Add a couple no-op tests to t/transform.t
+
+ t/transform.t |   12 +++++++++++-
+ 1 files changed, 11 insertions(+), 1 deletions(-)
+
+commit 22af89bfe1f2189ba9c0f1dab7b62e7e4b57ceda
+Merge: 3c73915 6f97ce0
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Mar 28 09:28:56 2013 -0400
+
+    Merge branch '64bit-index-support' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl into 64bit-index-support
+
+commit 3c7391503fde007219165cb32517808e23cf42a9
+Merge: dbdbab8 2a14ed6
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Mar 28 09:28:45 2013 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit 2a14ed6276b63c0f9642cc38f5874067775535d7
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Mar 28 09:23:18 2013 -0400
+
+    Fix %hash randomization bugs in PDL tests
+    
+    It appears that t/hdr.t and t/niceslice.t tests
+    had hash comparison checks assuming (%h1) and (%h2)
+    if the two hashes were equal.  This should fix
+    perl 5.17.x failures for PDL-2.006
+
+ t/hdrs.t      |    6 +++++-
+ t/niceslice.t |   10 ++++++++--
+ 2 files changed, 13 insertions(+), 3 deletions(-)
+
+commit 30257deb515e1d273414f68ceea2b3e58a05d1e0
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Mar 24 12:44:36 2013 -0400
+
+    Fix rcols with colsep and $PDL::undefval
+    
+    Missing fields in the middle were being returned
+    as the empty string '' rather than undef which happened
+    if they were at the end.  Now mapping them uniformly
+    to undef.  This is sf.net bug #3608928
+
+ IO/Misc/misc.pd |    3 +++
+ t/misc.t        |   22 +++++++++++++++++++++-
+ 2 files changed, 24 insertions(+), 1 deletions(-)
+
+commit 6f97ce085fc686830f6fd333f6389d56cc1c7ebc
+Merge: a2b8cfc 63d7bc9
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Mar 23 19:40:37 2013 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit 63d7bc9ee3307e44c79ce69a3fe4cb03f24cf954
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Mar 23 19:39:22 2013 -0400
+
+    Update VERSION to 2.006_01 for new development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   32 ++++++++++++++++++++++++++++++++
+ 3 files changed, 34 insertions(+), 2 deletions(-)
+
+commit 0fd0d37b2bd8b83cbdbbe2119a3c5bedf2cc2e30
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Mar 23 10:02:31 2013 -0400
+
+    Remove read only Index.pod so scantree.pl works
+
+ Doc/scantree.pl |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+commit 36aa7f2fce87c07899e07413132241d5357851ae
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Mar 23 09:27:57 2013 -0400
+
+    Make sure placeholder Index.pod does not get installed
+    
+    Since it was being installed first, the scantree.pl script
+    failed because it couldn't open the destination location.
+
+ Basic/Pod/Makefile.PL |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+commit bd0abf38431284dfdb4475fe34f8775a19c76c3d
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Fri Mar 22 22:44:29 2013 -0600
+
+    Add a more informative message to Gnuplot demo if PDL:Graphics::Gnuplot is missing.
+
+ Demos/Gnuplot_demo.pm |   20 ++++++++++++++++++--
+ 1 files changed, 18 insertions(+), 2 deletions(-)
+
+commit b6fd1d5a78a9bd5f1c3e43659d2653a94cb8db3c
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Mar 22 19:40:22 2013 -0400
+
+    Remove unix-only double check for gnuplot
+    
+    The Gnuplot_demo.pm was failing due to a unix-only
+    test for the gnuplot executable.  Removed that code
+    and added a bit more downsampling for the last set
+    of 3d images for speed.
+
+ Demos/Gnuplot_demo.pm |   21 +++++----------------
+ 1 files changed, 5 insertions(+), 16 deletions(-)
+
+commit 7078eeacf44cfcf4efe2e09a820dcf95308ad8e2
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Mar 22 18:30:35 2013 -0400
+
+    Update permissions on new Index.pod
+
+ 0 files changed, 0 insertions(+), 0 deletions(-)
+
+commit dcbd3f580adc4de86934e86659dc43da263cc961
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Mar 22 18:28:04 2013 -0400
+
+    Add a default Index.pod for online browsing
+
+ Basic/Pod/Index.pod |  615 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ MANIFEST            |    1 +
+ 2 files changed, 616 insertions(+), 0 deletions(-)
+
+commit f5db95b64fa6ea6a916679641a6069e04980e294
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Mar 22 18:23:17 2013 -0400
+
+    Finished Release_Notes for PDL-2.006
+
+ Release_Notes |  155 +++++++++++++++++++++++++++++++++++++++++++++++++--------
+ 1 files changed, 133 insertions(+), 22 deletions(-)
+
+commit 3daaafa42a688c3e1dade51a29414710b6fe9aff
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Mar 22 15:46:51 2013 -0400
+
+    Minor tweaks to some INSTALL/READMEs
+
+ cygwin/INSTALL |    2 +-
+ cygwin/README  |   17 +++++++++++++++++
+ win32/INSTALL  |    2 +-
+ 3 files changed, 19 insertions(+), 2 deletions(-)
+
+commit 7ac83fa02429ad3c7086e14316b0fcfb28f5fbdd
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Mar 22 15:46:30 2013 -0400
+
+    Make gnuplot and prima demos in list match perldl ones
+
+ Perldl2/Profile/Perldl2.pm |    7 +++----
+ 1 files changed, 3 insertions(+), 4 deletions(-)
+
+commit ec7ed388e8a11c15090bc2a0c6086e9bf185ba26
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Mar 22 15:36:06 2013 -0400
+
+    Update VERSION to 2.006 for release in readme's
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |   11 +----------
+ Release_Notes  |   44 ++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 46 insertions(+), 11 deletions(-)
+
+commit 870f5406de6381a5d821edd52e4e12c947d355fc
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Thu Mar 21 22:51:55 2013 -0700
+
+    Fix bug 3608123 -- Diab's topdl bug
+
+ Basic/Core/Core.pm.PL                    |    1 +
+ Lib/Transform/Cartography/Cartography.pm |   10 +++++-----
+ t/core.t                                 |    6 +++++-
+ 3 files changed, 11 insertions(+), 6 deletions(-)
+
+commit dbdbab88188cce7e9f72db86e4d035e0f574f2a4
+Merge: a2b8cfc d564d3b
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Mar 19 08:52:44 2013 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit d564d3b43998ea91e8728943a70647271312db79
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Mon Mar 18 09:50:22 2013 -0500
+
+    Prima demo font size tweaks
+
+ Demos/Prima.pm |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+commit 902c589fefead688effc391c7ff334842086fd3f
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Mon Mar 18 08:40:02 2013 -0500
+
+    Prima demo tweaks
+
+ Demos/Prima.pm |   63 +++++++++++++++++++++++++++++++++++++++++++++++++------
+ 1 files changed, 56 insertions(+), 7 deletions(-)
+
+commit a316441ebe1937d0b7e566e3d41c3b3521ae53c5
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Sun Mar 17 12:58:13 2013 -0500
+
+    Minor updates and corrections to Prima demo
+
+ Demos/Prima.pm |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit a23c7a65c968aad948cb75270f868958b1c71e21
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Sun Mar 17 12:46:09 2013 -0500
+
+    A few random notes added to PP.pod
+
+ Basic/Gen/PP.pm |   10 +++++++++-
+ 1 files changed, 9 insertions(+), 1 deletions(-)
+
+commit 5be7d5be961c588a9321b9ce78b293a8d69843f5
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Sun Mar 17 12:43:52 2013 -0500
+
+    Merged forked work on Prima demo
+
+ Demos/Prima.pm |   22 ++++++++--------------
+ 1 files changed, 8 insertions(+), 14 deletions(-)
+
+commit 5ecfc9c0f443559587d7a9ee30b9419e3c3d7902
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Mar 15 10:15:33 2013 -0400
+
+    Update Known_problems, Release_Notes, and MANIFEST
+
+ Known_problems |    9 +++++++++
+ MANIFEST       |    1 +
+ Release_Notes  |    8 ++++++++
+ 3 files changed, 18 insertions(+), 0 deletions(-)
+
+commit 066fa91be01b9400e21ed1e835596ce392031816
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Thu Mar 14 23:41:40 2013 -0600
+
+    update gnuplot demo to not specify a particular font
+
+ Demos/Gnuplot_demo.pm |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 7f4057fcbc161083881ee67613dd61cea71fce3d
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Wed Mar 13 17:14:47 2013 -0600
+
+    Fix inplace-with-duplicate-argument bug in PP; trim some dust bunnies in Ops.
+
+ Basic/Gen/PP.pm  |    2 +-
+ Basic/Ops/ops.pd |    2 --
+ 2 files changed, 1 insertions(+), 3 deletions(-)
+
+commit 6b193fc1c16fd3b06e2728110647bb1552c1904a
+Merge: 3260b26 202688b
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Wed Mar 13 16:47:47 2013 -0600
+
+    fix inplace related bug in transform (work around core bug)
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit 3260b26de273f5b868cc022bea8299513677496f
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Wed Mar 13 16:43:43 2013 -0600
+
+    Transform explicitly clears inplace flag (works around core bug that causes crashes)
+
+ Lib/Transform/transform.pd |   12 +++++++++---
+ t/transform.t              |   15 +++++++++++++--
+ 2 files changed, 22 insertions(+), 5 deletions(-)
+
+commit 202688b48d5ba4795da59877f236d838d9d9079e
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Wed Mar 13 11:52:39 2013 -0500
+
+    Stricter Prima detection and more informative fail message for Prima demo
+
+ Demos/Prima.pm |   17 +++++++++++++----
+ 1 files changed, 13 insertions(+), 4 deletions(-)
+
+commit 13dc7e6ec1923ff77c3ec90390e454da1b924e71
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Wed Mar 13 10:47:00 2013 -0500
+
+    Fixed window-not-really-closed issue with the Prima demo
+
+ Demos/Prima.pm             |    5 ++++-
+ Perldl2/Profile/Perldl2.pm |    2 ++
+ Release_Notes              |    2 +-
+ 3 files changed, 7 insertions(+), 2 deletions(-)
+
+commit 42a6027655b7fa3c807febf112f01ff2e044a639
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Wed Mar 13 02:46:02 2013 -0500
+
+    Added demo for PDL::Graphics::Prima to perldl
+
+ Demos/Makefile.PL |    1 +
+ Demos/Prima.pm    |  562 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ perldl.PL         |    2 +
+ 3 files changed, 565 insertions(+), 0 deletions(-)
+
+commit 5883818f07eba34b5922d00bd8bdedd6dce60be4
+Merge: 726ccc0 5b1a4f4
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Mon Mar 11 22:53:19 2013 -0600
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+    got a couple of commits behind...  (update pic converters so wpic/rpic
+    at least preserves image dimensions for ps images)
+
+commit 726ccc07335004b6578cdd333d23e959ae21de72
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Mon Mar 11 22:50:24 2013 -0600
+
+    Fix ps to/from conversion to at least preserve image dimensions (and use pnmtops instead of gs).
+
+ IO/Pnm/Pic.pm |    5 ++---
+ 1 files changed, 2 insertions(+), 3 deletions(-)
+
+commit 5b1a4f4b1291482170dc5369b6c9d2c715aeeb09
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Mar 11 15:09:17 2013 -0400
+
+    Fix overwrite problem in imag2d/imag2d_update
+
+ Graphics/Graphics2D.pm |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit ba9baed6c86937902ebca11cd7037aa45a4082d9
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Mar 10 21:48:30 2013 -0400
+
+    Update version to PDL-2.004_997 for final development
+    
+    This is a.k.a. PDL-2.006 rc3
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   34 ++++++++++++++++++++++++++++++++++
+ 3 files changed, 36 insertions(+), 2 deletions(-)
+
+commit a17fb16f1203902e7ae789e8a35a9939154841b2
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Mar 10 21:44:32 2013 -0400
+
+    Update readme files and MANIFEST for CPAN
+
+ Known_problems |    6 +-----
+ MANIFEST       |    1 +
+ Release_Notes  |   17 ++++++++++++++++-
+ 3 files changed, 18 insertions(+), 6 deletions(-)
+
+commit f4204a6de77a61081561671efdd7396f76c96c9a
+Merge: d9e59d0 1709994
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Sat Mar 9 00:36:42 2013 -0700
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit d9e59d005600b5e871b01f660a6b95ed0d32afab
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Sat Mar 9 00:34:31 2013 -0700
+
+    Fix problem with cat not threading properly.  Add appropriate tests.
+
+ Basic/Core/Core.pm.PL |   18 ++++++++++++++----
+ t/core.t              |    8 +++++++-
+ 2 files changed, 21 insertions(+), 5 deletions(-)
+
+commit 17099949b61baa4f5af0093f74cf0b28dd22cc5c
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Mar 7 10:02:01 2013 -0500
+
+    Fix pod for Datatype_conversions so 'apropos types' finds it
+    
+    This wouldn't be necessary if we had keywords in the PDL
+    docs database and tools.
+
+ Basic/Core/Core.pm.PL |    6 ++++--
+ 1 files changed, 4 insertions(+), 2 deletions(-)
+
+commit c6004152021f74425508933ffbb30eab3485ab35
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Wed Mar 6 17:52:59 2013 -0600
+
+    Fixed pdl-from-string doc error in QuickStart
+
+ Basic/Pod/QuickStart.pod |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 690b49167db04b659b34c7cc23d506b5c0edfc89
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Mar 6 18:00:04 2013 -0500
+
+    Add $PDL::PREFIX_RE to perldl and pdl2
+    
+    This automatically strips prefixes matching the PDL shell
+    prompts so that cutting and pasting from the example output
+    in the PDL Book will just work.  In addition to adding that
+    to perldl (already was in pdl2), we now strip out the
+    leading prefix if found from the entries in the history
+    list.
+
+ Perldl2/Plugin/PDLCommands.pm |   11 ++++++++---
+ Perldl2/Profile/Perldl2.pm    |    7 ++++---
+ perldl.PL                     |   12 ++++++++++--
+ 3 files changed, 22 insertions(+), 8 deletions(-)
+
+commit c18dcc1d43de663bab634632d8f26d659099ed5f
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Sun Mar 3 21:36:55 2013 -0700
+
+    Insert friendly warning in case gnuplot isn't present.
+
+ Demos/Gnuplot_demo.pm |   16 +++++++++++++++-
+ 1 files changed, 15 insertions(+), 1 deletions(-)
+
+commit 3794b04e18ee27eed8d2d088a3d5bfefe7935b86
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Sun Mar 3 21:30:04 2013 -0700
+
+    Add Gnuplot demo support - move Gnuplot_demo.pm from PDL::Graphics::Gnuplot to the demos tree; group gnuplot with the other packages.
+
+ Demos/Gnuplot_demo.pm |  313 +++++++++++++++++++++++++++++++++++++++++++++++++
+ Demos/Makefile.PL     |    1 +
+ perldl.PL             |    4 +-
+ 3 files changed, 316 insertions(+), 2 deletions(-)
+
+commit b513b04f145cbe20e214037c271ef211804ceb20
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Mar 3 11:51:55 2013 -0500
+
+    Add Gnuplot_demo.pm support to perldl and pdl2
+    
+    NOTE: the demo loading needs to be made more robust
+    against missing dependencies.  PDL::Graphics::Gnuplot
+    needs to install the demo file into the correct install
+    location.
+
+ Perldl2/Profile/Perldl2.pm |    5 ++++-
+ perldl.PL                  |    5 ++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+commit 4de9846dac1df48a66f66f79a5fd31900e8d980e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Mar 2 18:32:27 2013 -0500
+
+    Update version to 2.004_996 for final fixes and docs updates
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   34 ++++++++++++++++++++++++++++++++++
+ 3 files changed, 36 insertions(+), 2 deletions(-)
+
+commit a9d9dffe9f169d62d0070a56aa76082650e8f035
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Mar 2 10:08:15 2013 -0500
+
+    Update readme type files for CPAN developers release
+
+ DEPENDENCIES   |   16 +++++++---------
+ Known_problems |   24 +++++++++++-------------
+ Release_Notes  |    9 ++++++++-
+ 3 files changed, 26 insertions(+), 23 deletions(-)
+
+commit 7bbab7d7a2a5d05207dd9abb02da11060079f38e
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Fri Mar 1 13:00:24 2013 -0700
+
+    Potential fix for crashing gd_oo_tests (SF.net #3518190).
+    
+    The IMG_PTR needed to be a longlong, but was a long.  At that made all the difference.
+    I do not have BSD AMD64, but was getting a segfault after "ok 19" when the DESTROY
+    was called.  I have not removed the TODO from the gd_oo_tests.t, we should do that
+    after it is certain that this does not break anything for anybody else.
+
+ IO/GD/GD.pd     |   15 +++++++++------
+ t/gd_oo_tests.t |    2 +-
+ 2 files changed, 10 insertions(+), 7 deletions(-)
+
+commit e3d159110c14776aac179e687718fad0ba72f363
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Thu Feb 28 23:24:59 2013 -0700
+
+    Add pdl executable to .gitignore
+
+ .gitignore |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 7f8c26570999383c49ebc4dfc309ca8e10ef49b1
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Thu Feb 28 23:22:10 2013 -0700
+
+    Update Known_problems with RAST to PNM conversion error in Netpbm.
+    
+    No workaround in the test suite, it seems to be a rare problem.
+
+ Known_problems |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+commit 726bacdafde2832b10931b5ce2ddfdd526213429
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Thu Feb 28 23:16:41 2013 -0700
+
+    Small tweaks to PLplot Makefile.PL and test file
+    
+    In the t/plplot.t, added some logic to skip the final test on darwin.
+    The SVG file PLplot generates is large but valid. Also zero-padded the
+    names of the output files (test2.svg --> test02.svg) so they would be
+    in numerical and lexical order in directory listings, for debugging purposes.
+    In the Makefile.PL, I added some logic to remove the 'temp' executable so
+    that the build directory would stay clean.
+
+ Graphics/PLplot/Makefile.PL |    7 +++++--
+ t/plplot.t                  |   41 ++++++++++++++++++++---------------------
+ 2 files changed, 25 insertions(+), 23 deletions(-)
+
+commit dd1d3f8a2e01d5266374313cb7ce4e3d8e3d4ab9
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 27 10:16:17 2013 -0500
+
+    Update VERSION to 2.004_995 for release candidate 1
+    
+    This is the start of code freeze for PDL-2.006.
+
+ Basic/PDL.pm   |    3 +--
+ Known_problems |    2 +-
+ Release_Notes  |   34 ++++++++++++++++++++++++++++++++++
+ 3 files changed, 36 insertions(+), 3 deletions(-)
+
+commit 51a344147a4b2934412369e6529c1feacf3518ab
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 27 09:53:39 2013 -0500
+
+    Update MANIFEST for PDL-2.004_012 release
+
+ MANIFEST |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit c9894671f48f3b9810f4b2cd60214424ac87a764
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 27 09:31:48 2013 -0500
+
+    Switch to legacy PDL::NiceSlice engine for PDL-2.006
+    
+    Also update Release_Notes and Known_problems for the
+    PDL-2.004_012 CPAN developers release.
+
+ Basic/SourceFilter/NiceSlice.pm |    5 +++--
+ Known_problems                  |   16 +++++-----------
+ Release_Notes                   |   18 +++++-------------
+ 3 files changed, 13 insertions(+), 26 deletions(-)
+
+commit 4dc269ed971e989a0901a7a8210bf55e28bb5efe
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Tue Feb 26 20:56:15 2013 -0700
+
+    Remove NiceSlicing from FITS and Transform
+
+ IO/FITS/FITS.pm            |   22 ++++----
+ Lib/Transform/transform.pd |  117 +++++++++++++++++++++----------------------
+ 2 files changed, 68 insertions(+), 71 deletions(-)
+
+commit ee0e9ef42d79017e618b48f9da16530b1c4bfead
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Tue Feb 26 14:30:41 2013 -0700
+
+    clean up pdl executable on "make clean"
+
+ Makefile.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 379b3e63615bdfcd0e319af1fd7bdc0cbf008243
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Feb 25 13:12:40 2013 -0500
+
+    Update TODO file for consistency
+
+ TODO |   42 +++++++++++++++++++++++++++++++++---------
+ 1 files changed, 33 insertions(+), 9 deletions(-)
+
+commit 155eb1519ca1e71b0ade8cc86f7b311b05abddd2
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Feb 24 20:54:16 2013 -0500
+
+    Add Module::Compile engine option to PDL::NiceSlice
+    
+    Still looking for the best way to implement the improved
+    PDL::NiceSlice sourcefiltering.  Unfortunately, all the
+    options so far all have a gotcha of some sore to them...
+
+ Basic/Core/Makefile.PL              |    2 +-
+ Basic/SourceFilter/Makefile.PL      |    1 +
+ Basic/SourceFilter/ModuleCompile.pm |   11 +++++++++++
+ Basic/SourceFilter/NiceSlice.pm     |    1 +
+ Lib/GIS/Proj/Makefile.PL            |    2 +-
+ Makefile.PL                         |    3 +++
+ 6 files changed, 18 insertions(+), 2 deletions(-)
+
+commit 2a0a46fd450c9a254636fd79b1d2016df1233659
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Feb 23 18:15:58 2013 -0500
+
+    Update PDL::NiceSlice to new standard for $VERSION
+
+ Basic/SourceFilter/NiceSlice.pm |    6 ++++--
+ 1 files changed, 4 insertions(+), 2 deletions(-)
+
+commit a2b8cfc8d8a8e152b8b010d2eed52b40447d1639
+Merge: 0e25005 bf5ddd1
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Feb 22 20:51:30 2013 -0500
+
+    Merge branch 'master' into 64bit-index-support
+
+commit bf5ddd1701fb7c69e344cc6505b46bf4c1412ac8
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Feb 22 14:02:54 2013 -0500
+
+    Update PDL/IO/IDL/README with license change info
+
+ IO/IDL/README |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
+ 1 files changed, 56 insertions(+), 4 deletions(-)
+
+commit f793b59310d9d8dbfb4987a8dfa3b111d0a5982e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Feb 22 13:06:38 2013 -0500
+
+    Update VERSION to 2.004_012 for more development
+    
+    Note the new standard version scheme.
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   47 +++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 49 insertions(+), 2 deletions(-)
+
+commit cf3703dda271e5ac5c47ad8abc460db64f99c4f2
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Feb 22 12:24:45 2013 -0500
+
+    Forgot our in Version.pm generated file
+
+ Makefile.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 80ef00ed337f5f72f21b2cabad1328accab00969
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Feb 22 12:22:34 2013 -0500
+
+    More VERSION related fixes.
+    
+    Make $PDL::VERSION in Basic/PDL.pm be the new, preferred
+    string format.  Put the '$VERSION = eval $VARSION' in
+    top level Makefile.PL when it generates Version.pm.
+
+ Basic/PDL.pm  |    1 -
+ Makefile.PL   |    1 +
+ Release_Notes |    8 ++++----
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+commit 355aff6a9460f63d47ea309958dacedaad0e6f41
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Feb 22 11:02:06 2013 -0500
+
+    Fix instructions for intall with new VERSION numbers
+    
+    The filename of development releases don't have the
+    underscore in them.
+
+ Release_Notes |    8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+commit d90c6835ff884e4715ea3f4d1f0aa8593a05b3b1
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Feb 22 10:50:30 2013 -0500
+
+    Update $VERSION to 2.004011_011 for CPAN developers release
+    
+    First attempt with new version string standard
+
+ Basic/PDL.pm   |    4 +++-
+ Known_problems |    2 +-
+ Release_Notes  |   16 ++++++++++------
+ 3 files changed, 14 insertions(+), 8 deletions(-)
+
+commit 394af852aadbf205ff73d918a850c1d0ccce16f3
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Feb 22 10:36:47 2013 -0500
+
+    Update PDL $VERSION to decimal strings
+    
+    Per discussion on pdl-porters list, we're moving to standardize
+    version numbers to the single decimal point string representation
+    as discussed here:
+    
+    http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
+
+ Basic/Constants.pm                       |    3 ++-
+ Basic/Gen/PP.pm                          |    4 +++-
+ Basic/Matrix.pm                          |    3 ++-
+ Basic/Options.pm                         |    3 ++-
+ Graphics/Limits/Limits.pm                |    1 +
+ Graphics/TriD/POGL/OpenGL.pm             |    1 +
+ IO/FastRaw/FastRaw.pm                    |    4 +++-
+ IO/HDF/HDF.pm                            |    3 ++-
+ IO/IDL/IDL.pm                            |    3 ++-
+ Lib/Transform/Cartography/Cartography.pm |    3 ++-
+ inc/Carp.pm                              |    1 +
+ inc/Devel/CheckLib.pm                    |    1 +
+ 12 files changed, 22 insertions(+), 8 deletions(-)
+
+commit 199a460ebe63d731084052e403e0c7ea1a75bced
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Thu Feb 21 18:03:59 2013 +1100
+
+    inc/Carp.pm Make compatible with perl-5.8.x
+    
+    Replace "//" operator with "defined() ? :" ternary
+    construct.
+
+ inc/Carp.pm |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+commit 54f824b98228b05a085f839da2b546049c5c166b
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 20 15:06:02 2013 -0500
+
+    Avoid spurious output from missing gunzip/gzip
+    
+    Now redirect to appropriate NULL device and use diag to
+    report the error.
+
+ t/flexraw_fortran.t |    6 ++++--
+ 1 files changed, 4 insertions(+), 2 deletions(-)
+
+commit a2143fdccaaedbe13e66d42fe234455f87ab8f84
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 20 13:36:59 2013 -0500
+
+    Update Known_problems with sf.net bugs fixed
+
+ Known_problems |   13 +++++++++++--
+ 1 files changed, 11 insertions(+), 2 deletions(-)
+
+commit 5dd653c428d41d320a9a67760bebb0338bb58174
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 20 10:57:24 2013 -0500
+
+    Remove IDL from release notes
+
+ Release_Notes |    3 ---
+ 1 files changed, 0 insertions(+), 3 deletions(-)
+
+commit 8c28a14eea7447346f02622a57b339a731bd7c60
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 20 00:17:21 2013 -0500
+
+    Update VERSION to 2.4.11_011 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    6 +++++-
+ Release_Notes  |   44 ++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 50 insertions(+), 2 deletions(-)
+
+commit d6cdb612decf8210e365f5cc6b65ec1a3ecd1ce1
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 20 00:14:03 2013 -0500
+
+    Add fallback Carp.pm to work around perl bug
+
+ inc/Carp.pm |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+commit 5e66221c5e64c714347a195e63346ae251f8a4f1
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Feb 19 23:46:46 2013 -0500
+
+    Add IDL and work around proj-4.8.0 build problem
+
+ IO/IDL/Makefile.PL              |   14 +
+ IO/IDL/README                   |    4 +
+ Lib/GIS/Proj/Makefile.PL        |   34 ++-
+ Lib/GIS/Proj/include/projects.h |  476 ++++++++++++++++++++++++++++++++
+ Lib/Transform/Proj4/Makefile.PL |   22 ++-
+ MANIFEST                        |    7 +-
+ Release_Notes                   |    9 +-
+ inc/Carp.pm                     |  578 +++++++++++++++++++++++++++++++++++++++
+ inc/Carp/Heavy.pm               |   10 +
+ 9 files changed, 1142 insertions(+), 12 deletions(-)
+
+commit 826bbeca4bb4034f8f867ae14266a0899d25d140
+Merge: 6cbdb42 0626ce7
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Feb 19 09:52:08 2013 -0500
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit 0626ce7927fce0ae29a78891ecdfd06966903dfa
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Mon Feb 18 21:47:16 2013 -0700
+
+    Added POD description of add_module
+
+ Doc/Doc.pm |   51 +++++++++++++++++++++++++++++++++++----------------
+ 1 files changed, 35 insertions(+), 16 deletions(-)
+
+commit 6cbdb42e3baee1eba9bff01e939436d17eeb8821
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Feb 18 11:02:27 2013 -0500
+
+    Add IDL.pm to build
+
+ IO/IDL/README  |   13 -------------
+ IO/Makefile.PL |    2 +-
+ 2 files changed, 1 insertions(+), 14 deletions(-)
+
+commit f8b1f65eb5fc36d903e02c90a20a718fc3798ad8
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Fri Feb 15 14:46:15 2013 -0700
+
+    be less chatty in PDL::Doc::add_module
+
+ Doc/Doc.pm |    1 -
+ 1 files changed, 0 insertions(+), 1 deletions(-)
+
+commit c1532ad1790d7d0bab8fa1591eb0f42dc504f819
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Fri Feb 15 14:12:58 2013 -0700
+
+    add PDL::Doc::add_module for conveneience.  Now you can "use PDL::Doc; PDL::Doc::add_module('My::Module').
+    (Thanks to Maggie X, whose install script I cribbed)
+
+ Doc/Doc.pm |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 55 insertions(+), 0 deletions(-)
+
+commit 14db014ce0802ac6cd7910ecd0f2c041fa03788f
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Feb 11 16:20:06 2013 -0500
+
+    Fix doc error in PDL::NiceSlice
+
+ Basic/SourceFilter/NiceSlice.pm |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 0e25005d10ff344976a3cd1fe3df1ededa5806b9
+Merge: 9ee953d c3a70d0
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Feb 10 09:03:14 2013 -0500
+
+    Merge branch 'master' into 64bit-index-support
+
+commit c3a70d009af415e1fe54c48774484b2bc6251a69
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Feb 7 12:15:16 2013 -0500
+
+    Add PDL::IO::IDL support file
+    
+    Still need to add the distribution stuff
+    around it: tests, makefile, etc.
+
+ IO/IDL/IDL.pm |  869 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 869 insertions(+), 0 deletions(-)
+
+commit 704053ee2e7f4cd5d5ee71da349ad48b22cf80ab
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 6 18:28:50 2013 -0500
+
+    Add missing test plan to t/gd_oo.tests.t for BSD systems
+
+ t/gd_oo_tests.t |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+commit 305dda3a2eaafa84c58978dd398b3e56913ceead
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 6 16:34:23 2013 -0500
+
+    Update VERSION to 2.4.11_010 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |   13 ++++++++-----
+ Release_Notes  |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 64 insertions(+), 6 deletions(-)
+
+commit 06ba255d23002c2a8f22de5520f1514e6f6b42d0
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 6 15:46:52 2013 -0500
+
+    Add $PDL::NiceSlice::debug_filter option
+    
+    This allows one to output the PDL::NiceSlice
+    filtered sources to help debug any problems
+    with the new source filter engine.  Just put
+    
+      BEGIN { $PDL::NiceSlice::debug_filter = 1; }
+    
+    at the top of your source file, say, source.pm.
+    Then you can run
+    
+      perl -c source.pm >source.pmc
+    
+    to collect the filtered output into source.pmc.
+
+ Basic/SourceFilter/FilterSimple.pm |    3 ++-
+ Basic/SourceFilter/NiceSlice.pm    |    2 +-
+ Release_Notes                      |   12 ++++++++++++
+ 3 files changed, 15 insertions(+), 2 deletions(-)
+
+commit 8be911e115bfe196fb564d988c12814f82f1b472
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 6 12:24:20 2013 -0500
+
+    Must use latest Filter::Simple
+    
+    This has a fix for detecting and filtering out Pod
+    lines.
+
+ Makefile.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit c82a5ad3b4d6e51a5988b352daab2a0e1bd5e7c5
+Merge: c27aa9e ae9382f
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 6 10:59:23 2013 -0500
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit c27aa9ebe145a29b97605b086862620072642341
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Feb 6 10:57:01 2013 -0500
+
+    Fix PDL::Graphics::PGPLOT::Window POD
+    
+    The docs for the lines() method were incorrect
+    which triggered a bug with PDL::NiceSlice.  Correcting
+    the docs is a workaround for the bug which will be
+    fixed separately.  This should allow tests to pass
+    for all win32 platforms.
+
+ Graphics/PGPLOT/Window/Window.pm |    8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+commit ae9382f9a9e82abe37e371ec2e359572a85e8871
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Tue Feb 5 17:45:02 2013 -0600
+
+    bad.pd tweaks and corrections
+
+ Basic/Bad/bad.pd |   46 +++++++++++++++-------------------------------
+ 1 files changed, 15 insertions(+), 31 deletions(-)
+
+commit e9bce84a34b52548db6095ceac47a6acce91faf8
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Tue Feb 5 17:44:27 2013 -0600
+
+    Added auto-head1-FUNCTIONS for FullDoc
+
+ Basic/Gen/PP.pm |    3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+commit 13c43638fc59c10ba2a3aaca21e7c837e8a77bb6
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Tue Feb 5 16:58:39 2013 -0600
+
+    Updated Release_Notes with bad.pd work
+
+ Release_Notes |    7 ++++++-
+ 1 files changed, 6 insertions(+), 1 deletions(-)
+
+commit 6559c06b3577573bb4713ee569bd51c5131c5886
+Merge: ef0f648 4adc2be
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Tue Feb 5 16:56:13 2013 -0600
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit ef0f6488ef47ca9b52beffd2c826e9b3900a1e4e
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Tue Feb 5 16:55:54 2013 -0600
+
+    Finished transitioning bad.pd to use FullDoc
+
+ Basic/Bad/bad.pd |  282 ++++++++++++++++++++++++++++--------------------------
+ 1 files changed, 146 insertions(+), 136 deletions(-)
+
+commit ea01410e6c98720c85add8c02d63d3a5f04274c9
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Tue Feb 5 16:55:16 2013 -0600
+
+    Changed FullDoc croak to confess: full stack trace is more helpful here
+
+ Basic/Gen/PP.pm |    8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+commit 4adc2bee5ef1fa8566a0b92214b696541462e7ff
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Feb 5 13:00:35 2013 -0500
+
+    Update Known_problems with Pending fix to PDL::NiceSlice bug
+
+ Known_problems |    6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+commit 0bb97b973f98c41f297091cd542ec41c29062bbd
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Tue Feb 5 11:24:13 2013 -0600
+
+    CPANification and doc cleanup for bad.pd
+
+ Basic/Bad/bad.pd |  274 ++++++++++++++++++++++++++++++------------------------
+ 1 files changed, 153 insertions(+), 121 deletions(-)
+
+commit 7554314d0a97df9fd985e90c55b22113c4b1c0f1
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Tue Feb 5 09:35:33 2013 -0600
+
+    Expanded explanation of =for bad in PDL::Doc
+
+ Doc/Doc.pm |    7 ++++---
+ 1 files changed, 4 insertions(+), 3 deletions(-)
+
+commit c57d835aed96ddfb9d3e84d262236a86304bb84d
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Tue Feb 5 09:21:16 2013 -0600
+
+    Removed quasi-internal pod about old PDLs from bad.pd
+
+ Basic/Bad/bad.pd |    5 -----
+ 1 files changed, 0 insertions(+), 5 deletions(-)
+
+commit 06fc12980fba5f12da9abac343fae0e691931398
+Merge: 2a6ea82 cbe55f6
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Tue Feb 5 09:18:59 2013 -0600
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit cbe55f6d31e2fc4fec351f933a8064e52ba16572
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Feb 5 10:03:06 2013 -0500
+
+    Update VERSION to 2.4.11_009 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   44 ++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 46 insertions(+), 2 deletions(-)
+
+commit 4a69721d818293e92f0330e05c9b4b9774e00daa
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Feb 5 09:34:32 2013 -0500
+
+    Update Release_Notes for CPAN devel release.
+
+ Release_Notes |    9 ++++++++-
+ 1 files changed, 8 insertions(+), 1 deletions(-)
+
+commit c9e4029d95d0a83346bdd19759fea9116e95478c
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Feb 5 09:28:07 2013 -0500
+
+    Fix new PDL::NiceSlice bug on early perls
+    
+    The problem was the difference between text and
+    binary mode on loading a file.  Recent perls use
+    text mode.  Older perls do not---this leaves extra
+    \r in the file that need to be skipped.  The fix
+    was a prefilter for MSWin32 and perls older than
+    v5.14.0.
+
+ Basic/SourceFilter/FilterSimple.pm |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit d801ccf2caf509eceba137e16fa1a28a54d0558c
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Feb 4 08:56:39 2013 -0500
+
+    Add dragonfly to list of OSes to skip t/gd_oo_test.t
+    
+    They are a BSD OS but don't have the letters bsd in the
+    value of $^O.
+
+ t/gd_oo_tests.t |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 2fd48fa961686d1ebe37a044f0e0309732bb725a
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Mon Feb 4 05:13:31 2013 -0700
+
+    fix bug #3603249 (AutoLoader leaks $_ into local context)
+    
+    Problem was that $_ was not being localized in NiceSlice.
+
+ Basic/SourceFilter/NiceSlice.pm |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 6cf50449f32e2003e3ff67f025031f79b5e4966e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Jan 31 12:39:52 2013 -0500
+
+    Update VERSION to 2.4.11_008 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   44 ++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 46 insertions(+), 2 deletions(-)
+
+commit 157cbd7704487941cc12e2be49e5b9fe9f05ed7c
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Jan 31 10:20:11 2013 -0500
+
+    Bump minimum version of Filter::Simple to 0.86
+    
+    And add warning in Release_Notes on how to use
+    the old engine with the new releases while this
+    test process is underway.
+
+ Makefile.PL   |    2 +-
+ Release_Notes |   12 ++++++++++++
+ 2 files changed, 13 insertions(+), 1 deletions(-)
+
+commit 8d59a002807e7dfc2f9e100e75fd42c7e71f806b
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Jan 30 09:10:14 2013 -0500
+
+    Update VERSION to 2.4.11_007 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   32 ++++++++++++++++++++++++++++++++
+ 3 files changed, 34 insertions(+), 2 deletions(-)
+
+commit 108dec957f33466bf22110046f9a2ddd3a20dce4
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Jan 30 09:03:55 2013 -0500
+
+    Update Release_Notes for a new CPAN devel release
+
+ Release_Notes |    4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+commit 7218ac2e8c453ff3113379b3d89ae8d996d1bf6c
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Jan 30 09:01:51 2013 -0500
+
+    Make Filter::Simple a dependency for PDL
+    
+    The new PDL::NiceSlice filter is the basis for the
+    new and improved NiceSlice.  Forgot to add it to the
+    Makefile.PL as a dependency.
+
+ Makefile.PL |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+commit 648757414a1977db9675f0c3c809f7d076da3d7c
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jan 29 12:31:31 2013 -0500
+
+    Update version to 2.4.11_006 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   32 ++++++++++++++++++++++++++++++++
+ 3 files changed, 34 insertions(+), 2 deletions(-)
+
+commit 2117e3bf08c72e668c1768772659500e47783487
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jan 29 12:25:57 2013 -0500
+
+    Make FilterSimple the default engine for PDL::NiceSlice
+    
+    ...and update Release_Notes for a new CPAN developers release.
+
+ Basic/SourceFilter/NiceSlice.pm |    3 ++-
+ Release_Notes                   |    7 ++++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+commit 9cca4f8eb31f8fc19c0ef2b773bc174f746e5a06
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Jan 24 10:14:06 2013 -0500
+
+    Make t/gd_oo_tests.t skip testing for all BSD OSes
+    
+    I plan to leave this skip in until the problem is actually
+    fixed.  In the meantime, for automated testing, the tests
+    will be skippped.  Otherwise a message about the known
+    problem will be printed.
+
+ t/gd_oo_tests.t |   11 +++++++++--
+ 1 files changed, 9 insertions(+), 2 deletions(-)
+
+commit 9d9faa0c712be8ede40ac8a846f0e6065bf054e4
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jan 22 16:58:38 2013 -0500
+
+    Update VERSION to 2.4.11_005 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   32 ++++++++++++++++++++++++++++++++
+ 3 files changed, 34 insertions(+), 2 deletions(-)
+
+commit 7adf218e451da41efce84a1591c84a75fdcee5c6
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jan 22 16:24:58 2013 -0500
+
+    Update MANIFEST to remove PDL/Doc/Pod stuff
+
+ MANIFEST |    5 -----
+ 1 files changed, 0 insertions(+), 5 deletions(-)
+
+commit fccf1151909980067f0f33879451300beaa003e0
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jan 22 16:21:45 2013 -0500
+
+    Update Known_problems and Release_Notes for CPAN devel release
+
+ Known_problems |    6 +++++-
+ Release_Notes  |   13 +++++++++++++
+ 2 files changed, 18 insertions(+), 1 deletions(-)
+
+commit 56fe5e9fdbefe5ceed24f878601803138da807cd
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jan 22 16:01:38 2013 -0500
+
+    Fix problem with multiple imag2d windows active
+    
+    Added glutSetWindow() call to ensure that imag2d_update
+    adds a glutPostRedisplay for the updated image data pdl.
+
+ Graphics/Graphics2D.pm |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+commit 2937ef2501f7bec6b59c8d60859f46af146df239
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jan 22 15:58:43 2013 -0500
+
+    Skip t/gd_oo_tests.t for OpenBSD systems under AUTOMATED_TESTING
+    
+    Since the failing GD tests apparently crash/kill the perl
+    process, TODO doesn't work to quiet them for CPAN Testers.
+    Uncommented code to skip_all for the case of $^O =~ /openbsd/i
+    and the environment AUTOMATED_TESTING is true.  The tests
+    will still fail for hand installs but, presumably the user
+    can see that only a small fraction of subtests actually fail.
+
+ t/gd_oo_tests.t |    8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+commit 9ee953d10749d8d167df53ab53beaafce203f8f1
+Merge: da6d5d6 ce06b35
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jan 22 10:19:04 2013 -0500
+
+    Merge branch 'master' into 64bit-index-support
+
+commit ce06b35ac340c3893474171c114b7a11063624bb
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Mon Jan 21 00:35:00 2013 -0600
+
+    New FullDoc PDL::PP key and fixed a few minor doc niggles
+
+ Basic/Bad/bad.pd                 |  102 +++++++------
+ Basic/Gen/PP.pm                  |  292 +++++++++++++++++++++++++++++++-------
+ Basic/Gen/PP/PdlParObj.pm        |   71 +++-------
+ Graphics/PGPLOT/Window/Window.pm |    2 +-
+ Release_Notes                    |    3 +-
+ 5 files changed, 317 insertions(+), 153 deletions(-)
+
+commit 8a1c920c53812dabd31225d8917359035bb00921
+Merge: c5abfc9 75d71ff
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Sun Jan 20 23:00:15 2013 -0600
+
+    Merge branch 'master', remote-tracking branch 'sf/master'
+
+commit 75d71ff441225a7fc5302300f24c0c34bef2160f
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Jan 20 14:10:22 2013 -0500
+
+    Make perldl skip and warn that -glut/-tk options not supported
+    
+    Yet...until I can figure out how to get the event loops
+    to interoperate correctly.
+
+ perldl.PL |    8 ++++++++
+ 1 files changed, 8 insertions(+), 0 deletions(-)
+
+commit 7f357d181b59a52522dd02731c176d1412cf7650
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Jan 20 11:10:32 2013 -0500
+
+    Update VERSION to 2.4.11_004 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   33 ++++++++++++++++++++++++++++++++-
+ 3 files changed, 34 insertions(+), 3 deletions(-)
+
+commit a0dfcc0df392461aca778f986ede6e535d7540b4
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Jan 20 10:46:02 2013 -0500
+
+    Update Known_problems and Release_Notes for CPAN release
+
+ Known_problems |   13 +++++++++----
+ Release_Notes  |    8 +++++++-
+ 2 files changed, 16 insertions(+), 5 deletions(-)
+
+commit 411e40b26b3f64cf84c42b6c476ec9c062709b5a
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Jan 20 10:45:11 2013 -0500
+
+    Add -glut option to perldl pod (now works for non-MSwin platforms)
+
+ perldl.PL |   14 ++++++++++----
+ 1 files changed, 10 insertions(+), 4 deletions(-)
+
+commit 373eda51f11640176c999bfe09b7d8b72fa9920a
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Jan 18 07:28:07 2013 -0500
+
+    make t/gd_oo_tests.t TODO to debug
+    
+    There is a bug for AMD64 platforms that has not
+    been resolved.  The sf.net bug #3518190 is being
+    re-opened to track the issue.
+
+ t/gd_oo_tests.t |  377 ++++++++++++++++++++++++++++---------------------------
+ 1 files changed, 191 insertions(+), 186 deletions(-)
+
+commit 95730525a552f7cd7fa3385a7ed10d9abed00d3f
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Jan 17 17:16:14 2013 -0500
+
+    Tweak PDL::howbig pod so apropos sizeof will find it
+
+ Basic/Core/Core.pm.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit c5abfc96ac490bc1ed7177a73c71a6ca144f0785
+Merge: 3d9b989 99d747b
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Mon Jan 14 09:27:37 2013 -0600
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit 99d747b3301a1b247b6bcc06fa304b19c2f698f5
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Mon Jan 14 16:04:59 2013 +1100
+
+    t/argtest.t Escape left brace in regex
+    
+    Left brace in regex at line 40 needs to be escaped
+    to avoid deprecation warning with perl-5.17 and
+    later.
+
+ t/argtest.t |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit f7d7f80e8fc48fa023c29b4305111417957ffbfa
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Jan 13 11:55:20 2013 -0500
+
+    Update version info to 2.4.11_003 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   32 ++++++++++++++++++++++++++++++++
+ 3 files changed, 34 insertions(+), 2 deletions(-)
+
+commit 96c317fe6b36f1a973817e081cf2d09ed7a698d2
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Jan 13 11:38:26 2013 -0500
+
+    Update Release_Notes for PDL-2.4.11_002 release
+
+ Release_Notes |    5 ++++-
+ 1 files changed, 4 insertions(+), 1 deletions(-)
+
+commit f2fc6aed72ce3ddb60211fc8d4c9cd4f8bb0369e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Jan 13 11:32:29 2013 -0500
+
+    Add test names to t/gd_oo_tests.t
+    
+    Maybe this will help figure out what the problem is on
+    some platforms.
+
+ t/gd_oo_tests.t |   64 +++++++++++++++++++++++++++---------------------------
+ 1 files changed, 32 insertions(+), 32 deletions(-)
+
+commit a9fcf18c1de3ee3378ef7d6b205d016d1d4fc4c4
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Jan 13 11:10:49 2013 -0500
+
+    Add back some TODO block around failing NaN representation tests
+    
+    These are platform specific and we don't want PDL failing its
+    build tests just because we haven't debugged the problem on
+    all possible platform combinations...
+
+ t/pdl_from_string.t |   48 ++++++++++++++++++++++++++----------------------
+ 1 files changed, 26 insertions(+), 22 deletions(-)
+
+commit 360ce69e1f9a96c4367e90bc88cf5508971128c1
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Sun Jan 13 21:17:58 2013 +1100
+
+    t/pdl_from_string.t - remove some outdated comments
+    
+    There were some comments (specific to MS Windows)
+    that should have been removed earlier.
+
+ t/pdl_from_string.t |    6 ------
+ 1 files changed, 0 insertions(+), 6 deletions(-)
+
+commit 3d9b9892625c0f767eccb217089712808b9993dd
+Merge: 2fa430e 0f1f5f2
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Fri Jan 11 14:39:59 2013 -0600
+
+    Merged Release_Notes on PDL::Pod notes
+
+commit 0f1f5f2aaa89d76e4a3c46e716567c9ed8dfd562
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Jan 11 15:37:14 2013 -0500
+
+    Bump VERSION to 2.4.11_002 for more PDL development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   34 ++++++++++++++++++++++++++++++++--
+ 3 files changed, 34 insertions(+), 4 deletions(-)
+
+commit 951d5fed7eac3b577f303c409bf2cfa14fda1867
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Jan 11 15:16:40 2013 -0500
+
+    Fix tempfile race condition in wpnm()
+    
+    Resolved by using tempfile() from File::Temp rather
+    than the hand-rolled version.  It is tricky to get
+    temporary files right so standardizing on File::Temp
+    is probably the right thing to do.
+
+ IO/Pnm/pnm.pd |   16 +++-------------
+ 1 files changed, 3 insertions(+), 13 deletions(-)
+
+commit 1e61f9b08dc9ce4288c3a50c545d89aec952d5ab
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Jan 11 14:21:36 2013 -0500
+
+    Update MANIFEST for PDL-2.4.11_001 developers release
+
+ MANIFEST |    6 +++++-
+ 1 files changed, 5 insertions(+), 1 deletions(-)
+
+commit 222fc653fb3e362945ca11f03258e31d3141fe59
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Jan 11 13:59:48 2013 -0500
+
+    Update Known_problems and Release_Notes
+
+ Known_problems |   17 ++++++++---------
+ Release_Notes  |   28 +++++++++++++++++++++++++++-
+ 2 files changed, 35 insertions(+), 10 deletions(-)
+
+commit 77531a2d6b381531e790ef0ac6ecad97cc725e16
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Jan 11 13:58:26 2013 -0500
+
+    Bump $VERSION to 1.356 for -glut fix to perldl
+
+ perldl.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 2fa430e7bce297ccad22470cc3886f14980bf9af
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Mon Jan 7 23:39:08 2013 -0600
+
+    Removed =for ref Internal pod directives
+    
+    The pod directive =for ref Internal shows up in many places in
+    Graphics/PGPLOT/Window/Window.pm, but it does not serve much of a
+    purpose. It probably served a useful purpose at some point, but
+    that purpose has been lost. Removing for now, with the expectation
+    of revisiting after devising a better pdldoc keyword system.
+
+ Doc/Doc.pm                       |    1 +
+ Graphics/PGPLOT/Window/Window.pm |   13 -------------
+ 2 files changed, 1 insertions(+), 13 deletions(-)
+
+commit 97e1f6f8b88fd901cea30c096574538430b85dc4
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Mon Jan 7 23:22:20 2013 -0600
+
+    Updated Release_Notes with Joel's work.
+
+ Release_Notes |    5 ++++-
+ 1 files changed, 4 insertions(+), 1 deletions(-)
+
+commit 0325a95376be1d45f0a85226d134137eaf2e208c
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Mon Jan 7 23:13:01 2013 -0600
+
+    Fixed misspellings of PERL in intro docs
+
+ Basic/Pod/MATLAB.pod |    4 ++--
+ Basic/Pod/Scilab.pod |    4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+commit a1617d12c63d68bf959fbf97ce36e7e746bfa125
+Merge: bf934bd bdf875c
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Mon Jan 7 23:01:56 2013 -0600
+
+    Merge branch 'master' of github.com:PDLPorters/pdl
+
+commit bf934bd69db2d4ae3fbaac10b8f226d44501a15e
+Merge: ae28aff beb9d53
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Mon Jan 7 23:00:39 2013 -0600
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit beb9d53014f6ed5be68859382c8192822ee5e998
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Jan 7 21:27:29 2013 -0500
+
+    Make timeout 0 for select call
+    
+    This makes the new event_loop support more
+    real time.
+
+ perldl.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 39aec99d81b1113f5ac8e4449dd249be88e46c39
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Jan 7 13:33:42 2013 -0500
+
+    Add event_loop support for perldl -glut option
+    
+    Now it is possible to have the AppleGLUT or FreeGLUT
+    event loop run while using the command line interface.
+    The new functionality requires Term::ReadLine 1.09 or
+    higher but is transparently enabled if $term->can('event_loop').
+
+ Graphics/Graphics2D.pm |    4 +--
+ perldl.PL              |   52 ++++++++++++++++++++++++++++++++++++++---------
+ 2 files changed, 43 insertions(+), 13 deletions(-)
+
+commit bdf875c9c2e43242a11bcbd94450aea56b3a4b2c
+Merge: 964a514 c4117fd
+Author: run4flat <dcmertens.perl@gmail.com>
+Date:   Mon Jan 7 08:28:19 2013 -0800
+
+    Merge pull request #3 from PDLPorters/pod
+    
+    Remove PDL::Pod:: classes in favor of Perl core modules Pod::
+
+commit ae28affc9af7b95256c07064ffa672c0f3ed91e2
+Merge: eeba80e 54af56e
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Sat Jan 5 08:46:45 2013 -0600
+
+    Merge branch 'master', remote-tracking branch 'origin/master'
+
+commit eeba80ebf8c3370e84ebc26181e27b5eab27b42c
+Merge: efb6500 964a514
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Sat Jan 5 08:45:07 2013 -0600
+
+    Merge branch 'master' of github.com:PDLPorters/pdl
+
+commit 54af56edcca8e915232515a5cfc7d58106a01a0d
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Sat Jan 5 11:44:31 2013 +1100
+
+    Basic/Core/Core.pm.PL - Alteration to pdl('nan') generation.
+    
+    In Core.pm.PL, I changed the line:
+     ${$nan->get_dataref}     = pack( "d*", "nan" );
+    to:
+     ${$nan->get_dataref}     = pack( "d*", (-1.0) ** 0.5 );
+    
+    as the former works only if perl numifies the string "nan"
+    to a NaN - which doesn't happen on all perls.
+
+ Basic/Core/Core.pm.PL |  304 +++++++++++++++++++++++++------------------------
+ 1 files changed, 155 insertions(+), 149 deletions(-)
+
+commit 7a6cac66fefd6fb6670490645cd8a1d194a8e2ac
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Sat Jan 5 11:44:31 2013 +1100
+
+    t/pdl_from_string.t - Move some tests out of TODO
+    
+    Also change the way that pdl_from_string.t generates
+    a pdl('nan') on Windows.
+
+ t/pdl_from_string.t |   11 +++++------
+ 1 files changed, 5 insertions(+), 6 deletions(-)
+
+commit 9899ed00e3302d8eb489461ef3ec8c76766e8d77
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Jan 4 17:40:36 2013 -0500
+
+    Fix twiddle control for imag2d
+    
+    Clicking the close widget of the last imag2d window
+    failed to close the last window and you couldn't "twiddle"
+    to make it finish.  Now the window should close cleanly.
+
+ Graphics/Graphics2D.pm |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 2a6ea82cd421e2deffa66a522125e472414f3324
+Merge: c4117fd 964a514
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Fri Jan 4 11:20:39 2013 -0600
+
+    Merge branch 'master' into HEAD
+
+commit 964a5141060094f8dd6948f187349fb36830312c
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Fri Jan 4 10:46:23 2013 -0600
+
+    Minor doc tweaks to Complex.pm and Core.pm
+
+ Basic/Complex/complex.pd |    2 +-
+ Basic/Core/Core.pm.PL    |    4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+commit c4117fd5bfdaaaf55f3fed565be1cb6f89bb4569
+Author: Joel Berger <joel.a.berger@gmail.com>
+Date:   Thu Jan 3 12:34:38 2013 -0600
+
+    removed warning about Pod::Parser incompatibility
+
+ Doc/Doc.pm |    7 -------
+ 1 files changed, 0 insertions(+), 7 deletions(-)
+
+commit 69260d2b87e77f53379f0b413d4ec5e32bf86267
+Author: Joel Berger <joel.a.berger@gmail.com>
+Date:   Thu Jan 3 11:55:45 2013 -0600
+
+    removed problematic "last" directive
+
+ Doc/Doc.pm |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 624595479647ca09e8901fe656ebb3b0b816852a
+Author: Joel Berger <joel.a.berger@gmail.com>
+Date:   Thu Jan 3 11:44:14 2013 -0600
+
+    removed PDL::Pod:: classes in favor of core modules Pod::
+    
+    Further changed calling implementation of overriden functions "command", "textblock" and "verbatim" and a few internal methods
+    Also removed StrHandle and NullHandle classes in favor of opening handles to strings
+
+ Doc/Doc.pm          |   71 +---
+ Doc/Doc/Perldl.pm   |    5 +-
+ Doc/Pod/Makefile.PL |   18 -
+ Doc/Pod/Parser.pm   | 1112 ---------------------------------------------------
+ Doc/Pod/README      |  206 ----------
+ Doc/Pod/Select.pm   |  128 ------
+ Doc/Pod/Usage.pm    |  244 -----------
+ 7 files changed, 25 insertions(+), 1759 deletions(-)
+
+commit 5df755cfeeee4eac723e831ae78c2edec99457fe
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jan 1 17:10:23 2013 -0500
+
+    Fix sf.net bug #3585811 "conv1d bad value broken"
+    
+    Now a warning is generated if conv1d() is used on data
+    with the badflag set.  An explicit caution is also added
+    to the documentation.
+
+ Basic/Primitive/primitive.pd |    8 ++++++++
+ 1 files changed, 8 insertions(+), 0 deletions(-)
+
+commit fe5e29221378a1b54aa2614c0a043d6942fa6a12
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jan 1 16:34:41 2013 -0500
+
+    Fix hist() handling of fractional $step
+    
+    This fixes sf.net bug #3588182 by making the $xvals
+    returns in list context alway be double and updates
+    the documentation to reflect this.  Also fixes a
+    logic error in the calculation of the value for $step
+    if not provided.
+
+ Basic/Core/Basic.pm |   20 +++++++++++---------
+ 1 files changed, 11 insertions(+), 9 deletions(-)
+
+commit 14a56ef4b59e0e4114707d0a4f457da976aea0fd
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Thu Dec 27 21:40:28 2012 +1100
+
+    Basic/Gen/PP/PDLCode.pm - quiet perl-5.18 deprecation warning
+    
+    Escape left brace in regexes - '%{' becomes '%\{'
+
+ Basic/Gen/PP/PDLCode.pm |  126 +++++++++++++++++++++++-----------------------
+ 1 files changed, 63 insertions(+), 63 deletions(-)
+
+commit a5705ed9a66785684a3f1375868eb30ec03e163e
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Thu Dec 27 21:40:28 2012 +1100
+
+    Basic/Gen/PP.pm - quiet perl-5.18 deprecation warning
+    
+    Escape left brace in regex - '%{' becomes '%\{'
+
+ Basic/Gen/PP.pm |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+commit 1f0ce8672536bf17efddc4a037e7fdd939373f74
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Thu Dec 27 21:40:28 2012 +1100
+
+    t/pp_croaking.t - quiet perl-5.18 deprecation warning
+    
+    Escape left brace in regex - '%{' becomes '%\{'
+
+ t/pp_croaking.t |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit efb650035909cd98dfdefe4d893ee86741b939c1
+Merge: a76f87b a6fdb8e
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Wed Dec 26 05:08:09 2012 -0600
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit a76f87b5b75a2238785736b072a03d0c7f6fb3d8
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Wed Dec 26 05:06:06 2012 -0600
+
+    Fixed minor pod formatting issue in PDL::Transform
+
+ Lib/Transform/transform.pd |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit a6fdb8e7028ea3915cae8e2658d99c26cc24364b
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Dec 9 12:12:16 2012 -0500
+
+    add whereND to PDL::Lvalue->subs() @funcs
+    
+    And alphabetized the list of functions so it will be
+    easier to inspect.  Ideally, we should generate this
+    list from the sources.
+
+ Basic/Lvalue.pm |    7 ++++---
+ 1 files changed, 4 insertions(+), 3 deletions(-)
+
+commit 94fa430141771e5a218d233077e609d4015c0316
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Tue Nov 20 15:48:02 2012 -0700
+
+    Fixed image2d.pd POD error that prevented some funcs from showing up in the docs db
+    
+    '=head1 polyfill' changed to '=head2 polyfill'.  Also prettified some ccXcompt links.
+
+ Lib/Image2D/image2d.pd |    8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+commit e3fca65768a51a5ba57629a7fff5fe10b38686bf
+Author: sisyphus <sisyphus@Owner-PC311012.(none)>
+Date:   Wed Nov 14 22:56:01 2012 +1100
+
+    Top level Makefile.PL - nmake-specific fix
+    
+    Craig's recent change wrt pdl.PL/pdl.c has
+    necessitated a small tweak for nmake.
+
+ Makefile.PL |    8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+commit 0e927a40e636e557ab7b072c08bb53f4e2d91a56
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Tue Nov 13 12:46:25 2012 -0700
+
+    more warning elimination
+
+ Basic/Gen/PP.pm        |    4 ++--
+ Basic/Slices/slices.pd |    5 +++--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+commit c678279da7a94b4b870567b69d2c72a62fa05012
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Tue Nov 13 11:39:25 2012 -0700
+
+    more warning suppression
+
+ Basic/Core/pdlmagic.c |   14 ++++++++------
+ 1 files changed, 8 insertions(+), 6 deletions(-)
+
+commit 049f8baa3456cee342e0517ddf08d70920c7c424
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Tue Nov 13 11:15:05 2012 -0700
+
+    more clang warning fixes - no functional changes
+
+ Basic/Core/Core.xs.PL   |    8 ++++----
+ Basic/Core/pdl.h.PL     |    4 ++--
+ Basic/Core/pdlapi.c     |   10 +++++-----
+ Basic/Core/pdlcore.c.PL |    7 ++++---
+ Basic/Core/pdlhash.c    |    2 +-
+ Basic/Core/pdlthread.c  |    1 -
+ 6 files changed, 16 insertions(+), 16 deletions(-)
+
+commit bfdd480243929cea914839335218dbbc865053c2
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Tue Nov 13 10:38:30 2012 -0700
+
+    Basic cleanup of some warnings in the core with newer versions of clang.  No functional changes (I hope).
+    A couple more pushes of this type to come.
+
+ Basic/Core/Core.xs.PL   |    4 +---
+ Basic/Core/pdl.h.PL     |    7 +++----
+ Basic/Core/pdlcore.c.PL |    2 +-
+ Basic/Gen/PP.pm         |    9 +++++----
+ Basic/Gen/PP/PDLCode.pm |    2 +-
+ 5 files changed, 11 insertions(+), 13 deletions(-)
+
+commit 168c037d6298e2eecdda6c468586919bc52e44ef
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Nov 13 08:46:50 2012 -0500
+
+    Bump version in perldl for Craig's fix
+    
+    Otherwise, you have no easy way to see if
+    you are running the "new/fixed" code.
+
+ perldl.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 16b17c86a976dc0fe34d80eb063bba92b53975a8
+Author: Craig DeForest <zowie@Clio-4.local>
+Date:   Tue Nov 13 02:03:29 2012 -0700
+
+    Fix non-reported callback bug in perldl.  This boneheaded calling scheme
+    (simply appending a "die $@ if($@)" to the end of the eval) seems to work
+    in 5.10,5.12, and 5.14 -- I'm not sure why we didn't do it to start with.
+    
+    Since perldl is the only place PDL::Core::myeval() was called, I deleted it
+    from Core.xs.PL as well -- it appears to be cruft at this point, since
+    it no longer works as intended and is also no longer used.
+
+ Basic/Core/Core.xs.PL |   16 ----------------
+ perldl.PL             |    8 +++++---
+ 2 files changed, 5 insertions(+), 19 deletions(-)
+
+commit abcf992877ff0bd319d52166cf716ea086d1702e
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Mon Nov 12 17:32:26 2012 -0700
+
+    Fixed warnings in pdl.PL.  Fixed up Makefile.PL to actually compile pdl.c into pdl after it is made.  (MacOS 10.8 seems to need that).
+
+ Makefile.PL |   23 +++++++++++++++++------
+ pdl.PL      |    6 +++---
+ 2 files changed, 20 insertions(+), 9 deletions(-)
+
+commit e8734eb1b303942f3f4dfe683c6cf0c32b209257
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Mon Nov 12 17:00:40 2012 -0700
+
+    fix longstanding problem with three-argument form of rim
+
+ IO/Pnm/Pic.pm |   31 ++++++++++++++++++-------------
+ 1 files changed, 18 insertions(+), 13 deletions(-)
+
+commit f17e251db783f5d45b5e6dae45adb9bc4be6bf16
+Author: Craig DeForest <zowie@dhcp-10-72.boulder.swri.edu>
+Date:   Mon Nov 12 16:24:39 2012 -0700
+
+    fix syntax error in transform.pd
+
+ Lib/Transform/transform.pd |    7 ++++++-
+ 1 files changed, 6 insertions(+), 1 deletions(-)
+
+commit fbca747a30442e2954d207db1805270304e4dcbd
+Merge: f2e42e3 dd92350
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Mon Nov 12 15:12:33 2012 -0700
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit f2e42e38f9d2f1e1f4666adf468b220a8e896682
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Mon Nov 12 15:09:39 2012 -0700
+
+    Make Ufunc's POD usage docs agree with function signatures.
+    
+    In ufunc.pd, functions had a signature like (a(n); [o]b()), but then
+    had usage lines like $a = func($b). So I just changed the usage lines
+    to $b = func($a), to reduce confusion.
+
+ Basic/Ufunc/ufunc.pd |   14 +++++++-------
+ 1 files changed, 7 insertions(+), 7 deletions(-)
+
+commit dd923502135b714f4f566da359c1e2c3779078f6
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Nov 12 10:43:19 2012 -0500
+
+    Fix win32 bsd.dll pattern to only match bsd.dll
+    
+    On cygwin 1.7.17, the GD library file is /usr/lib/libgd.dll.a
+    so the string 'bgd.dll' was being found even though the
+    searched for DLL was not.
+
+ IO/GD/Makefile.PL |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 0fecb6c762256565c3553153009d1cadd229d475
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Fri Nov 9 16:43:27 2012 -0700
+
+    Add NOMYMETA tags to most of the rest of the Makefile.PLs.
+    
+    This finishes what I started with commit 96700c4, adding the
+    eval'd check on the EU::MM version and adding the NOMYMETA=>1
+    line if appropriate.  Now there are only 4 pairs of MYMETA.[yml,json]
+    files created with 'perl Makefile.PL'.
+
+ Basic/Core/Makefile.PL                |    1 +
+ Basic/Gen/Makefile.PL                 |    1 +
+ Basic/Makefile.PL                     |    1 +
+ Basic/Pod/Makefile.PL                 |    1 +
+ Demos/Makefile.PL                     |    3 ++-
+ Doc/Makefile.PL                       |    1 +
+ Doc/Pod/Makefile.PL                   |    1 +
+ Graphics/LUT/Makefile.PL              |    1 +
+ Graphics/LUT/ramps/Makefile.PL        |    3 ++-
+ Graphics/LUT/tables/Makefile.PL       |    3 ++-
+ Graphics/Limits/Makefile.PL           |    1 +
+ Graphics/Makefile.PL                  |    1 +
+ Graphics/PGPLOT/Makefile.PL           |    3 ++-
+ Graphics/PGPLOT/Window/Makefile.PL    |    3 ++-
+ Graphics/TriD/Makefile.PL             |    1 +
+ Graphics/TriD/VRML/Makefile.PL        |    1 +
+ IO/Dicom/Makefile.PL                  |    1 +
+ IO/FITS/Makefile.PL                   |    1 +
+ IO/FastRaw/Makefile.PL                |    1 +
+ IO/FlexRaw/Makefile.PL                |    1 +
+ IO/HDF/Makefile.PL                    |    1 +
+ IO/HDF/SD/Makefile.PL                 |    1 +
+ IO/HDF/VS/Makefile.PL                 |    3 ++-
+ IO/Makefile.PL                        |    1 +
+ Lib/CallExt/Makefile.PL               |    2 +-
+ Lib/Filter/Makefile.PL                |    3 ++-
+ Lib/Fit/Makefile.PL                   |    1 +
+ Lib/GIS/Makefile.PL                   |    1 +
+ Lib/GSL/Makefile.PL                   |    1 +
+ Lib/GSL/SF/Makefile.PL                |    1 +
+ Lib/Makefile.PL                       |    1 +
+ Lib/Opt/Makefile.PL                   |    1 +
+ Lib/Opt/Simplex/Makefile.PL           |    3 ++-
+ Lib/Transform/Cartography/Makefile.PL |    3 ++-
+ Perldl2/Makefile.PL                   |    2 ++
+ Perldl2/Plugin/Makefile.PL            |    1 +
+ Perldl2/Profile/Makefile.PL           |    1 +
+ 37 files changed, 47 insertions(+), 10 deletions(-)
+
+commit 8f09bf389b97b28fa10e599b4b94f1bb6a55a7a9
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Fri Nov 9 14:34:48 2012 -0700
+
+    Update the old link to the GSL docs from redhat.com to gnu.org.
+
+ Lib/GSL/DIFF/gsl_diff.pd     |    2 +-
+ Lib/GSL/INTEG/gsl_integ.pd   |    2 +-
+ Lib/GSL/INTERP/gsl_interp.pd |    2 +-
+ Lib/GSL/MROOT/gsl_mroot.pd   |    2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+commit 44902ed9a73f07c54947d8e64afc8d282b796911
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Fri Nov 9 13:59:25 2012 -0700
+
+    Small POD update for PDL::Func
+    
+    The description "useful functions" for this module wasn't that useful,
+    so I added more detail.  Fixed a syntax error in the docs for
+    PDL::Func::set.  Also removed the section "The Future" because
+    obviously that isn't going to happen.
+
+ Lib/Func.pm |   11 +++--------
+ 1 files changed, 3 insertions(+), 8 deletions(-)
+
+commit f914a2554f8621c5ebde8a02f536ff4d00d7d567
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Nov 8 09:46:46 2012 -0500
+
+    Update Known_problems for PDL-2.4.11 status
+
+ Known_problems |   18 +++++-------------
+ 1 files changed, 5 insertions(+), 13 deletions(-)
+
+commit 3bfd7247ae290b8f7319a9df53c0b327aab3770a
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Tue Nov 6 14:50:46 2012 -0700
+
+    Quiet "isn't numeric" warning in a trid Makefile.PL.
+    
+    Put an eval around $ExtUtils::MakeMaker::VERSION so that numeric
+    comparisons (>=, etc) don't complain for version strings
+    like '6.57_02'.
+
+ Graphics/TriD/POGL/Makefile.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 96700c442b1e1782ff182eaac375f43e62a9acfd
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Tue Nov 6 14:45:40 2012 -0700
+
+    Suppress some of the "Writing MYMETA" messages during 'perl Makefile.PL'.
+    
+    This should suppress some of the "Writing MYMETA.yml and MYMETA.json" lines
+    that crop up during the first part of the PDL build.  It will not take care
+    of all of them, to do that I'll have to hand edit some Makefile.PL's.  Putting
+    this in now to see if it messes up older versions of EU::MM, and if it's OK
+    I'll do the rest by hand later.  See pdl-porters thread from 2011-Dec-21.
+
+ Basic/Core/Dev.pm |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+commit eafe04154fc23edc717d54304c03fc8df16b58c9
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Mon Nov 5 22:01:23 2012 -0700
+
+    Change the example for the "in" function to be less ambiguous.
+
+ Basic/Primitive/primitive.pd |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit da6d5d60645abbd2e133f1d57a3a40a14a00b89a
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Nov 1 11:00:08 2012 -0400
+
+    Change offspar type to PDL_Index in affine
+
+ Basic/Slices/slices.pd |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 42063059a0b4dc0b3eb37b6572e0dbf2dd11a7a9
+Merge: b7ab80b a1ab4d7
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Nov 1 10:01:18 2012 -0400
+
+    Merge branch 'master' into 64bit-index-support
+    
+    Conflicts:
+    	Basic/Core/pdlcore.c.PL
+
+commit a1ab4d78b10e6a2fb52e42b2767cb641c652460f
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri Oct 26 14:01:19 2012 -0400
+
+    Update Release_Notes and Known_problems
+    
+    I would like to see a CPAN developers release in the
+    next month as we move towards a 2.4.12 release.
+
+ Known_problems |    9 ---------
+ Release_Notes  |   38 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 38 insertions(+), 9 deletions(-)
+
+commit 7b684e98999a9ffb3bc637244801d09b416996a2
+Author: olpc user <olpc@xo-4a-9c-81.localdomain>
+Date:   Sat Oct 6 17:03:05 2012 +0000
+
+    Fix p command in pdl2 shell
+    
+    Added back a newline to the p command for
+    the pdl2 shell which fixes the breakage on
+    windows platforms.  NOTE: p is a shorthand
+    to display output in the interactive shell.
+    It has never been an alias for print.
+
+ Perldl2/Profile/Perldl2.pm |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 4eeddb3e6304717ba317b81972c2ab826c0ca1a5
+Author: olpc user <olpc@xo-4a-9c-81.localdomain>
+Date:   Sat Oct 6 15:22:41 2012 +0000
+
+    Update DEPENDENCIES and Known_problems
+
+ DEPENDENCIES   |   16 ++++------------
+ Known_problems |   22 ++--------------------
+ 2 files changed, 6 insertions(+), 32 deletions(-)
+
+commit c8501f9d20b9109d12b75d2cd0ff1bf07bbddd6c
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Fri Sep 21 19:36:25 2012 +1000
+
+    t/rim.t - Some basic testing of PDL::IO::Pic::rim()
+    
+    The rim() function was (is still ?) broken. See:
+    http://mailman.jach.hawaii.edu/pipermail/pdl-porters/2012-July/004916.html
+    This script provides some basic testing of the function.
+
+ t/rim.t |   44 ++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 44 insertions(+), 0 deletions(-)
+
+commit 4b51e276e9baf20db7b3ffe03b0cb4bcb8d88516
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Fri Sep 21 19:36:24 2012 +1000
+
+    MANIFEST - add new test script t/rim.t
+
+ MANIFEST |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+commit fc2fe6d14967e1e6cfc422d4f734f1ecbc08efe8
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Sep 12 12:56:31 2012 -0400
+
+    Update inc/Devel/CheckLib.pm to version 0.98
+
+ inc/Devel/CheckLib.pm |   48 ++++++++++++++++++++++++++++++++----------------
+ 1 files changed, 32 insertions(+), 16 deletions(-)
+
+commit 033b59c2ee9292885058a3941fbfd1dc525ae7af
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Sep 12 12:55:38 2012 -0400
+
+    Clean up test for PDLDOC_IGNORE_AUTOLOADER
+
+ pdldoc.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit df61526d565973bc1f0ade8629919c3940094247
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Sep 6 18:54:51 2012 -0400
+
+    Minor edits to PDL::MATLAB pod
+
+ Basic/Pod/MATLAB.pod |   14 +++++++-------
+ 1 files changed, 7 insertions(+), 7 deletions(-)
+
+commit 6a700587296d975221f87a6612f07e836691086e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Sep 6 17:12:46 2012 -0400
+
+    Add Boundary=>'Replicate' option to conv2d/med2d
+
+ Lib/Image2D/image2d.pd |   42 +++++++++++++++++++++++++++---------------
+ t/image2d.t            |   10 +++++++---
+ 2 files changed, 34 insertions(+), 18 deletions(-)
+
+commit 513b4a82aee5cb03816481c6ae14abe2c705f87a
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Sep 2 17:40:30 2012 -0400
+
+    fix 16-bit PNM raw format handling (sf.net bug #3475075)
+    
+    This commit fixes wpnm and rpnm so that they output
+    raw format PNM data in network byte order (i.e., big
+    endian order).  This fixes the 16bit pixel issues and
+    is believed to close this bug.  Feedback welcome.
+
+ IO/Pnm/pnm.pd  |   28 +++++++++++++++++++++++++++-
+ Known_problems |   12 +++++++++++-
+ 2 files changed, 38 insertions(+), 2 deletions(-)
+
+commit 94c463312d90c62fdb3be84ecf170c16c9cf0269
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Sep 2 15:00:57 2012 -0400
+
+    Re-add PNG checks to picrgb.t
+    
+    And removed default '-quiet' option from wpic() since
+    the various NetPBM converters don't appear to support
+    that flag any more.
+    
+    NOTE: SGI file format is still commented out because
+    of a problem with the converters (at least on cygwin)
+    where the files are not generated/converted correctly.
+
+ IO/Pnm/Pic.pm |    2 +-
+ t/picrgb.t    |    4 +++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+commit 892c5c9e3a524c483e73d3cb7552e5b43ef2ad02
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Sep 2 13:34:06 2012 -0400
+
+    Update unpdl docs a bit, hope it is clearer
+
+ Basic/Core/Core.pm.PL |   14 ++++++++++----
+ 1 files changed, 10 insertions(+), 4 deletions(-)
+
+commit cc634713f56a6428f3ee2a4298471896fc3b51e1
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Sep 2 13:11:07 2012 -0400
+
+    Fix dummy() to generate correct slice() call
+    
+    Sf.net feature request/bug report #3479009 had a hard to find
+    problem with dummy() because it was generating an underlying
+    call to slice() with an invalid string contruct, e.g. '* 128'
+    rather than '*128'.  This fixes dummy() to coerce the ' 128'
+    to a number, i.e. '128' so that the slice string is correct as
+    far as syntax.
+    
+    Also made one more failing NaN sign test a TODO one since it
+    was failing on cygwin.
+
+ Basic/Core/Core.pm.PL |    2 +-
+ t/pdl_from_string.t   |   94 ++++++++++++++++++++++++------------------------
+ 2 files changed, 48 insertions(+), 48 deletions(-)
+
+commit eb96334c3e8df113638688ddcd8741872812cbc6
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun Sep 2 11:51:55 2012 -0400
+
+    Add missing binmode for win32 (see sf bug #3563903
+    
+    This prevents text mode CR-LF translation on win32
+    platforms from breaking things.  There may be an
+    un-binmoded handle in IO/FITS/FITS.pm as well but the
+    maintainers of that module will need to apply the
+    fix if needed.
+
+ IO/Dicom/Dicom.pm     |    1 +
+ IO/FlexRaw/FlexRaw.pm |    1 +
+ IO/Pnm/Pic.pm         |    1 +
+ 3 files changed, 3 insertions(+), 0 deletions(-)
+
+commit 2da876d38650ac0f342ec2123a7dbee0a5560bc5
+Author: unknown <chm@BELVNB0361NV126.nae.ds.army.mil>
+Date:   Thu Aug 23 20:01:31 2012 -0400
+
+    Fit deprecation of "naked" { in regex for perl 5.17.x
+
+ Perldl2/Plugin/CleanErrors.pm |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 2d0410fd2eb54eb4f2342723688d84ff6d22919e
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Mon Aug 13 22:36:44 2012 +1000
+
+    Basic/Complex/complex.pd - Fix handling of complex 0.
+    
+    0+0i, when raised to a real power was giving incorrect
+    results. This fix just applies some "special case"
+    handling for x+0i (where x can be either zero or non-
+    zero) when raised to a real power (including 0).
+
+ Basic/Complex/complex.pd |   26 ++++++++++++++++++++------
+ 1 files changed, 20 insertions(+), 6 deletions(-)
+
+commit 55091589dde743b006a4e139c807246d3e274111
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Mon Aug 13 22:36:43 2012 +1000
+
+    t/complex.t Test changes to Basic/Complex/complex.pd
+    
+    Test that today's changes Basic/Complex/complex.pd
+    give desired results.
+
+ t/complex.t |   22 +++++++++++++++++++++-
+ 1 files changed, 21 insertions(+), 1 deletions(-)
+
+commit 7bcf2ddc565a4516ad9219499f2179de4cee54a0
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Thu Aug 9 08:40:09 2012 -0500
+
+    Added documentation for isnull()
+
+ Basic/Core/Core.pm.PL |   22 +++++++++++++++++++---
+ 1 files changed, 19 insertions(+), 3 deletions(-)
+
+commit 17019f6fd2df8c542b5529fa74a1f6d2c8235528
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Thu Jul 26 14:35:22 2012 -0600
+
+    Fix some print statments in pdlcore.c.PL.
+    
+    When DEBUG_SETAV_TYPE or DEBUG_KLUDGE_COPY is #define'd there are
+    numerous compiler errors for print statments.  This takes care of
+    some of them.  Many more are generated because the loop over PDL
+    types does not also take care of different formatting codes (%f vs
+    %d vs %ld etc), so there is still some room for improvement.
+
+ Basic/Core/pdlcore.c.PL |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+commit 52da4d16f1e90ed83c53a26ec4f4bffe18ff2cb4
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Thu Jul 26 13:24:40 2012 -0600
+
+    Deal with an intermittent segfault in pdl_setav_$type.
+    
+    Just before pdl_kludge_copy, the index of the pdims array (the
+    dimension list) could sometimes be negative. This caused an intermittent,
+    non-reproducible segfault on my machine. The fix (thanks Craig!)
+    doesn't break any existing tests, and seemed to solve the problem.
+
+ Basic/Core/pdlcore.c.PL |    6 ++++--
+ 1 files changed, 4 insertions(+), 2 deletions(-)
+
+commit 0106d6e82a9f31fb39cc92cadcf4f4ce267c9ac4
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Wed Jul 25 13:37:20 2012 +1000
+
+    Lib/Image2D/image2d.pd Reposition the 'polyfill' definition.
+    
+    Microsoft compilers might insist that the 'polyfill' defintion
+    be positioned before the call to that function in the
+    polyfill_pp() function. (At least one of my MS compilers
+    insists on this.)
+    Fixing that also should have eradicated a "conflicting types
+    for 'polyfill'" warning that gcc was emitting.
+
+ Lib/Image2D/image2d.pd |  375 ++++++++++++++++++++++++------------------------
+ 1 files changed, 188 insertions(+), 187 deletions(-)
+
+commit 8fb45960c251edeeb3c4379aae230d97f5d85e25
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Wed Jul 25 13:37:20 2012 +1000
+
+    t/callext.t Unlink callext.pdb.
+    
+    With one MS compiler (that I know of) the callext.t
+    tests fail if there exists a 'callext.pdb' from an
+    earlier build of PDL (that was done using a
+    different MS Compiler)
+
+ t/callext.t |    5 ++++-
+ 1 files changed, 4 insertions(+), 1 deletions(-)
+
+commit 0f57385f0dafef3140b37dd971168e322bd08a89
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Wed Jul 25 13:37:19 2012 +1000
+
+    t/pdl_from_string.t "TODO" some tests with ActivePerl/MS Compilers
+    
+    Allows PDL to build on ActivePerl without any test failures.
+    (Some of these "TODO" tests already pass with some versions of
+    ActivePerl and some Microsoft compilers.)
+
+ t/pdl_from_string.t |  164 +++++++++++++++++++++++++++++++++++----------------
+ 1 files changed, 112 insertions(+), 52 deletions(-)
+
+commit 335023d70aaa4b82930186e86ee35d16652deb66
+Author: Tim Haines <communist.goatboy@gmail.com>
+Date:   Sun Jul 22 19:36:01 2012 -0400
+
+    merge in pnpoly algorithm into PDL::Image2D
+    
+    This commit represents the work by Tim Haines to
+    implement a PP version of the pnpoly algorithm and
+    to add that as an optional engine for the polyfill
+    and polyfillv routines.
+
+ Basic/Pod/PP.pod       |   24 +++++
+ Lib/Image2D/image2d.pd |  230 ++++++++++++++++++++++++++++++++++++++---------
+ t/image2d.t            |   20 ++++-
+ 3 files changed, 229 insertions(+), 45 deletions(-)
+
+commit 3cff6f134cff8e38570822b18d4a02d93b540e39
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jul 17 19:32:28 2012 -0400
+
+    Add ENVI file format bailout for PDL::IO::FlexRaw
+    
+    Since the filename + header file convention is the
+    same for PDL::IO::FlexRaw files and for ENVI format
+    files, I've added a check for ENVI and a bailout if
+    this is not a PDL::IO::FlexRaw format file.
+    
+    I expect to replace this by a call to readenvi at
+    some point to smooth things out.
+
+ IO/FlexRaw/FlexRaw.pm |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+commit 903377a96846adfb946df659a0cdaef3d4452945
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Jul 17 19:23:28 2012 -0400
+
+    Fix confusing wrap in FlexRaw.pm
+
+ IO/FlexRaw/FlexRaw.pm |    3 +--
+ 1 files changed, 1 insertions(+), 2 deletions(-)
+
+commit 966f826a1a88055f1cc88a5b6e03f08fa95f438f
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Jul 16 13:46:52 2012 -0400
+
+    Update Known_problems
+    
+    Added new sf.net bugs including one re the failure of barf
+    to generate traceback output in perldl.  This was due to a
+    change in perl exception handling starting with perl 5.14.0.
+    The work around is to install Devel::REPL so that you can
+    use the new pdl2 shell (NOTE: if you don't have Devel::REPL
+    installed, then pdl2 will run perldl for you instead---with
+    the problem mentioned here).
+
+ Known_problems |   15 ++++++++++++---
+ 1 files changed, 12 insertions(+), 3 deletions(-)
+
+commit 83543cc85c07ae19c6188f3ba3e80306c479e6b6
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Sat Jul 14 17:54:01 2012 +1000
+
+    t/pdl_from_string.t Fix some nan tests for Windows
+    
+    That is, fix as best I can.
+
+ t/pdl_from_string.t |   36 ++++++++++++++++++++++++++++++------
+ 1 files changed, 30 insertions(+), 6 deletions(-)
+
+commit 7c0ec563f1238fd8172571dae81b592eff850542
+Author: Tim Jenness <t.jenness@jach.hawaii.edu>
+Date:   Tue Jul 10 15:11:16 2012 -0700
+
+    Remove PDL::IO::NDF from main distribution
+    
+    Now available on CPAN as a separate download. A separate git
+    repository is also available.
+
+ Basic/Pod/BadValues.pod |    2 -
+ Basic/Pod/Modules.pod   |    3 +-
+ IO/IO.pod               |    3 +-
+ IO/Makefile.PL          |    2 +-
+ IO/NDF/Makefile.PL      |   21 -
+ IO/NDF/NDF.pm.PL        | 1634 -----------------------------------------------
+ MANIFEST                |    3 -
+ t/ndf.t                 |   84 ---
+ 8 files changed, 5 insertions(+), 1747 deletions(-)
+
+commit 05c24fb8b0fde8629bccc6109dbfba59caa6ee13
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Jul 9 10:44:19 2012 -0400
+
+    Add t/unpdl.t to MANIFEST
+
+ MANIFEST |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+commit 5ea80223ba548c87d0c9e6c916c59b9df4b340d0
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Sun Jul 8 15:01:30 2012 -0600
+
+    Add note to OPTIMIZE advising the addition of -O0 to -g.
+    
+    This addresses SF bug #3465663. When I set OPTIMIZE to
+    '-O0 -g', built and installed PDL, and examined a
+    segfault-produced core dump in gdb, I get full information
+    for the PDL functions (including line numbers for pdlcore.c),
+    but of course not for the Perl functions because my Perl was
+    not compiled with -g.
+
+ perldl.conf |   10 ++++++----
+ 1 files changed, 6 insertions(+), 4 deletions(-)
+
+commit 4e4e096799509f0b406adbc266bd3fdf84b27d9e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat Jul 7 12:53:34 2012 -0400
+
+    Re-enable t/gd_oo_tests.t for AMD/BSD
+    
+    This will allow development versions of PDL to
+    show the symptom with the hopes of providing
+    enough info to debug the problem for the developer.
+    Also, replaced print by diag in test output.
+
+ t/gd_oo_tests.t |   24 ++++++++++++------------
+ 1 files changed, 12 insertions(+), 12 deletions(-)
+
+commit 537a00d7b34b332b5b69d3a31d3dcc02255a4b4c
+Merge: cbda0ce 23212d2
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Fri Jul 6 17:00:51 2012 -0500
+
+    Merged Joel's work on the new unpdl method.
+
+commit cbda0cec6ad350f2aa750ea7543f132537990d1e
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Fri Jul 6 17:00:18 2012 -0500
+
+    Merge branch 'master', remote-tracking branch 'origin/master'
+
+commit bdec3fa4b6f4a4e43f71447f362e528dfcda0863
+Merge: 92844b4 a3e4397
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Fri Jul 6 11:56:40 2012 -0600
+
+    Merge branch 'master' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl
+
+commit 92844b4f87362996f5e9f526c3a158f45aa149e3
+Author: Derek Lamb <lambd@users.sourceforge.net>
+Date:   Fri Jul 6 11:55:15 2012 -0600
+
+    fix a minor POD formatting issue.
+
+ Basic/Core/Core.pm.PL |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit a3e4397a49c5a16847c228eaacdc8d727e65ab47
+Author: Tim Haines <communist.goatboy@gmail.com>
+Date:   Tue Jul 3 14:20:13 2012 -0400
+
+    make qsort[vec] inplace aware
+    
+    Applying the patch by Tim Haines.  Thanks.
+
+ Basic/Ufunc/ufunc.pd |    2 ++
+ t/ufunc.t            |   26 +++++++++++++++++++++++++-
+ 2 files changed, 27 insertions(+), 1 deletions(-)
+
+commit 88a9fff40ad7731d97b499e1e0e13af083f39246
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Tue Jul 3 20:12:37 2012 +1000
+
+    MANIFEST - add t/lgamma.t
+
+ MANIFEST |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+commit b67e2e9536ddecbb4e5392700ee115824dd22993
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Tue Jul 3 18:57:44 2012 +1000
+
+    Add lgamma() implementation for MinGW-built perls.
+    
+    The MinGW ports of gcc provide an lgamma() function.
+    Let's make use of it - as has already been done for
+    *nix systems.
+
+ Basic/Math/math.pd |   77 ++++++++++++++++++++++++++++++++-------------------
+ 1 files changed, 48 insertions(+), 29 deletions(-)
+
+commit 3f9928fe4c638aa9d84b89e0087455125134a493
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Tue Jul 3 18:57:43 2012 +1000
+
+    Provide (basic) testing for lgamma function.
+    
+    Previously untested.
+
+ t/lgamma.t |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 49 insertions(+), 0 deletions(-)
+
+commit 000212d92e2acbf24fb6d744be027bed20a636ed
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Mon Jul 2 23:50:24 2012 -0500
+
+    Fixed nan sign issue, as reported by Matthew McGillis
+    
+    I had noticed that pdl-from-string always said that 'nan' had a
+    minus sign, but I didn't bother much about it. Matthew McGillis
+    not only knew better, but wrote a patch to fix the situation,
+    which is applied here.
+    
+    The only remaining issue is now the sign of -0, which Matthew
+    included in his tentative test suite but which does not appear to
+    work on my machine. Further investigations are needed...
+
+ Basic/Core/Core.pm.PL |   24 ++++++++++++++++++------
+ t/pdl_from_string.t   |   12 +++++++++---
+ 2 files changed, 27 insertions(+), 9 deletions(-)
+
+commit 19979b1ca8784cb3c43469cc49e50b30b8710624
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Mon Jul 2 23:19:30 2012 -0500
+
+    Minor cleanups to pdl_from_string.t, inline-comment-test.t
+    
+    While working on a few other files in the test suite, I came across
+    the code in inline-comment-test.t that is supposed to ensure that
+    the tests are only run on machines that are configured properly to
+    execute the tests. The code was a bit confusing, so I cleaned it up
+    in a way that I hope makes it easier for others to follow in the
+    future.
+    
+    I also expanded the explanation of the test that is given at the
+    top of pdl_from_string, since support for inf and nan values is
+    now one of the goals of the pdl-from-string behavior.
+
+ t/inline-comment-test.t |   45 +++++++++++++++++++++++++--------------------
+ t/pdl_from_string.t     |    8 ++++----
+ 2 files changed, 29 insertions(+), 24 deletions(-)
+
+commit 23212d2a48fcab0c9b9efb7fa6e0920017839bda
+Author: Joel Berger <joel.a.berger@gmail.com>
+Date:   Sat Jun 30 17:51:54 2012 -0500
+
+    Added unpdl method
+    
+    The unpdl method is roughly an inverse of the pdl constructor.
+    It takes a piddle and returns a reference to a Perl array containing
+    a dimensionally equivalent structure of nested arrays. This complements
+    the list method, which returns a flattened list
+    of Perl scalars.
+
+ Basic/Core/Core.pm.PL |   68 ++++++++++++++++++++++++++++++++++++++++++++++--
+ t/unpdl.t             |   18 +++++++++++++
+ 2 files changed, 83 insertions(+), 3 deletions(-)
+
+commit 8aabc20852f292f6ca9183c070655708203e50b3
+Author: David Mertens <dcmertens.perl@gmail.com>
+Date:   Thu Jun 28 23:50:52 2012 -0500
+
+    Fixed and CPANified POD in Basic/Core/Core.pm
+    
+    The file Basic/Core/Core.pm.PL generates the text of the Core.pm
+    file. If any errors arose in Core.pm, they were reported from the
+    line number of Core.pm, not Core.pm.PL. Commit db274c02 was
+    supposed to fix that. Unfortunately, it also introduced a few
+    messed up lines in the resulting documentation due to lack of
+    proper pod directives. This commit not only fixes those pod
+    directives, but it also CPANifies Core.pm.PL so that readers on
+    CPAN can read the documentation and get a good facsimile of what
+    they'll read from their own machine.
+
+ Basic/Core/Core.pm.PL |  140 +++++++++++++++++++++++++++++++++++++++++++------
+ 1 files changed, 123 insertions(+), 17 deletions(-)
+
+commit 6210b499241c41510d1961f9a882b5ebba51685b
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu Jun 14 09:14:08 2012 -0400
+
+    Add :lvalue to polyfillv declaration
+
+ Lib/Image2D/image2d.pd |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 646394c9b46c2458e13f1a64a2d8304c86f500de
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Jun 4 16:46:17 2012 -0400
+
+    Apply patch adding more RNG's to PDL::GSL
+    
+    Thanks to John Lapeyre.
+
+ Lib/GSL/RNG/gsl_random.pd |   55 +++++++++++++++++++++++++++++++-------------
+ 1 files changed, 39 insertions(+), 16 deletions(-)
+
+commit 5fa882961988b3a7e4933bf0da6cb03ced178999
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Thu May 31 09:26:10 2012 +0200
+
+    [deb 2.4.11] update changelog up to 2.4.11-4
+
+ debian/changelog |   13 +++++++++++++
+ 1 files changed, 13 insertions(+), 0 deletions(-)
+
+commit cbca21383acb3e2769da7f886f2aec44d3613675
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Thu May 31 09:24:18 2012 +0200
+
+    [deb 2.4.11] explicitely set -fPIC when compiling fortran code
+
+ debian/f77conf.pl |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+commit ddc5507ba2f032cbc1ab29882b019c54cb5a362b
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Thu May 31 09:23:41 2012 +0200
+
+    [deb 2.4.11] fix dh_pdl
+
+ debian/dh_pdl |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit aa5f78a1e4db03b404d18836a7a7220e8f08fc2f
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Mon May 28 16:20:54 2012 +0200
+
+    update debian/changelog from 2.4.11-2 upload
+
+ debian/changelog |    8 ++++++++
+ 1 files changed, 8 insertions(+), 0 deletions(-)
+
+commit 2b5065921f6429f13e390694b729dd03576940d2
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Mon May 28 16:20:30 2012 +0200
+
+    override lintian warnings about images in /usr/lib
+
+ debian/pdl.lintian-overrides |    3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+commit ecee50031c591854b9ca3678d9a81afb1f46a59c
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Mon May 28 16:17:46 2012 +0200
+
+    install dh_pdl manpage
+
+ debian/pdl.manpages |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+commit 6913ca40d16702a7653475b1525c37e0521fe317
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Mon May 28 13:26:57 2012 +1000
+
+    win32/INSTALL Update info/instructions
+
+ win32/INSTALL |  109 ++++++++++-----------------------------------------------
+ 1 files changed, 19 insertions(+), 90 deletions(-)
+
+commit 7361148972b6eafdd2e3128dff1499a3df474671
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Sun May 27 18:09:44 2012 +0200
+
+    call croak always with string literal to silence gcc format-security wanrings
+    
+    fix calls to croak in Lib/GIS/Proj/Proj.pd and IO/GD/GD.pd (croak
+    was not called with a format string literal, causing
+    -Werror=format-security to abort the compilation)
+
+ IO/GD/GD.pd          |   66 ++++++++++++++++---------------------------------
+ Lib/GIS/Proj/Proj.pd |   42 ++++++++++---------------------
+ 2 files changed, 36 insertions(+), 72 deletions(-)
+
+commit 59b23d51199463df029db5d3173d84a9ac7b008f
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Sat May 26 13:08:48 2012 +0200
+
+    [deb 2.4.11] update debian/changelog
+
+ debian/changelog |   17 +++++++++++++++++
+ 1 files changed, 17 insertions(+), 0 deletions(-)
+
+commit a9b89de98b9378ac17b7097469ded34348507eeb
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Sat May 26 13:02:26 2012 +0200
+
+    [deb 2.4.11] avoid double installation of upstream changelogs
+    
+    dh_installchangelogs installs Changes now, unlike at the time I
+    introduced it
+
+ debian/pdl.docs |    2 --
+ debian/rules    |    2 +-
+ 2 files changed, 1 insertions(+), 3 deletions(-)
+
+commit c362b006bc71f0857190a93b7697098816117b24
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Sat May 26 13:00:04 2012 +0200
+
+    [deb 2.4.11] honor FFLAGS and LDFLAGS env vars in f77 setup
+
+ debian/f77conf.pl |    8 ++++++--
+ 1 files changed, 6 insertions(+), 2 deletions(-)
+
+commit 99b9e7d6804e57e5a4cac36e2474779dd70ae438
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Sat May 26 12:53:57 2012 +0200
+
+    [deb 2.4.11] add dh_pdl debhelper script
+    
+    packages depending on pdl should use dh_pdl to get the right
+    dependencies on pdl and, in case of XS/PDL::PP packages, on
+    pdlapi-$PDL_CORE_VERSION
+
+ debian/dh_pdl      |  127 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ debian/pdl.install |    1 +
+ debian/rules       |    3 +-
+ 3 files changed, 130 insertions(+), 1 deletions(-)
+
+commit 0178db29ef5ebc0510df255b3f71ff5182b2ff43
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Sat May 26 11:57:44 2012 +0200
+
+    [deb 2.4.11] introduce virtual package pdlapi-$PDL_CORE_VERSION
+    
+    Core version is saved to $PDL::Config::Debian::pdl_core_version by
+    an ugly hack using Inline::pdlpp on the pdl instance in 'blib'.
+
+ debian/control                |    2 ++
+ debian/rules                  |    6 +++++-
+ debian/write_config_debian.pl |   23 +++++++++++++++++++++++
+ 3 files changed, 30 insertions(+), 1 deletions(-)
+
+commit a777c5c8c652fec300d0c0644d33aa7709f87ae3
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Sat May 26 11:47:33 2012 +0200
+
+    [deb 2.4.11] use dh_auto_configure to call Makefile.PL
+    
+    Makefiles are written with the correct flags set, as dh_auto_configure
+    maps CFLAGS/LDFLAGS to the correct EU::MM vars.
+
+ debian/rules |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 81bd76595dff0753a94e58432e681ab49faf8c7b
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Sat May 26 11:47:00 2012 +0200
+
+    [deb 2.4.11] switch to dpkg-buildflags to obtain build flags
+
+ debian/control |    1 +
+ debian/rules   |   10 +++++++---
+ 2 files changed, 8 insertions(+), 3 deletions(-)
+
+commit 801fa40457e3a949eba7fe13713ff1ffa35856f3
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Sat May 26 11:25:44 2012 +0200
+
+    [deb 2.4.11] use 'folded' format for package relations fields
+    
+    folded format is a lot easier to diff...
+
+ debian/control |   46 ++++++++++++++++++++++++++++++++++++++++++----
+ 1 files changed, 42 insertions(+), 4 deletions(-)
+
+commit c2683384cf486b892639b43b697b3f015c9c673a
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Sat May 26 11:20:16 2012 +0200
+
+    [deb 2.4.10] import changes by Jari Aalto <jari.aalto@cante.net>
+    
+      * Remove deprecated dpatch and upgrade to packaging format "3.0 quilt".
+      * Update to Standards-Version to 3.9.3 and debhelper to 9.
+      * Add build-arch and build-indep targets; use dh_prep in rules file.
+      * Fix copyright-refers-to-symlink-license (Lintian).
+      * Fix duplicate-in-relation-field libastro-fits-header-perl (Lintian).
+      * Fix unused-override (Lintian).
+
+ debian/README.source            |   14 --------------
+ debian/changelog                |   14 +++++++++++++-
+ debian/compat                   |    2 +-
+ debian/control                  |    8 ++++----
+ debian/copyright                |    2 +-
+ debian/patches/00list           |    1 -
+ debian/patches/series           |    1 +
+ debian/rules                    |   16 ++++++++--------
+ debian/source.lintian-overrides |    4 ----
+ debian/source/format            |    1 +
+ 10 files changed, 29 insertions(+), 34 deletions(-)
+
+commit fd8126a01ca782f6da2c3906e855b749b03829e0
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Fri May 25 09:25:28 2012 +0200
+
+    [deb 2.4.10] update debian changelog from 2.4.10+dfsg-1 upload
+
+ debian/changelog |   24 +++++++++++++++++++++++-
+ 1 files changed, 23 insertions(+), 1 deletions(-)
+
+commit 2ec47d788cf35b5f588158a186bd7670fe74c0f5
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Fri May 25 09:22:10 2012 +0200
+
+    [deb 2.4.10] update debian/perldl.conf from upstream perldl.conf
+
+ debian/perldl.conf |   66 +++++++++++++++++++--------------------------------
+ 1 files changed, 25 insertions(+), 41 deletions(-)
+
+commit 4daf0bd369f101214acdd8cb80d15798dd6c988f
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Fri May 25 09:19:41 2012 +0200
+
+    [deb 2.4.10] silence lintian warning about empty dpatch list
+
+ debian/source.lintian-overrides |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+commit c82890c79bcdcd1318c2cd653ca12f22b996221e
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Fri May 25 09:16:54 2012 +0200
+
+    [deb 2.4.10] ignore lintian warning about too long line in FFT manpage
+
+ debian/pdl.lintian-overrides |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+commit 554d277b2de7b54e2037fd78ebd410a15ada20e9
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Fri May 25 09:15:28 2012 +0200
+
+    [deb 2.4.10] include release notes and upstream changes in docs
+
+ debian/pdl.docs |    4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+commit 6eed699a000c3fa792ed73a80e460f94e62cce15
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Fri May 25 09:13:59 2012 +0200
+
+    [deb 2.4.10] comment purpose of patch list
+
+ debian/patches/00list |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+commit 88fce7e87d709d40baf99afbfac246c74c9b7883
+Author: Henning Glawe <glaweh@debian.org>
+Date:   Fri May 25 09:11:40 2012 +0200
+
+    [deb 2.4.10] update minimum libopengl-perl requirement
+
+ debian/control |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit b7ab80b580e96cb5ed95dce27691aafecdcd397f
+Merge: ea4224c 26021f0
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon May 21 14:45:07 2012 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit 26021f0c628e4095ea1385bf7409b6d5c865eb70
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon May 21 14:24:57 2012 -0400
+
+    Add ASCII table load <-> rcols equivalence to MATLAB.pod
+
+ Basic/Pod/MATLAB.pod |   11 ++++++++++-
+ 1 files changed, 10 insertions(+), 1 deletions(-)
+
+commit 4e8cb0e051c956ac79050d4c5617cdb7518d35cd
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 20 14:20:45 2012 -0400
+
+    Update $PDL::VERSION to 2.4.11_001 for more development
+
+ Basic/PDL.pm   |    2 +-
+ Known_problems |    2 +-
+ Release_Notes  |   32 ++++++++++++++++++++++++++++++++
+ 3 files changed, 34 insertions(+), 2 deletions(-)
+
 commit 4773c96763f3f9450382fe97d951f653eb2ae94c
 Author: Chris Marshall <devel.chm.01@gmail.com>
 Date:   Sun May 20 13:32:17 2012 -0400
@@ -188,6 +5058,13 @@ Date:   Mon May 14 17:18:38 2012 -0400
  Known_problems |    3 +++
  2 files changed, 5 insertions(+), 2 deletions(-)
 
+commit ea4224cfa2b1ae3a0d87f55aeb7e8de872d8bc7c
+Merge: cce9a44 d90cc14
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon May 14 15:39:42 2012 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
 commit d90cc142360c32dbd33bdfb39a74b63061fc5841
 Author: Chris Marshall <devel.chm.01@gmail.com>
 Date:   Mon May 14 15:37:22 2012 -0400
@@ -212,6 +5089,20 @@ Date:   Mon May 14 15:26:15 2012 -0400
  t/gd_oo_tests.t |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
+commit cce9a449fbb51ad8777ac4593cf1c9f9030e03eb
+Merge: 375b3aa 8fca2d9
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 13 19:36:38 2012 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit 375b3aafecea1628130f830a8f6debd08eb575b5
+Merge: a802570 902b02b
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sun May 13 19:33:50 2012 -0400
+
+    Merge branch '64bit-index-support' of ssh://pdl.git.sourceforge.net/gitroot/pdl/pdl into 64bit-index-support
+
 commit 8fca2d94182d8977cb2065955433c26dd5f872f4
 Author: sisyphus_ <sisyphus1@optusnet.com.au>
 Date:   Sun May 13 17:00:22 2012 +1000
@@ -243,6 +5134,29 @@ Date:   Sun May 13 15:45:41 2012 +1000
  Graphics/PGPLOT/Window/Window.pm |  650 +++++++++++++++++++-------------------
  1 files changed, 325 insertions(+), 325 deletions(-)
 
+commit 902b02bd0e6167858cbbfa00f0fc5b91db8798d3
+Author: sisyphus_ <sisyphus1@optusnet.com.au>
+Date:   Sun May 13 14:56:21 2012 +1000
+
+    Remove deprecation warning in PGPLOT/Window/Window.pm
+    
+    With perl-5.16 a deprecation warning was being emitted in
+    relation to a "defined(@array)".
+    At line 4416, changed:
+    if (defined(@{$self->{_env_options}})) {
+    to
+    if (@{$self->{_env_options}}) {
+
+ Graphics/PGPLOT/Window/Window.pm |  650 +++++++++++++++++++-------------------
+ 1 files changed, 325 insertions(+), 325 deletions(-)
+
+commit a802570dd6b1b859a615525fdf06f113ed8492de
+Merge: 858df9b 19fd7c2
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Sat May 12 11:37:44 2012 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
 commit 19fd7c2db9107e59cb2143fa49d76b3df8a23511
 Author: Chris Marshall <devel.chm.01@gmail.com>
 Date:   Sat May 12 09:18:28 2012 -0400
@@ -301,6 +5215,39 @@ Date:   Fri May 11 15:04:36 2012 -0500
  Basic/Core/Core.pm.PL |   25 +++++++------------------
  1 files changed, 7 insertions(+), 18 deletions(-)
 
+commit 858df9bfe3f4173c6cd14974cdb8734542e2c31f
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 9 13:40:07 2012 -0400
+
+    Make oldlen cast be PDL_Index in pdlcore.c and add diag() to t/slice.t
+
+ Basic/Core/pdlcore.c.PL |    2 +-
+ t/slice.t               |   53 +++++++++++++++++++++++------------------------
+ 2 files changed, 27 insertions(+), 28 deletions(-)
+
+commit 02a2351e2ba29aeb5c079a9f07bc86ca2f9838eb
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue May 8 09:45:35 2012 -0400
+
+    Change strtol to strtoll in slices.pd
+    
+    I hope this will fix some of the failures from
+    slicing operations reported by Ingo.  Still have
+    other issues but still no-one able to directly
+    debug on a 64bit system.
+    
+    If you have a 64bit system, more than 4GB of memory
+    and are able to perform PDL+XS/PP debugging, your help
+    would be greatly appreciated.  It is *very* difficult
+    to make progress without being able to gdb or printf
+    to locate the source of fails.  I think we're getting
+    close but until the low level stuff is working, we're
+    not able to merge these hardwired 64bit support mods
+    into the master.
+
+ Basic/Slices/slices.pd |   10 +++++-----
+ 1 files changed, 5 insertions(+), 5 deletions(-)
+
 commit 8de38c3f09814ec93da1cd8d0eefd051b20e6573
 Author: David Mertens <dcmertens.perl@gmail.com>
 Date:   Mon May 7 12:04:12 2012 -0500
@@ -319,6 +5266,177 @@ Date:   Mon May 7 09:40:25 2012 -0500
  Basic/Core/Core.pm.PL |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
+commit 3779ba7f5880de92605342a19889c7e74fba7aef
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Fri May 4 14:13:17 2012 -0400
+
+    More PDL_Index fixes to slices.pd
+    
+    Progress is being made but I think there are still some
+    declarations that may not be quite right.
+
+ Basic/Slices/slices.pd |   62 ++++++++++++++++++++++++------------------------
+ 1 files changed, 31 insertions(+), 31 deletions(-)
+
+commit f258d4381c5506b1619c3bc69ab6faa2edfcc4af
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Thu May 3 17:45:12 2012 -0400
+
+    Update pdl_allocdata and pdl_grow to use PDL_Index
+    
+    The pdl_allocdata fix is needed to allocate large piddles.
+    The pdl_grow change to use PDL_Index type rather than
+    STRLEN for the element count is appropriate now that
+    we have a PDL_Index type to use.
+
+ Basic/Core/pdlapi.c     |    2 +-
+ Basic/Core/pdlcore.h.PL |    4 ++--
+ Basic/Core/pdlhash.c    |    2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+commit fd4bb5baa29e898cd0d293dc79e6c769feb70cf4
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed May 2 18:12:40 2012 -0400
+
+    Make rangeb et al coerce index to PDL_Index now instead of long
+    
+    Again, this is hardwired for now.  Still, it eliminates a couple
+    more test failures....
+
+ Basic/Slices/slices.pd |   14 +++++++-------
+ 1 files changed, 7 insertions(+), 7 deletions(-)
+
+commit 535aab25764153989091acb6e0ec596a8b57e973
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue May 1 16:19:14 2012 -0400
+
+    More 64bit index fixes: PP, Slices, Ufunc, Storable
+    
+    Add more fixes to the PP code generation and to some of the
+    XS/PP modules to introduce the new PDL_Index datatype.  The
+    64bit-index-support branch is currently hardwired for PDL_Index
+    type being 'long long'.  Not all tests are passing but if
+    you have a 64bit platform it should build and run (somewhat).
+
+ Basic/Gen/PP.pm         |    2 +-
+ Basic/Slices/slices.pd  |  102 +++++++++++++++++++++++-----------------------
+ Basic/Ufunc/ufunc.pd    |   12 +++---
+ IO/Storable/storable.pd |    2 +-
+ 4 files changed, 59 insertions(+), 59 deletions(-)
+
+commit a4e8dcb8c7ccd67492f53a160716615fee39387e
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Apr 30 17:54:25 2012 -0400
+
+    More 64bit index support and PP code generation fixes
+    
+    Testing with typedef long long PDL_Index flushed out a bunch
+    more places where indexing type changes affect the PDL code.
+    Once the Core routines built without error, work continued
+    with fixing types in PP code generation.  Work is still underway
+    but now a bunch of the tests pass with 77/781 subtests failed!
+
+ Basic/Core/Core.xs.PL     |   11 +++++----
+ Basic/Core/pdl_hfiles.p   |    2 +-
+ Basic/Core/pdlapi.c       |   25 ++++++++++++-----------
+ Basic/Core/pdlcore.c.PL   |    2 +-
+ Basic/Core/pdlcore.h.PL   |    8 +++---
+ Basic/Core/pdlhash.c      |    2 +-
+ Basic/Core/pdlsections.g  |   46 ++++++++++++++++++++++++--------------------
+ Basic/Core/pdlthread.c    |   44 ++++++++++++++++++++++--------------------
+ Basic/Gen/PP.pm           |    4 +-
+ Basic/Gen/PP/PDLCode.pm   |   14 ++++++------
+ Basic/Gen/PP/PdlParObj.pm |    2 +-
+ Basic/Ufunc/ufunc.pd      |   22 ++++++++++----------
+ MANIFEST                  |    3 --
+ 13 files changed, 95 insertions(+), 90 deletions(-)
+
+commit 32bc994ac411e102ca1de647fa68b09abb499f10
+Merge: a9c07c9 7576911
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Wed Apr 25 10:58:03 2012 -0400
+
+    Merge branch 'master' into 64bit-index-support
+
+commit a9c07c9db79ac121830bdcb99baf44e976a8b8f2
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Tue Apr 24 18:09:23 2012 -0400
+
+    Hardwire typedef for PDL_Index into pdl_hfiles.p
+    
+    This is enough to test the new 64bit index support by
+    hand-editing this typedef to the correct type.  If that
+    is a 64bit one for your platform, everything should
+    work (eventually).  Untested so far.
+
+ Basic/Core/pdl_hfiles.p |    2 +-
+ Basic/Core/pdlcore.c.PL |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit d1a7734716b55812660160cc2982ffb7149feea4
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Apr 23 17:26:31 2012 -0400
+
+    Make perldl.conf with no extensions selected for Core debugging
+    
+    After the basic 64bit support is working for the core, then we'll
+    add back the extensions to confirm/fix any issues there.
+
+ perldl.conf |   18 +++++++++---------
+ 1 files changed, 9 insertions(+), 9 deletions(-)
+
+commit 4579b827ba6197572edff3a8aabb637c51f8f806
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Apr 23 17:24:34 2012 -0400
+
+    Minor fixes to get new Core/* to build
+    
+    This involved adding an entry for PDL_Index to typemap, making the
+    declaration of pdl_grow consistent (to STRLEN) and hand-adding a
+    typedef for PDL_Index to pdl.h.  This needs to be replaced by an
+    automatic configuration eventually.
+
+ Basic/Core/Core.xs.PL |    2 +-
+ Basic/Core/pdlhash.c  |    2 +-
+ Basic/Core/typemap    |    1 +
+ 3 files changed, 3 insertions(+), 2 deletions(-)
+
+commit 2adb1af3bb41caea2530bf070a360d2540c4c452
+Author: Chris Marshall <devel.chm.01@gmail.com>
+Date:   Mon Apr 23 16:22:49 2012 -0400
+
+    Preliminary set of 64bit index support modes to Basic/Core
+    
+    The first stage of the conversion of PDL indexing to support 64bit
+    platforms is to replace all usages of int, long, and PDL_Long that
+    are actually indexes into piddles (or the equivalents: dimension
+    lengths, nvals, ...) by a new PDL_Index datatype that is determined
+    at build time to correspond to the supported index/pointer sizes for
+    a given platform.
+    
+    This first set of conversions is all by inspection and I expect
+    problems to show up on the first build tests.  Specifically, there
+    will need to be defined the printf format appropriate to PDL_Index
+    on a given platform that will need to be used for the built in
+    diagnostics.
+    
+    For configuration, the interesting parameters from %Config are:
+     - lseeksize and lseektype for file offsets
+     - sizesize and sizetype for memory offsets/sizes and indexing
+    
+    TO CHECK: there are some usages of pdl_packint and pdl_unpackint
+    in the Core files that maybe should be using the PDL_Index type.
+
+ Basic/Core/Core.xs.PL     |   49 ++++++++++++++-------------
+ Basic/Core/Types.pm.PL    |   17 ++++++++++
+ Basic/Core/pdl.h.PL       |   16 ++++----
+ Basic/Core/pdlconv.c.PL   |    3 +-
+ Basic/Core/pdlcore.c.PL   |   67 +++++++++++++++++++-------------------
+ Basic/Core/pdlcore.h.PL   |   79 +++++++++++++++++++++++----------------------
+ Basic/Core/pdlsimple.h.PL |   10 +++---
+ Basic/Core/pdlthread.h    |   12 +++---
+ 8 files changed, 137 insertions(+), 116 deletions(-)
+
 commit 757691190bb503aea6e35a98106601974fca11af
 Merge: 4002248 1f32e53
 Author: David Mertens <dcmertens.perl@gmail.com>
@@ -5309,8 +10427,8 @@ Date:   Sat Aug 13 13:17:57 2011 -0400
     Update Release_Notes for CPAN devel release
 
  MANIFEST.SKIP |    1 +
- Release_Notes |   24 +++++++++++++++++++++---
- 2 files changed, 22 insertions(+), 3 deletions(-)
+ Release_Notes |   22 ++++++++++++++++++++--
+ 2 files changed, 21 insertions(+), 2 deletions(-)
 
 commit 5097f70403e8439cbe28a9cec8c041ec27bfc94c
 Author: Chris Marshall <devel.chm.01@gmail.com>
@@ -7150,7 +12268,7 @@ Date:   Sun Mar 27 16:10:19 2011 -0400
 
     More updates for PDL-2.4.8 pre-release 1
 
- Release_Notes                   |    5 ++---
+ Release_Notes |    5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)
 
 commit 302975c1f6c1ded3bad25b4f79667ae85483c673
@@ -9954,8 +15072,8 @@ Date:   Wed Aug 18 20:55:52 2010 -0400
  Basic/PDL.pm   |    2 +-
  Release_Notes  |   48 ++++++++++++++++++++++++--
  TODO           |  106 ++++++++++++++++++++++++++-----------------------------
- cygwin/INSTALL |   23 +++++++-----
- 4 files changed, 109 insertions(+), 70 deletions(-)
+ cygwin/INSTALL |   27 ++++++++------
+ 4 files changed, 111 insertions(+), 72 deletions(-)
 
 commit 6155d20969a9307ae234e71efa87377d58d400b8
 Author: Chris Marshall <devel.chm.01@gmail.com>
@@ -11691,8 +16809,8 @@ Date:   Sun Jul 11 18:30:57 2010 -0400
     Update Release_Notes and Known_problems for CPAN
 
  Known_problems |    2 +-
- Release_Notes  |   54 ++++++++++++++++++++++++++++++++++++++----------------
- 2 files changed, 39 insertions(+), 17 deletions(-)
+ Release_Notes  |   50 ++++++++++++++++++++++++++++++++++++--------------
+ 2 files changed, 37 insertions(+), 15 deletions(-)
 
 commit f4a51927326c9d21b5ed1ee779c83d8083cea316
 Author: Chris Marshall <devel.chm.01@gmail.com>
@@ -12436,8 +17554,8 @@ Date:   Wed Jun 16 14:55:18 2010 -0400
      All non-NaN vectors with BAD values next.
      All NaN containing vectors last.
 
- Basic/Primitive/primitive.pd |  142 +++++++++++++++++++++++++++--------------
- 1 files changed, 93 insertions(+), 49 deletions(-)
+ Basic/Primitive/primitive.pd |  140 +++++++++++++++++++++++++++--------------
+ 1 files changed, 92 insertions(+), 48 deletions(-)
 
 commit fc225489f967568f642a0b1efb5b20d8181a38f8
 Author: Chris Marshall <devel.chm.01@gmail.com>
@@ -14243,11 +19361,11 @@ Date:   Sun May 9 10:20:23 2010 +0200
 
     update debian packaging to uploaded 2.4.6
 
- debian/changelog    |   16 ++++++++++++++--
+ debian/changelog    |   18 +++++++++++++++---
  debian/control      |   10 +++++-----
  debian/pdl.postinst |    1 -
  debian/rules        |    2 +-
- 4 files changed, 20 insertions(+), 9 deletions(-)
+ 4 files changed, 21 insertions(+), 10 deletions(-)
 
 commit ae8d79b8076a3b434067162aa6be9f9f0501748d
 Author: Henning Glawe <glaweh@debian.org>
@@ -14294,8 +19412,8 @@ Date:   Sat May 8 01:21:50 2010 -0600
     Replaced simple threading expression with a PP tiling loop; yields 2x speedup
     for large matrices due to better cache hits. -- CED
 
- Basic/Primitive/primitive.pd |  100 ++++++++++++++++++++++++++++-------------
- 1 files changed, 68 insertions(+), 32 deletions(-)
+ Basic/Primitive/primitive.pd |   98 ++++++++++++++++++++++++++++-------------
+ 1 files changed, 67 insertions(+), 31 deletions(-)
 
 commit 5402c258d081efadd8cad0f152947f98405ceb8d
 Author: Chris Marshall <devel.chm.01@gmail.com>
@@ -15599,9 +20717,9 @@ Date:   Thu Feb 11 21:47:25 2010 -0600
     was an error, I go on a big parsing spree to figure out what all the
     user may have screwed up.
 
- Basic/Core/Core.pm.PL |  114 ++++++++++++++++++++++++++++++++++++++++---------
+ Basic/Core/Core.pm.PL |  112 ++++++++++++++++++++++++++++++++++++++++--------
  t/core.t              |   33 ++++++++++++--
- 2 files changed, 122 insertions(+), 25 deletions(-)
+ 2 files changed, 121 insertions(+), 24 deletions(-)
 
 commit 5011f4d63e91d6857b6132e74e9c16afcb07b432
 Merge: 54532da ff8da8b
@@ -17902,9 +23020,9 @@ Date:   Mon Oct 12 18:17:44 2009 -0400
     systems.
 
  Basic/PDL.pm                 |    2 +-
- Graphics/TriD/POGL/OpenGL.pm |  127 ++++++++++++++++++++++--------------------
+ Graphics/TriD/POGL/OpenGL.pm |  125 ++++++++++++++++++++++--------------------
  Graphics/TriD/TriD/GL.pm     |    5 ++
- 3 files changed, 73 insertions(+), 61 deletions(-)
+ 3 files changed, 72 insertions(+), 60 deletions(-)
 
 commit b601580cfb768c9c28aa7d3a55d2f1068d1adf8b
 Author: Chris Marshall <marshallch@users.sourceforge.net>
@@ -18349,9 +23467,9 @@ Date:   Fri Oct 2 15:20:08 2009 -0400
  Graphics/TriD/TriD/Surface.pm     |    2 +-
  Graphics/TriD/TriD/Tk.pm          |    2 +-
  Makefile.PL                       |    2 +-
- Release_Notes                     |   29 +++++++++++++++++++++++------
+ Release_Notes                     |   31 ++++++++++++++++++++++++-------
  t/opengl.t                        |    4 ++--
- 14 files changed, 40 insertions(+), 23 deletions(-)
+ 14 files changed, 41 insertions(+), 24 deletions(-)
 
 commit 96eaffbc596fc0764e4fdce913c4caae1ce7ffd9
 Author: Chris Marshall <devel.chm.01@gmail.com>
@@ -1,5 +1,5 @@
 +----------------------------------------------------------------------------+
-|                        PPDL Module Dependencies                            | 
+|                        PDL Module Dependencies                            | 
 +----------------------------------------------------------------------------+
 
 This file lists dependencies of PDL modules on external programs
@@ -35,19 +35,18 @@ PDL (all)         perl >= 5.8.x           PDL requires at least this version
                   Pod::Parser >= 0        perl5 core module.
                   Pod::Select >= 0        perl5 core module.
 
-                  ExtUtils::MakeMaker >= 6.31
+                  ExtUtils::MakeMaker >= 6.56
 
 		                          This version of EU::MM is the first
-					  with support for INSTALL_BASE for
-					  non-system install locations.  If
-					  you edit the top level Makefile.PL
-					  and change the 6.31 to 0 in two
-					  spots, you can build with older
-					  versions---not recommended.
+					  with support for CONFIGURE_REQUIRES.
+
 
 PDL::NiceSlice    Text::Balanced >= 1.89  A nicer way to index piddles.
                   Filter::Util::Call
 
+                  Filter::Simple          Required for new PDL::NiceSlice
+                  Module::Compile         implementation under development.
+
 
 Inline::Pdlpp     Inline >= 0.43          This module allows to define fast
                                           PP code inline in your scripts.
@@ -80,6 +79,11 @@ PDL::IO::Storable Storable >=1.03
 pdl2   (shell)    Devel::REPL >= 1.003011
                   and Term::ReadLine::Perl    
                   or Term::ReadLine::Gnu 
+		                          
+					  Devel::REPL requires Data::Dump::Streamer
+					  to support pdl2.  This may need to be
+					  hand-installed if you are doing a manual
+					  PDL build.
 
 perldl (shell)    Term::ReadLine::Perl    
                   or Term::ReadLine::Gnu 
@@ -91,17 +95,6 @@ perldl (shell)    Term::ReadLine::Perl
                                           or Term::ReadLine::Gnu is not installed.
 
 
-PDL::FFTW         Needs the FFTW library version 2 installed.
-                  FFTW is a free C FFT library including multi-
-                  dimensional, real, and parallel transforms.
-                  See http://www.fftw.org/ 
-
-                  NOTE: The latest version of FFTW is FFTW3.
-
-                                          Will *not* be built unless
-                                          FFTW version 2 is detected.
-
-
 PDL::GIS::Proj
 PDL::Transform::Proj
                   A PDL interface to the PROJ4 geographic projection
@@ -223,29 +216,16 @@ PDL::IO::HDF      PDL interface to HDF4 library.  See
                                           HDF4 libraries are detected.
 
 
-PDL::IO::NDF      NOTE: These refs/URLs may be incorrect or outdated.
-
-                  Requires the perl/NDF interface, NDFPERL, which
-                  also requires a fortran compiler and the fortran
-                  NDF library.  Get the STARPERL package from
-                  http://starlink.jach.hawaii.edu/starlink where
-                  there appears to be a git repository for STARPERL at
-                  http://starlink.jach.hawaii.edu/git/?p=starperl.git;a=summary .
-
-                                          Module builds ok without
-                                          NDF module and library
-
-
-PDL::IO::Pic      rpic/wpic: PBM+ or NetPBM converters
+PDL::IO::Pic      rpic/wpic: NetPBM converters
                   See http://netpbm.sourceforge.net/
 
                   wmpeg: requires the ffmpeg program
                   See http://ffmpeg.org/
 
                                           Module builds ok without
-                                          converters but t/pic_16bit
-                                          will fail without a recent
-                                          enough version of NetPBM.
+                                          converters.  Recommend at
+                                          least version 10.58.00 of
+                                          NetPBM.
 
 
 PDL::Minuit       PDL interface to Minuit minimization routines in
@@ -13,7 +13,7 @@ distribution is in a publicly accessible Git
 repository. The project is hosted at the
 sourceforge site at
 
-  http://sourceforge.net/projects/pdl/pdl
+  http://sourceforge.net/projects/pdl/
 
 Starting from the above URL you will find
 directions on how to check out the current
@@ -95,7 +95,7 @@ improve or add to PDL (please do):
 See the pdl-porters email list; details for subscription and access to
 the archives can be found on the PDL web page at:
 
-  http://pdl.sourceforge.net/maillists/
+  http://pdl.perl.org/?page=mailing-lists
  
 *) Access to PDL's configuration
 
@@ -0,0 +1,332 @@
+##############################
+# Gnuplot_demo package for PDL
+#
+# To use this manually:
+#    use PDL::Demos::Screen;
+#    do 'Gnuplot_demo.pm';
+#    PDL::Demos::Gnuplot_demo::run();
+#
+# Authors: Dima Kogan & Craig DeForest
+
+package PDL::Demos::Gnuplot_demo;
+
+use PDL;
+
+BEGIN {
+    eval 'use PDL::Graphics::Gnuplot;';
+    if ($@ or !defined($PDL::Graphics::Gnuplot::VERSION)) {
+	eval <<'EOF';
+	    sub run {
+	    print qq{
+
+PDL::Graphics::Gnuplot is required for this demo, but didn't load.  You may have
+to go get it from CPAN (http://search.cpan.org).  You might also need to get the 
+external "gnuplot" app (http://www.gnuplot.info).
+
+};
+	}
+EOF
+    }
+    return 1;
+}
+
+use PDL::ImageND;
+
+use PDL::Demos::Screen;   # This is awful but seems to be needed since Screen.pm is where the Routines are located. -CED 2/2013
+
+PDL::Demos::Routines->import();
+sub comment($);
+sub act($);
+sub output;
+
+
+sub run {
+    local($PDL::debug) = 0;
+    local($PDL::verbose) = 0;
+    
+
+    $s = q|
+  # ensure that the module is loaded 
+  use PDL::Graphics::Gnuplot;
+
+  # Create a Gnuplot object - the default device displays on most 
+  # operating systems.  (No plot window yet - just the object).
+  
+  $w = gpwin(%%params%%);
+
+  # Create variables to plot
+  $x = xvals(1000);
+  $y = $x/1000 * sin($x/10);
+
+|;
+    if(!defined($PDL::Graphics::Gnuplot::VERSION)) {
+	die q{
+
+*******************************************************************************
+This demo requires both the external "gnuplot" application and the module 
+"PDL::Graphics::Gnuplot".  You don't seem to have the module installed on your 
+system.  You might want to get it from CPAN and try again.
+*******************************************************************************
+
+};
+    }
+
+    if(!defined($PDL::Graphics::Gnuplot::valid_terms)) {
+	my $ww = new PDL::Graphics::Gnuplot;
+    }
+
+    if($PDL::Graphics::Gnuplot::valid_terms->{wxt}) {
+	$subst = "wxt, size=>[8,6,'in'], title=>'Gnuplot demo window', persist=>0";
+    } elsif($ENV{DISPLAY}) {
+	$subst = "x11, size=>[8,6,'in'], title=>'Gnuplot demo window', persist=>0";
+    } else {
+	$subst = "";
+    }
+    $s=~s/\%\%params\%\%/$subst/;
+    act $s;
+
+
+   $s = q|
+  # ensure that the module is loaded 
+  use PDL::Graphics::Gnuplot;
+
+  # Create a Gnuplot object - the default device displays on most 
+  # operating systems.  (No plot window yet - just the object).
+  $w = gpwin(%%params%%);
+
+  # Create variables to plot
+  $x = xvals(1000)/1000;
+  $y = $x * sin(100 * $x);
+
+  # Generate a line plot.  Plot parameters in front.
+  $w->lines({title=>" x * sin(100 x) ",xl=>"Ordinate",yl=>"Abscissa"}, $x, $y );
+|;
+    $s =~s/\%\%params\%\%/$subst/;
+    act $s;
+
+  act q|
+ 
+  # You can set persistent plot parameters with "options".
+  $w->options(title=>"Two lines", xl=>"Ordinate", yl=>"Abscissa");
+
+  # A two-line plot
+  $y2 = sqrt($x) * cos(100*$x);
+  $w->lines($x,$y,{},$x,$y2);
+
+|;
+
+ act q|
+  # You can set persistent plot parameters with "options".
+  $w->options(title=>"Two lines", xl=>"Ordinate", yl=>"Abscissa");
+
+  # A two-line plot.  
+  # Groups of data are separated by non-PDL options -- in this
+  # case, the null hash since there are no per-curve options.
+
+  $y2 = sqrt($x) * cos(100*$x);
+  $w->lines($x,$y,{},$x,$y2);
+
+  # A two-line plot with legend.
+  # The legend for each line separates the groups of PDL data.
+
+  $w->options(title=>"Two lines (with legend)", key=>'left');
+  $w->lines( legend=>"sin",$x,$y,  legend=>"cos",$x,$y2 );
+
+  # 
+|;
+
+ act q|
+  # You can also generate multiline plots with threading.
+  # Here, $x is a 1000-element 1-D PDL, and $yy is a 1000x2 2-D PDL.
+  
+  $x       = xvals(1000)/1000;
+  ($y,$y2) =  ( $x * sin(100 * $x),   sqrt($x) * cos(100 * $x)  );
+  $yy      = pdl( $y, $y2 );               
+
+  # all options can be abbreviated to the smallest unique string. 
+  # Here, "tit" stands for "title", and "le" for "legend".
+
+  $w->lines({tit=>"2-lines threaded"}, le=>["sin", "cos"], $x, $yy);
+
+
+
+|;
+
+act q|
+  # line plots are far from the only thing you can do!
+  
+  # Here is the same plot, with points and some tweaks to the axis labels.
+  $w->options(tit=>"2 sets of points");
+
+  $l = ["sin", "cos"];
+  $w->points({xtics=>{rotate=>45,offset=>[0,-1.5],font=>',14'},
+              xlab=>"Tilted Labels in 14-point text}"
+             },
+             le=>$l, $x, $yy);
+
+
+
+|;  
+
+act q|
+  # Many types of plot are supported, using the "plot" command
+  # and the "with" curve option.  Here, we can mix and match points and lines.
+
+  # You can also set plot options *temporarily* with a hash ref at the start of the
+  # plot call:
+
+  $w->plot( {title=>"Points and lines mixed"},
+            with=>'points', le=>'sin (points)', $x, $y, 
+            with=>'lines',  le=>'cos (line)',   $x, $y2);
+
+
+|;
+
+act q|
+  # Many types of plot are supported, using the "plot" command
+  # and the "with" curve option.  Here, we can mix and match points and lines.
+
+  $w->plot( with=>'points', le=>'sin (points)', $x, $y, 
+            with=>'lines',  le=>'cos (line)',   $x, $y2);
+
+  $x       = xvals(51)/50;
+  ($y,$y2) =  ( $x * sin(20 * $x),   sqrt($x) * cos(20 * $x)  );
+  $radii = 0.01 * (0.25 - ($x*2 - 0.5)**2);
+
+  # Here are some other options.  
+  $w->plot( {title=>"Circles and Steps"},
+            le=>"Circles", with=>'circles', $x, $y, $radii,
+            le=>"Steps", with=> 'steps',    $x, $y2
+          );
+|;
+
+act q|
+  # You can plot multiple plots on one pane with "multiplot".
+
+  $x       = xvals(51)/50;
+  ($y,$y2) =  ( $x * sin(20 * $x),   sqrt($x) * cos(20 * $x)  );
+
+
+  $w->multiplot(layout=>[1,2]);
+
+  $w->plot( {title=>"Impulses"}, with=> 'impulses', $x, $y );
+  $w->plot( {title=>"Filled Curves"}, with => "filledcurves", $x, $y, $y2 );
+
+  $w->end_multi();
+|;
+
+act q|
+  # 2-D data...
+
+  $rv = rvals(51,51)/2;
+  $im = 25 * cos($rv) / ($rv+1.5);
+
+  $w->multiplot(layout=>[2,2]);
+  $w->options(justify=>1);  # set nice aspect ratio
+  $w->plot( {tit=>'Default color map'},             with=>'image', $im );
+  $w->plot( {tit=>'Grayscale',      clut=>'gray'},  with=>'image', $im );
+  $w->plot( {tit=>'heat map',       clut=>'heat1'}, with=>'image', $im );
+  $w->plot( {tit=>'3d perspective', trid=>1},       with=>'pm3d',  $im );
+  $w->end_multi;
+
+|;
+
+
+
+act q|
+  # You can indpendently specify color and position on surface plots,
+  # and can overlay multiple types of plot -- even in 3D.
+  # 
+  $rv = rvals(101,101)/5;             $im = cos($rv)/($rv+2.5);
+  $grad = sumover $im->range([[-1,0],[1,0]],[$im->dims],'e') * pdl(-1,1);
+
+  $im2 = $im->indexND(ndcoords(26,26)*4);  # subsample $im
+
+  $w->reset;
+  $w->options( trid=>1,   hidden=>'front',  colorbox=>0,  clut=>'heat1'  );
+
+  $w->multiplot(layout=>[2,2]);
+
+  $w->plot( {title=>"A colormap-shaded 3-d surface plot"},   with=>'pm3d', $im );
+
+  $w->plot( {title=>"Perspective 3-d surface plot"},         
+             with=>'pm3d', xvals($im), yvals($im), $im, $grad );
+
+  $w->plot( {title=>"Perspective grid plot"},
+              with=>'lines', xvals($im2)*4, yvals($im2)*4, $im2 );
+
+  $w->plot( {title=>"Combined"},
+              with=>'pm3d',  xvals($im),yvals($im), $im, $grad,
+              with=>'lines', xvals($im2)*4,  yvals($im2)*4, $im2 );
+
+  $w->end_multi;
+
+|;
+
+ 
+    use File::Spec;
+    $d = File::Spec->catdir( "PDL", "Demos" );
+    $m51path = undef;
+    foreach my $path ( @INC ) {
+	my $check = File::Spec->catdir( $path, $d );
+	if ( -d $check ) { $m51path = $check; last; }
+    }
+    if( defined($m51path) && -e "$m51path/m51.fits") {
+	$m51path = "$m51path/m51.fits";
+    } else {
+	comment q|
+  
+ ******************************************************
+  You seem to be missing the file 'm51.fits', which 
+  should be included in the PDL distribution.  Without
+  it, I can't show you the m51 image demos, so I'll 
+  quit now.  
+ ******************************************************
+ |;
+	return;
+    }
+
+    $s =  q|
+  # Images ...
+ 
+  $m51 = rfits('%%m51%%');
+
+  $w->reset;
+  $w->image({j=>1, clut=>'gray', title=>"M51 galaxy"}, with=>'image',$m51 );
+|;
+
+    $s=~ s/\%\%m51\%\%/$m51path/;
+    act $s;
+  
+    $s =  q|
+
+   $m51 = rfits('%%m51%%')->slice('0:-1:4,0:-1:4');
+
+   $m51s = $m51->convolveND(ones(11,11)/11**2);
+
+   $w->options(clut=>'heat2', trid=>1);
+
+   # 3-D display of M51: various angles (note "columnsfirst" in multiplot)
+
+   $w->multiplot(layout=>[2,2,'columnsfirst']);
+
+   $w->plot({title=>"M51 in 3-D (default view)"}, 
+             with=>'pm3d',xvals($m51s), yvals($m51s), $m51s, $m51s );
+   $w->plot({title=>"M51 in 3-D (ortho view)",            view=>'equal xy'},
+             with=>'pm3d',xvals($m51s), yvals($m51s), $m51s, $m51s );
+
+   $w->plot({title=>"M51 in 3-D (near-vertical view)",    view=>[ 0, 80, 'equal xy' ]},
+             with=>'pm3d',xvals($m51s), yvals($m51s), $m51s, $m51s );
+   $w->plot({title=>"M51 in 3-D (nearly along X axis)",   view=>[ 85, 5 ]},
+             with=>'pm3d',xvals($m51s), yvals($m51s), $m51s, $m51s );
+   
+   $w->end_multi;
+
+|;
+    $s =~ s/\%\%m51\%\%/$m51path/;
+    act $s;
+}
+1;
+
+  
+
@@ -23,9 +23,12 @@ WriteMakefile(
                     'BAD2_demo.pm'      => '$(INST_LIBDIR)/Demos/BAD2_demo.pm',
                     'Transform_demo.pm' => '$(INST_LIBDIR)/Demos/Transform_demo.pm',
                     'Cartography_demo.pm' => '$(INST_LIBDIR)/Demos/Cartography_demo.pm',
+		    'Gnuplot_demo.pm'   =>  '$(INST_LIBDIR)/Demos/Gnuplot_demo.pm',
                     '../m51.fits'       => '$(INST_LIBDIR)/Demos/m51.fits',
+                    'Prima.pm' => '$(INST_LIBDIR)/Demos/Prima.pm',
 		   },
-     'clean' => { 'FILES' => 'BAD_demo.pm BAD2_demo.pm' }
+     'clean' => { 'FILES' => 'BAD_demo.pm BAD2_demo.pm' },
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
 # For the lazy people
@@ -0,0 +1,618 @@
+use strict;
+use warnings;
+
+############################################################################
+                         package PDL::Demos::Prima;
+############################################################################
+
+use PDL;
+
+=head1 NAME
+
+PDL::Demos::Prima - PDL demo for PDL::Graphics::Prima
+
+=head1 SYNOPSIS
+
+You can enjoy this demo in any number of ways. First, you can invoke the
+demo from the command line by saying
+
+ perl -MPDL::Demos::Prima
+
+Second, you can invoke the demo from with the pdl shell by saying
+
+ pdl> demo prima
+
+Finally, all of the content is in the pod documentation, so you can simply
+read this, though it won't be quite so interactive. :-)
+
+ perldoc PDL::Demos::Prima
+ podview PDL::Demos::Prima
+
+=head1 DESCRIPTION
+
+The documentation in this module is meant to give a short, hands-on
+introduction to L<PDL::Graphics::Prima|PDL::Graphics::Prima/>, a plotting
+library written on top of the L<Prima|Prima/> GUI toolkit.
+
+=cut
+
+##############################
+# Check load status of Prima #
+##############################
+
+my $min_version = 0.13;
+my $loaded_prima = eval {
+	require PDL::Graphics::Prima;
+	return 0 if $PDL::Graphics::Prima::VERSION < $min_version;
+	require PDL::Graphics::Prima::Simple;
+	PDL::Graphics::Prima::Simple->import();
+	require Prima::Application;
+	Prima::Application->import();
+	1;
+};
+
+###########################################
+# Pull the demo pod into a data structure #
+###########################################
+
+# Pull the pod apart into the following sort of array structure
+# @demo = (
+#   'Introduction' => $first_paragraph => $first_code,
+#   'Introduction' => $second_paragraph => $second_code,
+#     ...
+#   'First steps'  => $first_paragraph => $first_code,
+#     ...
+# );
+
+my (@demo, $curr_section, $curr_par, $curr_code);
+my $curr_state = 'section_title';
+while(my $line = <DATA>) {
+	# Only =head2s in this documentation
+	last if $line =~ /=head1/;
+	if ($line =~ /^=head2 (.*)/) {
+		# Add the current section's name and an empty arrayref
+		$curr_section = $1;
+	}
+	elsif ($line =~ /^\n/) {
+		if (defined $curr_par and defined $curr_code) {
+			push @demo, $curr_section, $curr_par, $curr_code;
+			$curr_par = $curr_code = undef;
+		}
+	}
+	elsif (not defined $curr_par) {
+		$curr_par = $line;
+	}
+	elsif (not defined $curr_code and $line !~ /^\s/) {
+		$curr_par .= $line;
+	}
+	elsif ($line =~ /^\s/) {
+		# Accumulate code lines, stripping off the leading space
+		$line =~ s/^\s//;
+		$curr_code .= $line;
+	}
+}
+
+# Add some extra content for Prima viewing only
+if ($loaded_prima) {
+	unshift @demo, 'Introduction',
+'This is the demo for L<PDL::Graphics::Prima|PDL::Graphics::Prima/>. Explanatory
+text will appear here; code samples will appear below. Tip: you can modify and 
+re-run the code samples. When you are done, simply close the window.',
+'### HEY, EDIT ME! ###
+use Prima::MsgBox;
+Prima::MsgBox::message( "Hello, this is the PDL::Graphics::Prima demo.", mb::Ok);'
+}
+
+##################################
+# The command that runs the demo #
+##################################
+
+# These are widgts I will need across multiple functions, so they are globals.
+my ($section_title_label, $text_pod, $code_eval, $prev_button, $next_button,
+	$run_button, $help_window, $window, $is_evaling);
+sub run {
+	
+	# Make sure they have it. Otherwise, bail out.
+	if (not $loaded_prima) {
+		my $reason =
+"I couldn't load the library, either because it's not installed on your
+machine or it's broken.";
+		$reason = 
+"your version of PDL::Graphics::Prima (v$PDL::Graphics::Prima::VERSION) is out of date. This demo
+requires at least v$min_version." if defined $loaded_prima;
+		print <<SORRY;
+
+Thanks for trying to learn more about PDL::Graphics::Prima. Unfortunately,
+$reason
+
+If you really want to get this working, the fastest way to get help is to
+join the live chat on the PDL irc channel. If you have an IRC client, check
+out
+
+  irc.perl.org#pdl
+
+If you don't have an IRC client, you can join the discussion via mibbit:
+
+  http://www.mibbit.com/chat/?url=irc://irc.perl.org/pdl
+
+If you would rather, you can send an email to the mailing list:
+
+  http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
+
+For more information about PDL::Graphics::Prima, check out
+
+  http://p3rl.org/PDL::Graphics::Prima.
+
+
+Thanks, and keep trying! I promise it's worth it.
+
+SORRY
+		return;
+	}
+	
+	# Note that by the time we reach here, $::application is defined.
+	require Prima::Label;
+	require Prima::PodView;
+	require Prima::Buttons;
+	require Prima::Utils;
+	require Prima::Edit;
+	
+	my $current_slide = 0;
+	
+	# ---( Build the Demo Window )--- #
+	
+																	# Window
+	$window = Prima::Window->create(
+		place => {
+			relx => 0.15, relwidth => 0.7, relheight => 0.7, rely => 0.15,
+			anchor => 'sw',
+		},
+		sizeMax => [600, 800],
+		sizeMin => [600, 800],
+		text => 'PDL::Graphics::Prima Demo',
+		onDestroy => sub {
+			require Prima::Utils;
+			# Throw an exception after destruction is complete so that we
+			# break out of the $::application->go loop.
+			Prima::Utils::post(sub { die 'time to exit the event loop' });
+		},
+		onKeyUp => \&keypress_handler,
+	);
+	$window->font->size(12);
+																		# Title
+	# ---( Build list of windows that we don't want to close )---
+	my @dont_touch = $::application->get_widgets;
+	
+	my $title_height = 50;
+	$section_title_label = $window->insert(Label =>
+		place => {
+			x => 0, relwidth => 1, anchor => 'sw',
+			y => -$title_height, rely => 1, height => $title_height,
+		},
+		text => '',
+		height => $title_height,
+		alignment => ta::Center(),
+		valignment => ta::Center(),
+		backColor => cl::White(),
+		font => {
+			size => 24,
+		},
+		onKeyUp => \&keypress_handler,
+	);
+																	# Buttons
+	my $button_height = 35;
+	$prev_button = $window->insert(Button =>
+		place => {
+			x => 0, relwidth => 0.333, anchor => 'sw',
+			y => 0, height => $button_height,
+		},
+		height => $button_height,
+		text => 'Previous',
+		enabled => 0,
+		onClick => sub {
+			$current_slide-- unless $current_slide == 0;
+			setup_slide($current_slide);
+		},
+	);
+	$run_button = $window->insert(Button =>
+		place => {
+			relx => 0.333, relwidth => 0.333, anchor => 'sw',
+			y => 0, height => $button_height,
+		},
+		height => $button_height,
+		text => 'Run',
+		onClick => sub {
+			# Clear out old windows
+			for my $curr_window ($::application->get_widgets) {
+				next if grep { $curr_window == $_ } @dont_touch
+					or defined $help_window and $curr_window == $help_window;
+				$curr_window->destroy;
+			}
+			
+			# Disable the buttons
+			my $prev_state = $prev_button->enabled;
+			$prev_button->enabled(0);
+			$run_button->enabled(0);
+			my $next_state = $next_button->enabled;
+			$next_button->enabled(0);
+			
+			# Run the eval
+			eval 'no strict; no warnings; ' . $code_eval->text;
+			if ($@ and $@ !~ /time to exit the event loop/		) {
+				warn $@;
+				Prima::MsgBox::message($@);
+			}
+			
+			$prev_button->enabled($prev_state);
+			$run_button->enabled(1);
+			$next_button->enabled($next_state);
+		},
+	);
+	$next_button = $window->insert(Button =>
+		place => {
+			relx => 0.666, relwidth => 0.333, anchor => 'sw',
+			y => 0, height => $button_height,
+		},
+		height => $button_height,
+		text => 'Next',
+		onClick => sub {
+			$current_slide++ unless $current_slide == @demo/3;
+			setup_slide($current_slide);
+		},
+	);
+																	# Text
+	my $par_container = $window->insert(Widget =>
+		place => {
+			x => 0, relwidth => 1, anchor => 'sw',
+			rely => 0.6, relheight => 0.4, height => -$title_height-1,
+		},
+		backColor => cl::White(),
+	);
+	my $padding = 10;
+	$text_pod = $par_container->insert(PodView =>
+		place => {
+			x => $padding, relwidth => 1, width => -2*$padding,
+			y => $padding, relheight => 1, height => -2*$padding - 15,
+			anchor => 'sw',
+		},
+		# This Event does not appear to be documented!!! Beware!!!
+		# Modify link clicking so that it opens the help window instead
+		# of following the link.
+		onLink => sub {
+			my ($self, $link) = @_;
+			# $link is a reference to the link that should be opened; deref
+			$::application->open_help($$link);
+			# Store the help window so we can close it on exit later
+			$help_window = $::application->get_active_window;
+			# Bring the help window to the fore
+			$::application->get_active_window->bring_to_front
+				if $::application->get_active_window;
+			# Clear the event so that it doesn't follow the link in this
+			# renderer
+			$self->clear_event;
+		},
+		backColor => cl::White(),
+		borderWidth => 0,
+		autoVScroll => 1,
+		onKeyUp => \&keypress_handler,
+	);
+	
+																		# Code
+	my $code_container = $window->insert(Widget =>
+		place => {
+			x => 0, relwidth => 1, anchor => 'sw',
+			y => $button_height+1, relheight => 0.6, height => -$button_height-2,
+		},
+		backColor => cl::White(),
+	);
+	$code_eval = $code_container->insert(Edit =>
+		place => {
+			x => $padding, relwidth => 1, width => -2*$padding,
+			y => $padding, relheight => 1, height => -2*$padding,
+			anchor => 'sw',
+		},
+		borderWidth => 0,
+		backColor => cl::White(),
+		tabIndent => 4,
+		syntaxHilite => 1,
+		wantTabs => 1,
+		wantReturns => 1,
+		wordWrap => 0,
+		autoIndent => 1,
+		cursorWrap => 1,
+		font => { name => 'monospace', size => 12 },
+	);
+	
+	$window->bring_to_front;
+	setup_slide(0);
+	
+	# Run this sucker
+	local $@;
+	eval { $::application->go };
+	$help_window->close if defined $help_window and $help_window->alive;
+}
+
+sub keypress_handler {
+	my ($self, $code, $key, $mod) = @_;
+	if ($key == kb::Down() or $key == kb::Right() or $key == kb::PgDn()) {
+		$next_button->notify('Click');
+	}
+	elsif ($key == kb::Up() or $key == kb::Left() or $key == kg::PgUp()) {
+		$prev_button->notify('Click');
+	}
+	else {
+		$code_eval->notify('KeyUp', $code, $key, $mod);
+	}
+}
+
+
+#############################################################
+# Function that transitions between paragraphs and sections #
+#############################################################
+
+sub setup_slide {
+	my $number = shift;
+	if ($number == 0) {
+		$prev_button->enabled(0);
+	}
+	else {
+		$prev_button->enabled(1);
+	}
+	if ($number == @demo/3 - 1) {
+		$next_button->enabled(1);
+		$next_button->text('Finish');
+	}
+	elsif ($number == @demo/3) {
+		# Close the window
+		$window->notify('Destroy');
+		return;
+	}
+	else {
+		$next_button->enabled(1);
+		$next_button->text('Next');
+	}
+	
+	$number *= 3;
+	# Set the section title and code
+	$section_title_label->text($demo[$number]);
+	$code_eval->text($demo[$number+2]);
+	
+	# Load the pod
+	$text_pod->open_read;
+	$text_pod->read("=pod\n\n$demo[$number+1]\n\n=cut");
+	$text_pod->close_read;
+	
+	# Run the demo
+	$run_button->notify('Click');
+}
+
+# This way, it can be invoked as "perl -MPDL::Demos::Prima" or as
+# "perl path/to/Prima.pm"
+if ($0 eq '-' or $0 eq __FILE__) {
+	run;
+	exit;
+}
+
+1;
+
+__DATA__
+
+=head2 use PDL::Graphics::Prima::Simple
+
+To get started, you will want to use
+L<PDL::Graphics::Prima::Simple|PDL::Graphics::Prima::Simple/>. This
+module provides a set of friendly wrappers for simple, first-cut data
+visualization. L<PDL::Graphics::Prima|PDL::Graphics::Prima/>, the underlying
+library, is a general-purpose 2D plotting library built as a widget in the
+L<Prima GUI toolkit|Prima/>, but we don't need the full functionality for
+the purposes of this demo.
+
+ use PDL::Graphics::Prima::Simple;
+ my $x = sequence(100)/10;
+ line_plot($x, $x->sin);
+
+=head2 More than just lines!
+
+In addition to numerous ways to plot x/y data, you can also plot
+distributions and images. The best run-down of the simple plotting routines
+can be found in
+L<the Synopsis for PDL::Graphics::Prima::Simple|PDL::Graphics::Prima::Simple/SYNOPSIS>.
+
+ $distribution = grandom(100);
+ hist_plot($distribution);
+ 
+ $x = sequence(100)/10;
+ cross_plot($x, $x->sin);
+ 
+ $image = rvals(100, 100);
+ matrix_plot($image);
+
+=head2 Mouse Interaction
+
+Plots allow for
+L<mouse interaction|PDL::Graphics::Prima::Simple/"Interactive Features">,
+herein referred to as twiddling. You can resize the window, zoom with the
+scroll wheel, or click and drag the canvas around. There is also a
+right-click zoom-rectangle, and a right-click context menu.
+
+ hist_plot(grandom(100));
+ 
+ # Run this, then try using your mouse
+
+In your Perl scripts, and in the PDL shell for some operating systems and
+some versions of L<Term::ReadLine>, twiddling will cause your script to pause
+when you create a new plot. To resume your script or return execution to the
+shell, either close the window or press 'q'.
+
+ # If your PDL shell supports simultaneous
+ # input and plot interaction, running this
+ # should display both plots simultaneously:
+ 
+ $x = sequence(100)/10;
+ cross_plot($x, $x->sin);
+ line_plot($x, $x->cos);
+
+=head2 Multiple plots without blocking
+
+The blocking behavior just discussed is due to what is called autotwiddling.
+To turn this off, simply send a boolean false value to auto_twiddle. Then,
+be sure to invoke twiddling when you're done creating your plots.
+
+ auto_twiddle(0);
+ hist_plot(grandom(100));
+ matrix_plot(rvals(100, 100));
+ twiddle();
+
+Once turned off, autotwiddling will remain off until you turn it back on.
+
+ # autotwiddling still off
+ hist_plot(grandom(100));
+ matrix_plot(rvals(100, 100));
+ twiddle();
+
+=head2 Adding a title and axis labels
+
+Functions like 
+L<hist_plot|PDL::Graphics::Prima::Simple/hist_plot>,
+L<cross_plot|PDL::Graphics::Prima::Simple/cross_plot>, and
+L<matrix_plot|PDL::Graphics::Prima::Simple/matrix_plot> actually create and
+return plot objects which you can subsequently modify. For example,
+adding a title and axis labels are pretty easy. For titles, you call the
+L<title method on the plot object|PDL::Graphics::Prima/title>. For axis
+labels, you call the
+L<label method on the axis objects|PDL::Graphics::Prima::Axis/label>.
+
+ # Make sure autotwiddling is off in your script
+ auto_twiddle(0);
+ 
+ # Build the plot
+ my $x = sequence(100)/10;
+ my $plot = line_plot($x, $x->sin);
+ 
+ # Add the title and labels
+ $plot->title('Harmonic Oscillator');
+ $plot->x->label('Time [s]');
+ $plot->y->label('Displacement [cm]');
+ 
+ # Manually twiddle once everything is finished
+ twiddle();
+
+=head2 Saving to a file
+
+L<PDL::Graphics::Prima::Simple> excels at user interaction, but you can save
+your plots to a file using L<save_to_file|PDL::Graphics::Prima/save_to_file>
+or L<save_to_postscript|PDL::Graphics::Prima/save_to_postscript> methods, or
+by right-clicking and selecting the appropriate menu option.
+
+ auto_twiddle(0);
+ $x = sequence(100)/10;
+ line_plot($x, $x->sin)->save_to_postscript;
+ 
+ # You can supply a filename to the method if you like.
+ # Also available is save_to_file, which saves to raster
+ # file formats. Expect save_to_postscript to be merged
+ # into save_to_file in the future.
+
+=head2 Adding additional data to the plot
+
+Once you have created a plot, you can
+L<add additional data to it|PDL::Graphics::Prima/dataSets>. You
+achieve this by adding a new
+L<DataSet|PDL::Graphics::Prima::DataSet> with the data you want displayed.
+
+ auto_twiddle(0);
+ my $plot = hist_plot(grandom(100));
+ 
+ # Add a Gaussian curve that "fits" the data
+ use PDL::Constants qw(PI);
+ my $fit_xs = zeroes(100)->xlinvals(-2, 2);
+ my $fit_ys = exp(-$fit_xs**2 / 2) / sqrt(2*PI);
+ $plot->dataSets->{fit_curve} = ds::Pair($fit_xs, $fit_ys);
+ 
+ twiddle();
+
+The default L<plot type|PDL::Graphics::Prima::PlotType/> for
+L<pairwise data|PDL::Graphics::Prima::DataSet/Pair> is
+L<Diamonds|PDL::Graphics::Prima::PlotType/ppair::Diamonds>. You can choose a
+L<different pairwise plot type|PDL::Graphics::Prima::PlotType/Pairs>, or
+even mix and match L<multiple pairwise plot types|PDL::Graphics::Prima::PlotType/SYNOPSIS>.
+
+ auto_twiddle(0);
+ my $plot = hist_plot(grandom(100));
+ 
+ # Add a Gaussian curve that "fits" the data
+ use PDL::Constants qw(PI);
+ my $fit_xs = zeroes(200)->xlinvals(-5, 5);
+ my $fit_ys = exp(-$fit_xs**2 / 2) / sqrt(2*PI);
+ $plot->dataSets->{fit_curve} = ds::Pair($fit_xs, $fit_ys,
+     # Use lines
+     plotTypes => [
+         ppair::Lines(
+             # with a thickness of three pixels
+             lineWidth => 3,
+             # And the color red
+             color => cl::LightRed,
+         ),
+         ppair::Diamonds,
+     ],
+ );
+ 
+ twiddle();
+
+=head2 The plot command
+
+If you want to specify everything in one command, you can use the plot
+function. This lets you put everything together that we've already discussed,
+including multiple DataSets in a single command, title specification, and
+x and y axis options.
+
+ # Generate some data:
+ my $xs = sequence(100)/10 + 0.1;
+ my $ys = $xs->sin + $xs->grandom / 10;
+ my $y_err = $ys->grandom/10;
+ 
+ # Plot the data and the fit
+ plot(
+     -data => ds::Pair($xs, $ys,
+         plotTypes => [
+             ppair::Triangles(filled => 1),
+             ppair::ErrorBars(y_err => $y_err),
+         ],
+     ),
+     -fit  => ds::Func(\&PDL::sin,
+         lineWidth => 3,
+         color => cl::LightRed,
+     ),
+     -note => ds::Note(
+         pnote::Text('Incoming Signal',
+             x => 0.2,
+             y => sin(0.2) . '-3em',
+         ),
+     ),
+     title => 'Noisey Sine Wave',
+     x => {
+         label => 'Time [s]',
+         scaling => sc::Log,
+     },
+     y => { label => 'Measurement [Amp]' },
+ );
+
+=head2 Enjoy PDL::Graphics::Prima!
+
+I hope you've enjoyed the tour, and I hope you find
+L<PDL::Graphics::Prima|PDL::Graphics::Prima/> to be a useful plotting tool!
+
+ # Thanks!
+
+=head1 AUTHOR
+
+David Mertens C<dcmertens.perl@gmail.com>
+
+=head1 LICENSE AND COPYRIGHT
+
+Copyright (c) 2013, David Mertens. All righs reserved.
+
+This module is free software; you can redistribute it and/or modify it under the
+same terms as Perl itself. See L<perlartistic>.
+
+=cut
@@ -39,11 +39,12 @@ use vars qw(@ISA @EXPORT);
 @EXPORT = qw( apropos aproposover usage help sig badinfo whatis );
 
 use PDL::Doc;
+use Pod::Select;
 use IO::File;
 use Pod::PlainText;
 
 $PDL::onlinedoc = undef;
-$PDL::onlinedoc = new PDL::Doc (FindStdFile());
+$PDL::onlinedoc = PDL::Doc->new(FindStdFile());
 
 use PDL::Config;
 my $bvalflag = $PDL::Config{WITH_BADVAL} || 0;
@@ -266,7 +267,7 @@ sub finddoc  {
        } else {
           if(defined $m->[1]{CustomFile}) {
 
-             my $parser= new PDL::Pod::Parser;
+             my $parser= Pod::Select->new;
              print $out "=head1 Autoload file \"".$m->[1]{CustomFile}."\"\n\n";
              $parser->parse_from_file($m->[1]{CustomFile},$out);
              print $out "\n\n=head2 Docs from\n\n".$m->[1]{CustomFile}."\n\n";
@@ -1,41 +1,11 @@
-# the following two packages can be used to collect podparser
-# output into a string or simulate a portable null device
-
-package StrHandle;
-
-sub new {
-  my $type = shift;
-  my $this = bless {},$type;
-  $this->{Text} = "";
-  return $this;
-}
-
-sub print {
-  my $this = shift;
-  $this->{Text} .= "@_";
-}
-
-sub text {
-  $_[0]->{Text} .= $_[1] if $#_ > 0;
-  return $_[0]->{Text};
-}
-
-
-package NullHandle;
-
-@ISA = qw/ StrHandle/;
-
-sub print {} # do nothing
-
-
 # the filter for the PDL pod format (which is a valid general perl
 # pod format but with special interpretation of some =for directives)
 
 package PDL::PodParser;
 use PDL::Core '';
-use PDL::Pod::Parser;
+use Pod::Select;
 
-@ISA = qw(PDL::Pod::Parser);
+@ISA = qw(Pod::Select);
 
 %Title = ('Example' => 'Example',
 	  'Ref'     => 'Reference',
@@ -45,9 +15,13 @@ use PDL::Pod::Parser;
           'Bad'     => 'Bad value support',  
 	 );
 
+
+
 sub new {
-  my ($type) = @_;
-  my $parser = new PDL::Pod::Parser;
+  my $class = shift;
+  my $parser = $class->SUPER::new(@_);
+  bless $parser,$class; # just in case
+
   $parser->select("METHODS|OPERATORS|CONTRUCTORS|FUNCTIONS|NAME");
   $parser->{CURFUNC} = undef;
   $parser->{SYMHASH} = {};
@@ -55,12 +29,11 @@ sub new {
   $parser->{Mode} = "";
   $parser->{verbose} = 0;
   $parser->{NAME} = 'UNKNOWN';
-  bless $parser,$type;
   return $parser;
 }
 
 sub command {
-  my ($this,$cmd,$txt,$sep) = @_;
+  my ($this,$cmd,$txt,$line_num,$pod_para) = @_;
   $this->{Parmode} = 'Body';
 
   if ($cmd eq 'head1') {
@@ -68,7 +41,7 @@ sub command {
     $this->{Parmode} = 'Body';
     $this->{Parmode} = 'NAME' if $txt =~ /NAME/;
   } elsif ($this->{Mode} =~ /NAME/) {
-    last;
+    # do nothing (was 'last' but that was probably a mistake)
   } elsif ($cmd eq 'head2') {
     # A function can have multiple names (ex: zeros and zeroes),
     # so split at the commas
@@ -94,14 +67,14 @@ sub command {
     print "\n\tSignature: $sig\n" if defined $sig && $this->{verbose};
     $this->{CURFUNC} = $name;
   } elsif ($cmd eq 'for') {
-    $this->check_for_mode($txt,$sep) if $cmd eq 'for';
+    $this->check_for_mode($txt,$pod_para) if $cmd eq 'for';
   }
   local $this->{Parmode} = 'Body';
-  $this->SUPER::command($cmd,$txt,$sep);
+  $this->SUPER::command($cmd,$txt,$line_num,$pod_para);
 }
 
 sub check_for_mode {
-  my ($this,$txt,$sep) = @_;
+  my ($this,$txt,$pod_para) = @_;
   if ($txt =~ /^(sig|example|ref|opt|usage|bad|body)/i) {
     $this->{Parmode} = ucfirst lc $1;
     print "switched now to '$1' mode\n" if $this->{VERBOSE};
@@ -111,10 +84,11 @@ sub check_for_mode {
 }
 
 sub textblock {
-  my ($this,$txt) = @_;
+  my $this = shift;
+  my $txt = shift;
   $this->checkmode($txt);
   local $this->{INBLOCK} = 1;
-  $this->SUPER::textblock($txt);
+  $this->SUPER::textblock($txt,@_);
   $this->{Parmode} = 'Body'; # and reset parmode
 }
 
@@ -141,9 +115,10 @@ sub checkmode {
 }
 
 sub verbatim {
-  my ($this,$txt) = @_;
+  my $this = shift;
+  my $txt = shift;
   $this->checkmode($txt,1);
-  $this->SUPER::verbatim($txt);
+  $this->SUPER::verbatim($txt,@_);
 }
 
 # this needs improvement
@@ -185,6 +160,22 @@ PDL::Doc - support for PDL online documentation
 
 An implementation of online docs for PDL.
 
+=head1 Using PDL documentation
+
+PDL::Doc's main use is in the "help" (synonym "?") and "apropos"
+(synonym "??") commands in the perldl shell.  PDL:Doc provides the
+infrastrucure to index and access PDL's documentation through these
+commands.  There is also an API for direct access to the documentation 
+database (see below).
+
+The PDL doc system is built on Perl's pod (Plain Old Documentation),
+included inline with each module. The PDL core modules are
+automatically indexed when PDL is built and installed, and there is
+provision for indexing external modules as well.
+
+To include your module's pod into the Perl::Doc index, you should
+follow the documentation conventions below.  
+
 =head1 PDL documentation conventions
 
 For a package like PDL that has I<a lot> of functions it
@@ -215,18 +206,6 @@ Individual functions or methods in these section are introduced by
 
   =head2 funcname
 
-=cut
-
-# XXX - I don't think this is going to work for now -
-# it garbles Pod::Parser. I am changing all occurences
-# to use =for sig for now - KGB
-
-#or
-#  =head2 funcname(signature)
-
-
-=pod
-
 where signature is the argumentlist for a PP defined function as
 explained in L<PDL::PP>. Generally, PDL documentation is in valid POD
 format (see L<perlpod|perlpod>) but uses the C<=for> directive in a
@@ -234,13 +213,6 @@ special way. The C<=for> directive is used to flag to the PDL Pod
 parser that information is following that will be used to generate
 online help.
 
-The PDL podparser is derived from the PDL::Pod::Parser class that had
-to be patched in a few places, partly to fix minor bugs, partly
-to enhance functionality for perusal by PDL::Doc. Since the PDL::Doc
-module is still experimental the patched Pod-Parser distribution is
-included with the current PDL-Doc distribution. Note that PDL::Doc
-will I<not> work correctly with the released Pod-Parser distribution.
-
 The PDL Pod parser recognises the following C<=for> directives:
 
 =over 5
@@ -301,9 +273,10 @@ gives examples of typical usage for the current function:
 =item Bad
 
 provides information on how the function handles bad values (if
-C<$PDL:Config{WITH_BADVAL}> is set to 1). The intention is to
-have this information automatically created for pp-compiled
-functions, although it can be over-ridden.
+C<$PDL:Config{WITH_BADVAL}> is set to 1). The documentation under
+this directive should indicate if this function accepts piddles
+with bad values and under what circumstances this function might
+return piddles with bad values.
 
 =back
 
@@ -518,6 +491,7 @@ sub savedb {
   open OUT, ">$this->{Outfile}" or barf "can't write to symdb $this->{Outfile}";
   binmode OUT;
   while (my ($key,$val) = each %$hash) {
+    next if 0 == scalar(%$val);
     my $txt = "$key".chr(0).join(chr(0),%$val);
     print OUT pack("S",length($txt)).$txt;
   }
@@ -584,7 +558,7 @@ that should be matched against the regex. Valid fields are
   Ref,     # the one-line reference description
   Example, # the example for this function
   Opt,     # options
-  File,    # the path to the source file this docs have been extracted from
+  File,    # the path to the source file these docs have been extracted from
 
 If you wish to have your results sorted by function name, pass a true
 value for C<$sort>.
@@ -677,7 +651,7 @@ sub scan {
   my $infile =  new IO::File $file;
   # XXXX convert to absolute path
   # my $outfile = '/tmp/'.basename($file).'.pod';
-  my $outfile = new NullHandle;
+  open my $outfile, '>', \(my $outfile_text);
 
   # Handle RPM etc. case where we are building away from the final
   # location. Alright it's a hack - KGB
@@ -707,15 +681,15 @@ sub scan {
   # and one can now find modules with 'apropos'
 
   $infile =  new IO::File $file;
-  $outfile = new StrHandle;
+  $outfile_text = '';
   $parser = new PDL::PodParser;
   $parser->select('NAME');
   $parser->parse_from_filehandle($infile,$outfile);
-  my @namelines = split("\n",$outfile->{Text});
+  my @namelines = split("\n",$outfile_text);
   my ($name,$does);
   for (@namelines) {
-     if (/^(PDL) (-) (.*)/ or /\s*(PDL::[\w:]*)\s*(-*)?\s*(.*)\s*$/) {
-       $name = $1; $does = $3;
+     if (/^(PDL) (-) (.*)/ or  /^\s*(Inline::Pdlpp)\s*(-*)?\s*(.*)\s*$/ or /\s*(PDL::[\w:]*)\s*(-*)?\s*(.*)\s*$/) {
+	$name = $1; $does = $3;
      }
      if (/^\s*([a-z][a-z0-9]*) (-+) (.*)/) { # lowercase shell script name
        $name = $1; $does = $3;
@@ -798,14 +772,14 @@ sub funcdocs_fromfile {
 
 sub extrdoc {
   my ($func,$file) = @_;
-  my $out = new StrHandle;
+  open my $out, '>', \(my $out_text);
   funcdocs_fromfile($func,$file,$out);
-  return $out->text;
+  return $out_text;
 }
 
 sub getfuncdocs {
   my ($func,$in,$out) = @_;
-  my $parser = new PDL::Pod::Parser;
+  my $parser = Pod::Select->new;
 #  $parser->select("\\(METHODS\\|OPERATORS\\|CONSTRUCTORS\\|FUNCTIONS\\|METHODS\\)/$func(\\(.*\\)*\\s*");
   foreach my $foo(qw/FUNCTIONS OPERATORS CONSTRUCTORS METHODS/) {
       seek $in,0,0;
@@ -814,6 +788,73 @@ sub getfuncdocs {
   }
 }
 
+
+=head2 add_module
+
+=for usage
+
+ use PDL::Doc; PDL::Doc::add_module("my::module");
+
+=for ref
+
+The C<add_module> function allows you to add POD from a particular Perl
+module that you've installed somewhere in @INC.  It searches for the
+active PDL document database and the module's .pod and .pm files, and
+scans and indexes the module into the database.
+
+C<add_module> is meant to be added to your module's Makefile as part of the
+installation script.
+
+=cut
+
+package PDL::Doc;
+sub add_module {
+    my($module) = shift;
+
+    use File::Copy qw{copy};
+
+    my($dir, $file, $pdldoc);
+    local($_);
+
+  DIRECTORY:
+    for(@INC){
+	$dir = $_;
+	$file = $dir."/PDL/pdldoc.db";
+	if( -f $file) {
+	    if(! -w "$dir/PDL") {
+		die "No write permission at $dir/PDL - not updating docs database.\n";
+	    }
+
+	    print "Found docs database $file\n";
+	    $pdldoc = new ("PDL::Doc",($file));
+	    last DIRECTORY;
+	}
+    }
+
+    die "Unable to find docs database - therefore not updating it.\n" unless($pdldoc);
+
+    my $mfile = $module;
+    $mfile =~ s/\:\:/\//g;
+    for(@INC){
+	my $postfix;
+	my $hit = 0;
+	for $postfix(".pm",".pod") {
+	    my $f = "$_/$mfile$postfix";
+	    if( -e $f ){
+		$pdldoc->ensuredb();
+		$pdldoc->scan($f);
+		eval { $pdldoc->savedb(); };
+		warn $@ if $@;
+		print "PDL docs database updated - added $f.\n";
+		$hit = 1;
+	    }
+	}
+	return if($hit);
+    }
+    
+    die "Unable to find a .pm or .pod file in \@INC for module $module\n";
+}
+
 1;
 
 =head1 PDL::DOC EXAMPLE
@@ -839,7 +880,7 @@ own code.
  print $pdldoc->gethash->{zeroes}->{Ref};
  
  # See which examples use zeroes
- $pdldoc->search('zeroes', 'Examples', 1);
+ $pdldoc->search('zeroes', 'Example', 1);
  
  # All the functions that use zeroes in their example:
  my @entries = $pdldoc->search('zeroes', 'Example', 1);
@@ -23,4 +23,5 @@ WriteMakefile(
 # map {s/[.]PL$//; m/^Makefile$/ ?
 #					  () : $_}
 #			<*.PL>, <Doc/*.PL> },
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
@@ -1,17 +0,0 @@
-# Makefile.PL -- Makefile template for PodParser.
-#
-# This file is part of "PodParser". PodParser is free software;
-# you can redistribute it and/or modify it under the same terms
-# as Perl itself.
-
-use ExtUtils::MakeMaker;
-
-WriteMakefile(
-    NAME         => "PDL::Pod::Parser",
-    VERSION_FROM => "Parser.pm",
-    INSTALLSCRIPT => '$(INST_LIBDIR)/PDL/',
-    PM     => {
-	 map {$_ => '$(INST_LIBDIR)/'.$_}
-	 	<*.pm>
-	},
-);
@@ -1,1112 +0,0 @@
-#############################################################################
-# Parser.pm -- package which defines a base class for parsing pod docs.
-#
-# Based on Tom Christiansen's Pod::Text module
-# (with extensive modifications).
-#
-# Copyright (C) 1996 Tom Christiansen. All rights reserved.
-# This file is part of "PodParser". PodParser is free software;
-# you can redistribute it and/or modify it under the same terms
-# as Perl itself.
-#############################################################################
-
-package PDL::Pod::Parser;
-
-$VERSION = 1.00;   ## Current version of this package
-require  5.002;    ## requires Perl version 5.002 or later
-
-=head1 NAME
-
-PDL::Pod::Parser - base class for creating pod filters and translators
-
-=head1 SYNOPSIS
-
-    use PDL::Pod::Parser;
-    package PDL::MyParser;
-    @ISA = qw(PDL::Pod::Parser);
-
-    sub new {
-        ## constructor code ...
-    }
-
-    ## implementation of appropriate subclass methods ...
-
-    package main;
-    $parser = new PDL::MyParser;
-    @ARGV = ('-')  unless (@ARGV > 0);
-    for (@ARGV) {
-        $parser->parse_from_file($_);
-    }
-
-=head1 DESCRIPTION
-
-B<PDL::Pod::Parser> is an abstract base class for implementing filters and/or
-translators to parse pod documentation into other formats. It handles
-most of the difficulty of parsing the pod sections in a file and leaves
-it to the subclasses to override various methods to provide the actual
-translation. The other thing that B<PDL::Pod::Parser> provides is the ability
-to process only selected sections of pod documentation from the input.
-
-=head2 SECTION SPECIFICATIONS
-
-Certain methods and functions provided by B<PDL::Pod::Parser> may be given
-one or more "section specifications" to restrict the text processed to
-only the desired set of sections and their corresponding subsections.  A
-section specification is a string containing one or more Perl-style
-regular expressions separated by forward slashes ("/").  If you need to
-use a forward slash literally within a section title you can escape it
-with a backslash ("\/").
-
-The formal syntax of a section specification is:
-
-=over 4
-
-=item
-I<head1-title-regexp>/I<head2-title-regexp>/...
-
-=back
-
-Any omitted or empty regular expressions will default to ".*".
-Please note that each regular expression given is implicitly
-anchored by adding "^" and "$" to the beginning and end.  Also, if a
-given regular expression starts with a "!" character, then the
-expression is negated (so C<!foo> would match anything I<except>
-C<foo>).
-
-Some example section specifications follow.
-
-=over 4
-
-=item
-Match the C<NAME> and C<SYNOPSIS> sections and all of their subsections:
-
-C<NAME|SYNOPSIS>
-
-=item
-Match only the C<Question> and C<Answer> subsections of the C<DESCRIPTION>
-section:
-
-C<DESCRIPTION/Question|Answer>
-
-=item
-Match the C<Comments> subsection of I<all> sections:
-
-C</Comments>
-
-=item
-Match all subsections of C<DESCRIPTION> I<except> for C<Comments>:
-
-C<DESCRIPTION/!Comments>
-
-=item
-Match the C<DESCRIPTION> section but do I<not> match any of its subsections:
-
-C<DESCRIPTION/!.+>
-
-=item
-Match all top level sections but none of their subsections:
-
-C</!.+>
-
-=back
-
-=cut
-
-#############################################################################
-
-use strict;
-use Carp;
-
-## Maximum number of heading levels supported for '=headN' directives
-$PDL::Pod::Parser::MAX_HEAD_LEVEL = 3;
-
-##---------------------------------------------------------------------------
-
-=head1 FUNCTIONS
-
-B<PDL::Pod::Parser> provides the following functions (please note that these
-are functions and I<not> methods, they do not take an object reference
-as an implicit first parameter):
-
-=cut
-
-##---------------------------------
-## Function definitions begin here
-##---------------------------------
-
-=head2 version()
-
-Return the current version of this package.
-
-=cut
-
-sub version {
-    no strict;
-    return  $VERSION;
-}
-
-##---------------------------------------------------------------------------
-
-=head1 INSTANCE METHODS
-
-B<PDL::Pod::Parser> provides several methods, some of which should be
-overridden by subclasses.  They are as follows:
-
-=cut
-
-##-------------------------------
-## Method definitions begin here
-##-------------------------------
-
-=head2 new()
-
-This is the the constructor for the base class. You should only use it
-if you want to create an instance of a B<PDL::Pod::Parser> instead of one of
-its subclasses. The constructor for this class and all of its subclasses
-should return a blessed reference to an associative array (hash).
-
-=cut
-
-sub new {
-    my $this = shift;
-    my $class = ref($this) || $this;
-    my %params = @_;
-    my $self = {%params};
-    bless $self, $class;
-    $self->initialize();
-    return $self;
-}
-
-=head2 initialize()
-
-This method performs any necessary base class initialization.
-It takes no arguments (other than the object instance of course).
-If subclasses override this method then they I<must> be sure to
-invoke the superclass' B<initialize()> method.
-
-=cut
-
-sub initialize {
-    my $self = shift;
-    return;
-}
-
-=head2 select($section_spec1, $section_spec2, ...)
-
-This is the method that is used to select the particular sections and
-subsections of pod documentation that are to be printed and/or
-processed. If the I<first> I<argument> is the string "+", then the
-remaining section specifications are I<added> to the current list of
-selections; otherwise the given section specifications will I<replace>
-the current list of selections.
-
-Each of the C<$section_spec> arguments should be a section
-specification as described in L<"SECTION SPECIFICATIONS">.  The section
-specifications are parsed by this method and the resulting regular
-expressions are stored in the array referenced by
-C<$self-E<gt>{SELECTED}> (please see the description of this member
-variable in L<"INSTANCE DATA">).
-
-This method should I<not> normally be overridden by subclasses.
-
-=cut
-
-sub select {
-    my $self = shift;
-    my @sections = @_;
-    my $add = ($sections[0] eq "+") ? shift(@sections) : "";
-    ## reset the set of sections to use
-    unless (@sections > 0) {
-        undef $self->{SELECTED}  unless ($add);
-        return;
-    }
-    $self->{SELECTED} = []  unless ($add  &&  defined $self->{SELECTED});
-    local($_);
-    my ($spec, $errors);
-    my (@re, $i, $negated, %exprs);
-    ## Parse each spec
-    for $spec (@sections) {
-        $_ = $spec;
-        s|\\\\|\001|go;  ## handle escaped backward slashes
-        s|\\/|\002|go;   ## handle escaped forward slashes
-        ## Extract the regexps for the heading titles
-        @re = split('/', $_, $PDL::Pod::Parser::MAX_HEAD_LEVEL);
-        ## Modify the regexps as needed and check their syntax
-        for ($i = 0; $i < $PDL::Pod::Parser::MAX_HEAD_LEVEL; ++$i) {
-            $re[$i]  = '.*'  if ((! defined $re[$i]) || $re[$i] eq "");
-            $re[$i] .= '.+'  if ($re[$i] eq '!');
-            ## Put back any escape sequences we "handled"
-            $re[$i] =~ s|\001|\\\\|go;
-            $re[$i] =~ s|\002|\\/|go;
-            ## Check for negation
-            $negated = ($re[$i] =~ /^\!/o);
-            $re[$i] = $'  if ($negated);
-            ## Check regexp syntax
-            eval "/$re[$i]/";
-            if ($@) {
-                ++$errors;
-                carp "Invalid regular expression /$re[$i]/ in \"$spec\": $@\n";
-            }
-            else {
-                ## Add the forward and rear anchors (and put the negator back)
-                $re[$i] = '^' . $re[$i]  unless ($re[$i] =~ /^\^/o);
-                $re[$i] = $re[$i] . '$'  unless ($re[$i] =~ /\$$/o);
-                $re[$i] = '!' . $re[$i]  if ($negated);
-            }
-        }
-        if ($errors) {
-            carp "Ignoring section spec \"$spec\"!\n";
-        }
-        else {
-            ## Store them in our sections array
-            push(@{$self->{SELECTED}}, [ @re ]);
-        }
-    }
-}
-
-=head2 want_section($head1_title, $head2_title, ...)
-
-Returns a value of true if the given section and subsection titles match
-any of the section specifications passed to the B<select()> method (or
-if no section specifications were given). Returns a value of false
-otherwise. If C<$headN_title> is ommitted then it defaults to the current
-C<headN> section title in the input.
-
-This method should I<not> normally be overridden by subclasses.
-
-=cut
-
-sub want_section {
-    my $self = shift;
-    my (@heads) = @_;
-    ## Return true if no restrictions were explicitly specified
-    return  1  unless ((defined $self->{SELECTED})
-                       && (@{$self->{SELECTED}} > 0));
-
-    ## default any unspecified sections to the current one
-    my $i;
-    for ($i = 0; $i < $PDL::Pod::Parser::MAX_HEAD_LEVEL; ++$i) {
-        $heads[$i] = $self->{HEADINGS}->[$i]  unless (defined $heads[$i]);
-    }
-
-    ## Look for a match against the specified section expressions
-    my ($sec_spec, $regexp, $negated, $match);
-    for $sec_spec (@{$self->{SELECTED}}) {
-        $match = 1;
-        for ($i = 0; $i < $PDL::Pod::Parser::MAX_HEAD_LEVEL; ++$i) {
-            $regexp  = $sec_spec->[$i];
-            $negated = ($regexp =~ /^\!/o);
-            $regexp  = $'  if ($negated);
-            $match  &= ($negated ? ($heads[$i] !~ /${regexp}/)
-                                 : ($heads[$i] =~ /${regexp}/));
-            last unless ($match);
-        }
-        return  1  if ($match);
-    }
-    return  0;  ## no match
-}
-
-=head2 begin_input()
-
-This method is invoked by B<parse_from_filehandle()> immediately I<before>
-processing input from a filehandle. The base class implementation does
-nothing but subclasses may override it to perform any per-file
-intializations.
-
-=cut
-
-sub begin_input {
-    my $self = shift;
-    #----------------------------------------------------
-    # Subclasses may wish to make use of some of the
-    # commented-out code below for initializing pragmas
-    #----------------------------------------------------
-    # $self->{PRAGMAS} = {
-    #     FILL     => 'on',
-    #     STYLE    => 'plain',
-    #     INDENT   => 0,
-    # };
-    # ## Initialize all PREVIOUS_XXX pragma values
-    # my ($name, $value);
-    # for (($name, $value) = each %{$self->{PRAGMAS}}) {
-    #     $self->{PRAGMAS}->{"PREVIOUS_${name}"} = $value;
-    # }
-    #----------------------------------------------------
-    return;
-}
-
-=head2 end_input()
-
-This method is invoked by B<parse_from_filehandle()> immediately I<after>
-processing input from a filehandle. The base class implementation does
-nothing but subclasses may override it to perform any per-file
-cleanup actions.
-
-=cut
-
-sub end_input {
-    my $self = shift;
-    return;
-}
-
-=head2 preprocess_line($text)
-
-This methods should be overridden by subclasses that wish to perform any
-kind of preprocessing for each I<line> of input (I<before> it has been
-determined whether or not it is part of a pod paragraph). The parameter
-C<$text> is the input line and the value returned should correspond to
-the new text to use in its place. If the empty string or an undefined
-value is returned then no further process will be performed for this
-line. If desired, this method can call the B<parse_paragraph()> method
-directly with any preprocessed text and return an empty string (to
-indicate that no further processing is needed).
-
-Please note that the B<preprocess_line()> method is invoked I<before>
-the B<preprocess_paragraph()> method. After all (possibly preprocessed)
-lines in a paragraph have been assembled together and it has been
-determined that the paragraph is part of the pod documentation from one
-of the selected sections, then B<preprocess_paragraph()> is invoked.
-
-The base class implementation of this method returns the given text.
-
-=cut
-
-sub preprocess_line {
-    my $self = shift;
-    my $text = shift;
-    return  $text;
-}
-
-=head2 preprocess_paragraph($text)
-
-This method should be overridden by subclasses that wish to perform any
-kind of preprocessing for each block (paragraph) of pod documentation
-that appears in the input stream.  The parameter C<$text> is the pod
-paragraph from the input file and the value returned should correspond
-to the new text to use in its place.  If the empty string is returned or
-an undefined value is returned, then the given C<$text> is ignored (not
-processed).
-
-This method is invoked by B<parse_paragraph()>. After it returns,
-B<parse_paragraph()> examines the current cutting state (which is
-stored in C<$self-E<gt>{CUTTING}>). If it evaluates to false then input text
-(including the given C<$text>) is cut (not processed) until the next pod
-directive is encountered.
-
-Please note that the B<preprocess_line()> method is invoked I<before>
-the B<preprocess_paragraph()> method. After all (possibly preprocessed)
-lines in a paragraph have been assembled together and it has been
-determined that the paragraph is part of the pod documentation from one
-of the selected sections, then B<preprocess_paragraph()> is invoked.
-
-The base class implementation of this method returns the given text.
-
-=cut
-
-sub preprocess_paragraph {
-    my $self = shift;
-    my $text = shift;
-    return  $text;
-}
-
-=head2 parse_pragmas($cmd, $text, $sep)
-
-This method is called when an C<=pod> directive is encountered. When
-such a pod directive is seen in the input, this method is called and is
-passed the command name C<$cmd> (which should be "pod") and the
-remainder of the text paragraph C<$text> which appeared immediately
-after the command name. If desired, the text which separated the C<=pod>
-directive from its corresponding text may be found in C<$sep>.  Each
-word in C<$text> is examined to see if it is a pragma specification.
-Pragma specifications are of the form C<pragma_name=pragma_value>.
-
-Unless the given object is an instance of the B<PDL::Pod::Parser> class, the
-base class implementation of this method will invoke the B<pragma()> method for
-each pragma specification in C<$text>.  I<If and only if> the given
-object I<is> an instance of the B<PDL::Pod::Parser> class, the base class
-version of this method will simply reproduce the C<=pod> command exactly
-as it appeared in the input.
-
-Derived classes should I<not> usually need to reimplement this method.
-
-=cut
-
-sub parse_pragmas {
-    my $self = shift;
-    my $cmd  = shift;
-    my $text = shift;
-    my $sep  = shift;
-    $cmd  = ''  unless (defined $cmd);
-    $text = ''  unless (defined $text);
-    $sep  = ' ' unless (defined $sep);
-    local($_);
-    if (ref($self) eq 'PDL::Pod::Parser') {
-        ## If and only if this is an instance of the base class, then
-        ## dump the '=pod' paragraph exactly as it appeared in the input.
-        $self->print("=${cmd}${sep}${text}");
-    }
-    else {
-        ## otherwise invoke the pragma command for each word in $text
-        my @pragmas = split(" ", $text);
-        for (@pragmas) {
-            $self->pragma(lc $`, $')  if (/=/o);
-        }
-    }
-}
-
-=head2 pragma($pragma_name, $pragma_value)
-
-This method is invoked for each pragma encountered inside an C<=pod>
-paragraph (see the description of the B<parse_pragmas()> method). The
-pragma name is passed in C<$pragma_name> (which should always be
-lowercase) and the corresponding value is C<$pragma_value>.
-
-The base class implementation of this method does nothing.  Derived
-class implementations of this method should be able to recognize at
-least the following pragmas and take any necessary actions when they are
-encountered:
-
-=over 4
-
-=item B<fill=value>
-
-The argument I<value> should be one of C<on>, C<off>, or C<previous>.
-Specifies that "filling-mode" should set to 1, 0, or its previous value
-(respectively). If I<value> is omitted then the default is C<on>.
-Derived classes may use this to decide whether or not to perform any
-filling (wrapping) of subsequent text.
-
-=item B<style=value>
-
-The argument I<value> should be one of C<bold>, C<italic>, C<code>,
-C<plain>, or C<previous>. Specifies that the current default paragraph
-font should be set to C<bold>, C<italic>, C<code>, the empty string C<>,
-or its previous value (respectively).  If I<value> is omitted then the
-default is C<plain>.  Derived classes may use this to determine the
-default font style to use for subsequent text.
-
-=item B<indent=value>
-
-The argument I<value> should be an integer value (with an optional
-sign).  Specifies that the current indentation level should be reset to
-the given value. If a plus (minus) sign precedes the number then the
-indentation level should be incremented (decremented) by the given
-number. If only a plus or minus sign is given (without a number) then
-the current indentation level is incremented or decremented by some
-default amount (to be determined by subclasses).
-
-=back
-
-The value returned will be 1 if the pragma name was recognized and 0 if
-it wasnt (in which case the pragma was ignored).
-
-Derived classes should override this method if they wish to implement
-any pragmas. The base class implementation of this method does nothing
-but it does contain some commented-out code which subclasses may want
-to make use of when implementing pragmas.
-
-=cut
-
-sub pragma {
-    my $self  = shift;
-    ## convert remaining args to lowercase
-    my $name  = lc shift;
-    my $value = lc shift;
-    my $rc = 1;
-    local($_);
-    #----------------------------------------------------
-    # Subclasses may wish to make use of some of the
-    # commented-out code below for processing pragmas
-    #----------------------------------------------------
-    # my ($abbrev, %abbrev_table);
-    # if ($name eq 'fill') {
-    #     %abbrev_table = ('on' => 'on',
-    #                      'of' => 'off',
-    #                      'p'  => 'previous');
-    #     $value = 'on' unless ((defined $value) && ($value ne ''));
-    #     return  $rc  unless ($value =~ /^(on|of|p)/io);
-    #     $abbrev = $1;
-    #     $value = $abbrev_table{$abbrev};
-    #     if ($value eq 'previous') {
-    #         $self->{PRAGMAS}->{FILL} = $self->{PRAGMAS}->{PREVIOUS_FILL};
-    #     }
-    #     else {
-    #         $self->{PRAGMAS}->{PREVIOUS_FILL} = $self->{PRAGMAS}->{FILL};
-    #         $self->{PRAGMAS}->{FILL} = $value;
-    #     }
-    # }
-    # elsif ($name eq 'style') {
-    #     %abbrev_table = ('b'  => 'bold',
-    #                      'i'  => 'italic',
-    #                      'c'  => 'code',
-    #                      'pl' => 'plain',
-    #                      'pr' => 'previous');
-    #     $value = 'plain' unless ((defined $value) && ($value ne ''));
-    #     return  $rc  unless ($value =~ /^(b|i|c|pl|pr)/io);
-    #     $abbrev = $1;
-    #     $value = $abbrev_table{$abbrev};
-    #     if ($value eq 'previous') {
-    #         $self->{PRAGMAS}->{STYLE} = $self->{PRAGMAS}->{PREVIOUS_STYLE};
-    #     }
-    #     else {
-    #         $self->{PRAGMAS}->{PREVIOUS_STYLE} = $self->{PRAGMAS}->{STYLE};
-    #         $self->{PRAGMAS}->{STYLE} = $value;
-    #     }
-    # }
-    # elsif ($name eq 'indent') {
-    #     return $rc unless ((defined $value) && ($value =~ /^([-+]?)(\d*)$/o));
-    #     my ($sign, $number) = ($1, $2);
-    #     $value .= "4"  unless ((defined $number) && ($number ne ''));
-    #     $self->{PRAGMAS}->{PREVIOUS_INDENT} = $self->{PRAGMAS}->{INDENT};
-    #     if ($sign) {
-    #         $self->{PRAGMAS}->{INDENT} += (0 + $value);
-    #     }
-    #     else {
-    #         $self->{PRAGMAS}->{INDENT} = $value;
-    #     }
-    # }
-    # else {
-    #     $rc = 0;
-    # }
-    #----------------------------------------------------
-    return $rc;
-}
-
-=head2 command($cmd, $text, $sep)
-
-This method should be overridden by subclasses to take the appropriate
-action when a pod command paragraph (denoted by a line beginning with
-"=") is encountered.  When such a pod directive is seen in the input,
-this method is called and is passed the command name C<$cmd> and the
-remainder of the text paragraph C<$text> which appears immediately after
-the command name. If desired, the text which separated the command from
-its corresponding text may be found in C<$sep>.  Note that this method
-is I<not> called for C<=pod> paragraphs.
-
-The base class implementation of this method simply prints the raw pod
-command to the output filehandle and then invokes the B<textblock()>
-method, passing it the C<$text> parameter.
-
-=cut
-
-sub command {
-    my $self = shift;
-    my $cmd  = shift;
-    my $text = shift;
-    my $sep  = shift;
-    $cmd  = ''  unless (defined $cmd);
-    $text = ''  unless (defined $text);
-    $sep  = ' ' unless (defined $sep);
-    $self->print("=${cmd}${sep}");
-    $self->textblock($text);
-}
-
-=head2 verbatim($text)
-
-This method may be overridden by subclasses to take the appropriate
-action when a block of verbatim text is encountered. It is passed the
-text block C<$text> as a parameter.
-
-The base class implementation of this method simply prints the textblock
-(unmodified) to the output filehandle.
-
-=cut
-
-sub verbatim {
-    my $self = shift;
-    my $text = shift;
-    $self->print($text);
-}
-
-=head2 textblock($text)
-
-This method may be overridden by subclasses to take the appropriate
-action when a normal block of pod text is encountered (although the base
-class method will usually do what you want). It is passed the text block
-C<$text> as a parameter.
-
-In order to process interior sequences, subclasses implementations of
-this method will probably want invoke the B<interpolate()> method,
-passing it the text block C<$text> as a parameter and then perform any
-desired processing upon the returned result.
-
-The base class implementation of this method simply prints the text block
-as it occurred in the input stream).
-
-=cut
-
-sub textblock {
-    my $self  = shift;
-    my $text  = shift;
-    local($_) = $self->interpolate($text);
-    $self->print($_);
-}
-
-=head2 interior_sequence($seq_cmd, $seq_arg)
-
-This method should be overridden by subclasses to take the appropriate
-action when an interior sequence is encountered. An interior sequence is
-an embedded command within a block of text which appears as a command
-name (usually a single uppercase character) followed immediately by
-a string of text which is enclosed in angle brackets. This method is
-passed the sequence command C<$seq_cmd> and the corresponding text
-$seq_arg and is invoked by the B<interpolate()> method for each
-interior sequence that occurs in the string that it is passed.
-It should return the desired text string to be used in place of
-the interior sequence.
-
-Subclass implementationss of this method may wish to examine the
-the array referenced by C<$self-E<gt>{SEQUENCES}> which is a
-stack of all the interior sequences that are currently being
-processed (they may be nested). The current interior sequence
-(the one given by C<$seq_cmdE<lt>$seq_argE<gt>>) should always
-be at the top of this stack.
-
-The base class implementation of the B<interior_sequence()> method simply
-returns the raw text of the of the interior sequence (as it occurred in
-the input) to the output filehandle.
-
-=cut
-
-sub interior_sequence {
-    my $self = shift;
-    my $seq_cmd = shift;
-    my $seq_arg = shift;
-    return  "${seq_cmd}<${seq_arg}>";
-}
-
-=head2 interpolate($text, $end_re)
-
-This method will translate all text (including any embedded interior
-sequences) in the given text string C<$text> and return the
-interpolated result.  If a second argument is given, then it is taken to
-be a regular expression that indicates when to quit interpolating the
-string.  Upon return, the C<$text> parameter will have been modified to
-contain only the un-processed portion of the given string (which will
-I<not> contain any text matched by C<$end_re>).
-
-This method should probably I<not> be overridden by subclasses.
-It should be noted that this method invokes itself recursively
-to handle any nested interior sequences.
-
-=cut
-
-sub interpolate {
-    my $self = shift;
-    my ($text, $end_re) = @_;
-    $text   = ''   unless (defined $text);
-    $end_re = '$'  unless ((defined $end_re) && ($end_re ne ''));
-    local($_)  = $text;
-    my $result = '';
-    my ($seq_cmd, $seq_arg, $end) = ('', '', undef);
-    while (($_ ne '') && /([A-Z])<|($end_re)/) {
-        $result .= $`;  ## Append text before the match to the result
-        $_ = $';        ## Only text after the match remains to be processed
-        ## See if we matched an interior sequence or an end-expression
-        ($seq_cmd, $end) = ($1, $2);
-        last if (defined $end);  ## Saw the end - quit loop here
-        ## At this point we have found an interior sequence,
-        ## we need to obtain its argument
-        push(@{$self->{SEQUENCES}}, $seq_cmd);
-        $seq_arg = $self->interpolate($_, '>');
-        ## Now process the interior sequence
-        $result .= $self->interior_sequence($seq_cmd, $seq_arg);
-        pop(@{$self->{SEQUENCES}});
-    }
-    ## Handle whatever is left if we didnt match the ending regexp
-    unless ((defined $end) && ($end_re ne '$')) {
-        $result .= $_;
-        $_ = '';
-    }
-    ## Modify the input parameter to consume the text that was
-    ## processed so far.
-    $_[0] = $_;
-    ## Return the processed-text
-    return  $result;
-}
-
-=head2 parse_paragraph($text)
-
-This method takes the text of a pod paragraph to be processed and
-invokes the appropriate method (one of B<command()>, B<verbatim()>,
-or B<textblock()>).
-
-This method does I<not> usually need to be overridden by subclasses.
-
-=cut
-
-sub parse_paragraph {
-    my $self = shift;
-    local $_ = shift;
-    my ($para);
-    my ($cmd, $arg, $sep);
-    ## Keep track of current paragraph number
-    ++$self->{PARAGRAPH}  if ((defined $_)  &&  ($_ ne ''));
-    ## Ignore up until next pod directive if we are cutting
-    if ($self->{CUTTING}) {
-        return  1  unless /^=/o;
-        $self->{CUTTING} = 0;
-    }
-    ## Keep track of current sections and their titles
-    my ($level, $title);
-    if (/^=((?:sub)*)(?:head(?:ing)?|sec(?:tion)?)(\d*)\s+(.*)\s*$/o) {
-        ## This is a section heading command
-        ($level, $title) = ($2, $3);
-        $level = 1 + (length($1) / 3)  if (($level eq '') || ($1 ne ''));
-        ## Reset the current section heading at this level
-        $self->{HEADINGS}->[$level - 1] = $title;
-        ## Reset subsection headings of this one to empty
-        my $i;
-        for ($i = $level; $i < $PDL::Pod::Parser::MAX_HEAD_LEVEL; ++$i) {
-            $self->{HEADINGS}->[$i] = '';
-        }
-    }
-    ## Ignore this block if it isnt in one of the selected sections
-    $self->{CUTTING} = 1   unless ($self->want_section());
-    return  1  if ($self->{CUTTING});
-
-    ## Perform any desired preprocessing
-    $para = $self->preprocess_paragraph($_);
-    next unless ((defined $para) && ($para ne ""));
-    $_ = $para;
-    return  1  if ($self->{CUTTING});
-
-    ## Look for one of the three types of paragraphs
-    if (s/^=//o) {
-        ## Looks like a command paragraph
-        ($cmd, $sep, $_) = /\s+/o ? ($`, $&, $') : ($_, '', '');
-        if ($cmd eq 'cut') {
-            $self->{CUTTING} = 1;
-        }
-        elsif ($cmd eq 'pod') {
-            ## This is a pod pragma paragraph
-            $self->parse_pragmas($cmd, $_, $sep);
-        }
-        else {
-            ## Some other command
-            $self->command($cmd, $_, $sep);
-        }
-    }
-    elsif (/^\s+/o) {
-        ## Indented text - must be a verbatim paragraph
-        $self->verbatim($_);
-    }
-    else {
-        ## Looks like an ordinary block of text
-        $self->textblock($_);
-    }
-    return  1;
-}
-
-=head2 parse_from_filehandle($infilehandle, $outfilehandle)
-
-This method takes a glob to a filehandle (which is assumed to already be
-opened for reading) and reads the entire input stream looking for blocks
-(paragraphs) of pod documentation to be processed. For each block of pod
-documentation encountered it will call the B<parse_paragraph()> method.
-
-If a second argument is given then it should be a filehandle glob where
-output should be sent (otherwise the default output filehandle is
-C<STDOUT>). If no first argument is given the default input filehandle
-C<STDIN> is used.
-
-The input filehandle that is currently in use is stored in the member
-variable whose key is "INPUT" (e.g. C<$self-E<gt>{INPUT}>).
-
-The output filehandle that is currently in use is stored in the member
-variable whose key is "OUTPUT" (e.g. C<$self-E<gt>{OUTPUT}>).
-
-Input is read line-by-line and assembled into paragraphs (which are
-separated by lines containing nothing but whitespace). The current line
-number is stored in the member variable whose key is "LINE" (e.g.
-C<$self-E<gt>{LINE}>) and the current paragraph number is stored in the
-member variable whose key is "PARAGRAPH" (e.g.  C<$self-E<gt>{PARAGRAPH}>).
-
-This method does I<not> usually need to be overridden by subclasses.
-
-=cut
-
-sub parse_from_filehandle {
-    my $self = shift;
-    my $infilehandle = shift;
-    my $outfilehandle = shift;
-    local($_);
-
-    $infilehandle  = \*STDIN   unless (defined $infilehandle);
-    $outfilehandle = \*STDOUT  unless (defined $outfilehandle);
-
-    ## Initialize stuff for this input stream
-    $self->{INPUT}     = $infilehandle;
-    $self->{OUTPUT}    = $outfilehandle;
-    $self->{CUTTING}   = 1;   ## Keep track of when we are cutting
-    $self->{SEQUENCES} = [];  ## Keep track of nested interior sequences
-    ## Initialize section heading titles
-    {
-        $self->{HEADINGS}   = [];
-        my $i;
-        for ($i = 0; $i < $PDL::Pod::Parser::MAX_HEAD_LEVEL; ++$i) {
-            $self->{HEADINGS}->[$i] = '';
-        }
-    }
-
-    $self->begin_input();
-
-    my $paragraph = '';
-    while (<$infilehandle>) {
-        ++$self->{LINE};  ## Keep track of current line number
-        $_ = $self->preprocess_line($_);
-        next  unless ((defined $_)  &&  ($_ ne ''));
-        if (! /^\s*$/o) {
-            ## Append this line to the current paragraph
-            $paragraph .= $_;
-            next;
-        }
-        ## This line is blank line and ends the current paragraph
-        next  if ($paragraph eq '');
-        $paragraph .= "\n";
-        $self->parse_paragraph($paragraph);
-        $paragraph = '';
-    }
-    ## Dont forget about the last paragraph in the file
-    $self->parse_paragraph($paragraph)  unless ($paragraph eq '');
-
-    $self->end_input();
-}
-
-=head2 parse_from_file($filename, $outfile)
-
-This method takes a filename and does the following:
-
-=over 4
-
-=item *
-
-opens the input and output files for reading
-(creating the appropriate filehandles)
-
-=item *
-
-invokes the B<parse_from_filehandle()> method passing it the
-corresponding input and output filehandles.
-
-=item *
-
-closes the input and output files.
-
-=back
-
-If the special input filename "-" or "<&STDIN" is given then the STDIN
-filehandle is used for input (and no open or close is performed).  If no
-input filename is specified then "-" is implied.  If a reference is
-passed instead of a filename then it is assumed to be a glob-style
-reference to a filehandle.
-
-
-If a second argument is given then it should be the name of the desired
-output file.  If the special output filename "-" or ">&STDOUT" is given
-then the STDOUT filehandle is used for output (and no open or close is
-performed). If the special output filename ">&STDERR" is given then the
-STDERR filehandle is used for output (and no open or close is
-performed).  If no output filename is specified then "-" is implied.
-If a reference is passed instead of a filename then it is assumed to
-be a glob-style reference to a filehandle.
-
-The name of the input file that is currently being read is stored in the
-member variable whose key is "INFILE" (e.g. C<$self-E<gt>{INFILE}>).
-
-The name of the output file that is currently being written is stored in
-the member variable whose key is "OUTFILE" (e.g.  C<$self-E<gt>{OUTFILE}>).
-
-This method does I<not> usually need to be overridden by subclasses.
-
-=cut
-
-sub parse_from_file {
-    my $self = shift;
-    my $infile = shift;
-    my $outfile = shift;
-    my ($in_fh,  $in_fh_name)  = (undef, undef);
-    my ($out_fh, $out_fh_name) = (undef, undef);
-
-    $infile  = '-'  unless ((defined $infile)  && ($infile ne ''));
-    $outfile = '-'  unless ((defined $outfile) && ($outfile ne ''));
-
-    if (($infile  eq '-') || ($infile =~ /^<&(STDIN|0)$/o)) {
-        $in_fh = \*STDIN;
-        $self->{INFILE} = "<standard input>";
-    }
-    elsif (ref $infile) {
-        $in_fh = $infile;
-        $self->{INFILE} = ${$infile};;
-    }
-    else {
-        $self->{INFILE} = $in_fh_name = $infile;
-        $in_fh_name =~ s/\W/_/g;
-        no strict "refs";
-        open($in_fh_name, "<$infile") ||
-             croak "Can't open $infile for reading: $!\n";
-        $in_fh = \*$in_fh_name;
-    }
-
-    if (($outfile  eq '-') || ($outfile =~ /^>&?(STDOUT|1)$/o)) {
-        $out_fh  = \*STDOUT;
-        $self->{OUTFILE} = "<standard output>";
-    }
-    elsif ($outfile =~ /^>&(STDERR|2)$/o) {
-        $out_fh  = \*STDERR;
-        $self->{OUTFILE} = "<standard error>";
-    }
-    elsif (ref $outfile) {
-        $out_fh = $outfile;
-        $self->{OUTFILE} = ${$outfile};;
-    }
-    else {
-        $self->{OUTFILE} = $out_fh_name = $outfile;
-        $out_fh_name =~ s/\W/_/g;
-        no strict "refs";
-        open($out_fh_name, ">$outfile") ||
-             croak "Can't open $outfile for writing: $!\n";
-        $out_fh = \*$out_fh_name;
-    }
-
-    $self->parse_from_filehandle($in_fh, $out_fh);
-
-    if (defined $in_fh_name) {
-        close($in_fh) || croak "Can't close $infile after reading: $!\n";
-    }
-    if (defined $out_fh_name) {
-        close($out_fh) || croak "Can't close $outfile after writing: $!\n";
-    }
-}
-
-sub print {
-  my $self = shift;
-  if (ref($self->{OUTPUT}) eq 'GLOB') {
-    my $out_fh = $self->{OUTPUT};
-    print $out_fh @_;
-  } else {
-    $self->{OUTPUT}->print(@_);
-  }
-}
-
-##---------------------------------------------------------------------------
-
-=head1  INSTANCE DATA
-
-B<PDL::Pod::Parser> uses the following data members for each of its
-instances (where C<$self> is a reference to such an instance):
-
-=head2 $self->{INPUT}
-
-The current input filehandle.
-
-=head2 $self->{OUTPUT}
-
-The current output filehandle.
-
-=head2 $self->{INFILE}
-
-The name of the current input file.
-
-=head2 $self->{OUTFILE}
-
-The name of the current output file.
-
-=head2 $self->{LINE}
-
-The current line number from the input stream.
-
-=head2 $self->{PARAGRAPH}
-
-The current paragraph number from the input stream (which includes input
-paragraphs that are I<not> part of the pod documentation).
-
-=head2 $self->{HEADINGS}
-
-A reference to an array of the current section heading titles for each
-heading level (note that the first heading level title is at index 0).
-
-=head2 $self->{SELECTED}
-
-A reference to an array of references to arrays. Each subarray is a list
-of anchored regular expressions (preceded by a "!" if the regexp is to be
-negated). The index of the expression in the subarray should correspond
-to the index of the heading title in B<$self-E<gt>{HEADINGS}> that it is
-to be matched against.
-
-=head2 $self->{CUTTING}
-
-A boolean-valued scalar which evaluates to true if text from the
-input file is currently being "cut".
-
-=head2 $self->{SEQUENCES}
-
-An array reference to the stack of interior sequence commands that are
-currently in the middle of being processed.
-
-=head1 NOTES
-
-To create a pod translator to translate pod documentation to some other
-format, you usually only need to create a subclass of B<PDL::Pod::Parser>
-which overrides the base class implementation for the following methods:
-
-=over 4
-
-=item *
-
-B<pragma()>
-
-=item *
-
-B<command()>
-
-=item *
-
-B<verbatim()>
-
-=item *
-
-B<textblock()>
-
-=item *
-
-B<interior_sequence()>
-
-=back
-
-You may also want to implement the B<begin_input()> and B<end_input()>
-methods for your subclass (to perform any needed per-file intialization
-or cleanup).
-
-If you need to perform any preprocesssing of input before it is parsed
-you may want to implement one or both of the B<preprocess_line()> and/or
-B<preprocess_paragraph()> methods.
-
-Also, don't forget to make sure your subclass constructor invokes the
-base class' B<initialize()> method.
-
-Sometimes it may be necessary to make more than one pass over the input
-files. This isn't a problem as long as none of the input files correspond
-to C<STDIN>. You can override either the B<parse_from_filehandle()>
-method or the B<parse_from_file()> method to make the first pass yourself
-to collect all the information you need and then invoke the base class
-method to do the rest of the standard processing.
-
-Feel free to add any member data fields you need to keep track of things
-like current font, indentation, horizontal or vertical position, or
-whatever else you like.
-
-For the most part, the B<PDL::Pod::Parser> base class should be able to
-do most of the input parsing for you and leave you free to worry about
-how to intepret the commands and translate the result.
-
-=head1 AUTHOR
-
-Brad Appleton E<lt>Brad_Appleton-GBDA001@email.mot.comE<gt>
-
-Based on code for B<Pod::Text> written by
-Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
-
-=cut
-
-1;
@@ -1,206 +0,0 @@
-
- WHAT IS THIS?
- =============
- This software distribution contains the following packages for using
- Perl5 "pod" (Plain Old Documentation).  See the "perlpod" and "perlsyn"
- manual pages from your Perl5 distribution for more information about pod.
-
- PodParser
- ---------
-   The Perl5 module "Pod::Parser" which provides a base class for
-   parsing and selecting sections of pod documentation from an input
-   stream.  Please see the pod documentation for this module (embedded
-   in the file "Parser.pm") for more details.
-
- PodSelect
- ---------
-   The Perl5 module "Pod::Select" which provides a function to dump
-   selected sections of raw pod documentation from an input stream.
-   Please see the pod documentation for this module and Pod::Parser for
-   more details (embedded in the file "Select.pm").
-
- PodText
- -------
-   A replacement for the Perl5 module "Pod::Text" and the corresponding
-   "pod2text()" function. It is derived from the Pod::Parser class.
-   Please see the pod documentation for this module and Pod::Parser for
-   more details (embedded in the file "Text.pm").
-
- PodUsage
- --------
-   The Perl5 module "Pod::Usage" which provides the function "pod2usage()"
-   to print usage messages for a Perl script based on its embedded pod
-   documentation.  Please see the pod documentation for this module
-   (embedded in the file "Usage.pm") for more details. The pod2usage()
-   function is probably the most generally useful function in this entire
-   distribution since it is useful just about any Perl5 script that is
-   invoked from the command-line.
-
-
- AUTHORS/CONTRIBUTORS
- ====================
- Brad Appleton  <Brad_Appleton-GBDA001@email.mot.com>
- (derived from Pod::Text by Tom Christiansen <tchrist@mox.perl.com>)
-
-
- ACKNOWLEDGEMENTS
- ================
- Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126) for his
- extensive assistance with the design and interface of Pod::Parser.
-
-  * Kenneth is currently working on a "Pod::Simplify" module (among
-    other things) which is presently available on CPAN although it is
-    not yet completed.  Pod::Simplify (formerly "Pod::Parse") is loaded
-    with *lots* of goodies for formatting and translation heuristics for
-    converting pod docs into other documentation formats.  If it seems
-    feasible, Kenneth and Brad will try to have Pod::Simplify be a
-    subclass of Pod::Parser when it is completed.
-
-
- COPY/REUSE POLICY
- =================
- Copyright (C) 1996 Tom Christiansen. All rights reserved.
-
- PodParser is free software; you can redistribute it and/or modify it
- under the terms of the Artistic License distributed with Perl version
- 5.000 or (at your option) any later version. Please refer to the
- Artistic License that came with your Perl distribution for more
- details.
-
- The Artistic License should have been included in your distribution of
- Perl. It resides in the file named "Artistic" at the top-level of the
- Perl source tree (where Perl was downloaded/unpacked -- ask your
- system administrator if you dont know where this is).  Alternatively,
- the current version of the Artistic License distributed with Perl can
- be viewed on-line on the World-Wide Web (WWW) from the following URL:
-
-      http://www.perl.com/perl/misc/Artistic.html
-
- The latest version of Perl can be obtained on the World-Wide web (WWW)
- from the following URL:
-
-      http://www.perl.com/CPAN/src/latest.tar.gz
-
-
- DISCLAIMER
- ===========
- This software is distributed in the hope that it will be useful, but
- is provided "AS IS" WITHOUT WARRANTY OF ANY KIND, either expressed or
- implied, INCLUDING, without limitation, the implied warranties of
- MERCHANTABILITY and FITNESS FOR A PARTICULAR PURPOSE.
-
- The ENTIRE RISK as to the quality and performance of the software
- IS WITH YOU (the holder of the software).  Should the software prove
- defective, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
- CORRECTION.
-
- IN NO EVENT WILL ANY COPYRIGHT HOLDER OR ANY OTHER PARTY WHO MAY CREATE,
- MODIFY, OR DISTRIBUTE THE SOFTWARE BE LIABLE OR RESPONSIBLE TO YOU OR TO
- ANY OTHER ENTITY FOR ANY KIND OF DAMAGES (no matter how awful - not even
- if they arise from known or unknown flaws in the software).
-
- Please refer to the Artistic License that came with your Perl
- distribution for more details.
-
-
- CONTENTS
- ========
- README       -- This file
- Makefile.PL  -- Perl Makefile template
- Parser.pm    -- The Pod::Parser module source
- Select.pm    -- The Pod::Select module source
- Text.pm      -- The Pod::Text module source
- Usage.pm     -- The Pod::Usage module source
- podselect.PL -- Script to print selected sections of pod docs in raw pod
-                 format (a command-line interface to podselect()).
- pod2usage.PL -- Script to print usage from a file's embeded pod docs
-                 (a command-line interface to pod2usage()).
-
- *PLEASE* *NOTE* that no pod2text.PL replacement script is provided since
- the original pod2text.PL provided with Perl5 will continue to work with
- this new version of Pod::Text.
-
-
- REQUIREMENTS
- ============
- * Perl version 5.002 or later
-
- * Getopt::Long version 2.13 or later (podselect.PL and pod2usage.PL only)
-
-
- BUILDING & INSTALLING
- =====================
- Please see the perl "ExtUtils::MakeMaker" manpage for how to build and
- install using the Makefile.PL template.  In a nutshell, simply typing:
-
-      perl Makefile.PL
-
- should build a Makefile with the usual targets like "all", "clean",
- "test", and "install".
-
-
- BUGS
- ====
- Please send all bug reports to Brad Appleton
- <Brad_Appleton-GBDA001@email.mot.com>.
-
-
- TO DO
- =====
- * Try and get pod2html and pod2man and the other pod2xxx translators to
-   use Pod::Parser (so they will all use the same uniform and consistent
-   pod parsing engine).
-
- * Document "=pod" pragmas in the perlpod manpage and implement them for
-   Pod::Text, Pod::HTML, etc. ... (or maybe the order of those two should
-   be reversed).
-
- * When and if pod syntax provides some type of file inclusion mechanism
-   (like '=include' perhaps) then Pod::Parser will need to perform it,
-   and will also need instance data to provide a stack of the current
-   filehandles, filenames, line numbers, and paragraph numbers of all
-   files that are in the middle of being processed.
-
- * Make changes necessary to accomodate Kenneth Albanowski's Pod::Simplify
-   module so that it may be a subclass of Pod::Parser.
-
- * See about providing the ability (perhaps via constructor options) to turn
-   off certain unwanted Pod::Parser features in order to improve performance
-   (things like calling preprocess_xxx() methods and/or some other "virtual"
-   member function calls that a subclass might not want to make use of).
-
- * Try to allow the user to provide a callback function/method which could
-   be used in place of the parse_paragraph() method and/or the command(),
-   verbatim(), and textblock() methods.  Such a callback might be provided
-   as a constructor argument to Pod::Parser.  Perhaps it might be possible
-   to pass the callback method an array of lines or of paragraphs (rather
-   than one input block at a time) if certain options are specified.
-
-
- HISTORY
- =======
- 19-Aug-1996           Brad Appleton     <Brad_Appleton-GDBA001@email.mot.com>
- -----------------------------------------------------------------------------
- Released version 1.00 (first "official" release):
-  - Renamed Pod::Filter to Pod::Parser at Kenneth Albanowski's recommendation.
-  - Moved podselect() into its own separate module Pod::Select to avoid
-    unnecessary namespace pollution in Pod::Parser.
-  - Renamed several methods and added another preprocessing method in
-    Parser.pm.
-  - Pod::Parser now keeps track of the current line and paragraph number
-    and the current input and output file names.
-  - Fixed parse_from_filehandle() to recognize a line matching /^\s+$/ as a
-    paragraph terminator.
-  - Included Pod::Usage and Pod::Text as part of the PodParser distribution
-    rather then packing and releasing each module separately.
-  - Removed pod2text.PL and added pod2usage.PL
-
-
- 07-Aug-1996           Brad Appleton     <Brad_Appleton-GDBA001@email.mot.com>
- -----------------------------------------------------------------------------
- Initial release of version 0.01 to garner some feedback. This release was
- actually three separate "initial" releases of Pod::Parser, Pod::Text, and
- Pod::Usage which were originally named Pod::Filter, Pod::PlainText, and
- Pod::Usage (respectively).
-
-
@@ -1,128 +0,0 @@
-#############################################################################
-# Select.pm -- function to select portions of pod docs
-#
-# Based on Tom Christiansen's pod2text() function
-# (with extensive modifications).
-#
-# Copyright (C) 1996 Tom Christiansen. All rights reserved.
-# This file is part of "PodParser". PodParser is free software;
-# you can redistribute it and/or modify it under the same terms
-# as Perl itself.
-#############################################################################
-
-package PDL::Pod::Select;
-
-$VERSION = 1.00;   ## Current version of this package
-require  5.002;    ## requires Perl version 5.002 or later
-
-=head1 NAME
-
-podselect - function to extract selected sections of pod documentation
-
-=head1 SYNOPSIS
-
-    use PDL::Pod::Select;
-    podselect (@filelist);
-    podselect ({OUTPUT => "tmp.out"}, @filelist):
-    podselect ({SELECT => ["NAME|SYNOPSIS", "OPTIONS"]}, @filelist):
-    podselect ({OUTPUT => ">&STDERR", SELECT => ["DESCRIPTION"]}, "-");
-
-=head1 DESCRIPTION
-
-B<podselect()> is a function which will extract specified sections of
-pod documentation from an input stream. This ability is already provided
-in the B<PDL::Pod::Parser> module. Subclasses of B<PDL::Pod::Parser> that wish to
-take advantage of this feature do I<not> need to derive from
-B<PDL::Pod::Select>. B<PDL::Pod::Select> merely provides a single function named
-B<podselect()> which provides this capability in function form (as
-opposed to object form) for extracting the raw pod docs.
-
-=cut
-
-#############################################################################
-
-use Exporter ();
-use PDL::Pod::Parser;
-@ISA = qw(Exporter);
-@EXPORT = qw(&podselect);
-
-use strict;
-use diagnostics;
-use Carp;
-
-sub version {
-    no strict;
-    return  $VERSION;
-}
-
-
-=head2 podselect(\%options, @filelist)
-
-B<podselect> will print the raw (untranslated) pod documentation of all
-pod sections in the given input files specified by C<@filelist>
-according to the given options.
-
-If any argument to B<podselect> is a reference to a hash
-(associative array) then the values with the following keys are
-processed as follows:
-
-=over 4
-
-=item C<OUTPUT>
-
-A string corresponding to the desired output file (or ">&STDOUT"
-or ">&STDERR"). The default is to use standard output.
-
-=item C<SELECT>
-
-A reference to an array of sections specifications (as described in
-L<PDL::Pod::Parser/"SECTION SPECIFICATIONS">) which indicate the desired set of pod
-sections and subsections to be selected from input. If no section
-specifications are given, then all sections of pod documentation are
-used.
-
-=back
-
-All other arguments should correspond to the names of input files
-containing pod documentation. A file name of "-" or "<&STDIN" will
-be interpeted to mean standard input (which is the default if no
-filenames are given).
-
-=cut
-
-sub podselect {
-    my(@argv) = @_;
-    my (@sections, $output);
-    my $pod_parser = new PDL::Pod::Parser;
-    my $num_inputs = 0;
-    local($_);
-    for (@argv) {
-        if (ref($_)) {
-            next unless (ref($_) eq 'HASH');
-            $output = $_->{OUTPUT}  if (defined $_->{OUTPUT});
-            if ((defined $_->{SELECT}) && (ref($_->{SELECT}) eq 'ARRAY')) {
-                $pod_parser->select(@{$_->{SELECT}});
-            }
-        }
-        else {
-            $pod_parser->parse_from_file($_, $output);
-            ++$num_inputs;
-        }
-    }
-    $pod_parser->parse_from_file("-")  unless ($num_inputs > 0);
-}
-
-=head1 SEE ALSO
-
-L<PDL::Pod::Parser>
-
-=head1 AUTHOR
-
-Brad Appleton E<lt>Brad_Appleton-GBDA001@email.mot.comE<gt>
-
-Based on code for B<pod2text> written by
-Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
-
-=cut
-
-1;
@@ -1,244 +0,0 @@
-#############################################################################
-# Usage.pm -- print usage messages for the running script.
-#
-# Based on Tom Christiansen's Pod::Text::pod2text() function
-# (with modifications).
-#
-# Copyright (C) 1994-1996 Tom Christiansen. All rights reserved.
-# This file is part of "PodParser". PodParser is free software;
-# you can redistribute it and/or modify it under the same terms
-# as Perl itself.
-#############################################################################
-
-package PDL::Pod::Usage;
-
-$VERSION = 1.00;   ## Current version of this package
-require  5.002;    ## requires Perl version 5.002 or later
-
-=head1 NAME
-
-pod2usage - print a usage message using a script's embedded pod documentation
-
-=head1 SYNOPSIS
-
-    use PDL::Pod::Usage;
-    pod2usage();
-    pod2usage(2);
-    pod2usage({EXIT => 2});
-    pod2usage({EXIT => 2, VERBOSE => 0});
-    pod2usage(EXIT => 1, VERBOSE => 2, OUTPUT=\*STDERR);
-    pod2usage(VERBOSE => 2);
-
-=head1 DESCRIPTION
-
-B<pod2usage> will print a usage message for the invoking script (using
-its embedded pod documentation) and then exit the script with the
-specified exit value. It takes a single argument which is either a
-numeric value corresponding to the desired exit status (which defaults
-to 2), or a reference to a hash. If more than one argument is given then
-the entire argument list is assumed to be a hash. If a hash is supplied
-it should contain elements with one or more of the following keys:
-
-=over 4
-
-=item C<EXIT>
-
-The desired exit status to pass to the B<exit()> function.
-
-=item C<VERBOSE>
-
-The desired level of "verboseness" to use when printing the usage
-message. If the corresponding value is 0, then only the "SYNOPSIS"
-section of the pod documentation is printed. If the corresponding value
-is 1, then the "SYNOPSIS" section, along with any section entitled
-"OPTIONS", "ARGUMENTS", or "OPTIONS AND ARGUMENTS" is printed.  If the
-corresponding value is 2 or more then the entire manpage is printed.
-
-=item C<OUTPUT>
-
-A reference to a filehandle, or the pathname of a file to which the
-usage message should be written. The default is C<\*STDERR> unless the
-exit value is less than 2 (in which case the default is C<\*STDOUT>).
-
-=item C<INPUT>
-
-A reference to a filehandle, or the pathname of a file from which the
-invoking script's pod documentation should be read.  It defaults to the
-file indicated by C<$0> (C<$PROGRAM_NAME> for C<use English;> users).
-
-=back
-
-If neither the exit value nor the verbose level is specified, then the
-default is to use an exit value of 2 with a verbose level of 0.
-
-If an exit value is specified but the verbose level is not, then the
-verbose level will default to 1 if the exit value is less than 2 and
-will default to 0 otherwise.
-
-If a verbose level is specified but an exit value is not, then the exit
-value will default to 2 if the verbose level is 0 and will default to 1
-otherwise.
-
-=head1 EXAMPLE
-
-Most scripts should print some type of usage message to STDERR when a
-command line syntax error is detected. They should also provide an
-option (usually C<-h> or C<-help>) to print a (possibly more verbose)
-usage message to STDOUT. Some scripts may even wish to go so far as to
-provide a means of printing their complete documentation to STDOUT
-(perhaps by allowing a C<-man> option). The following example uses
-B<pod2usage> in combination with B<Getopt::Long> to do all of these
-things:
-
-    use PDL::Pod::Usage;
-    use Getopt::Long;
-
-    GetOptions("help", "man")  ||  pod2usage(2);
-    pod2usage(1)  if ($opt_help);
-    pod2usage(VERBOSE => 2)  if ($opt_man);
-
-=head1 CAVEATS
-
-By default, B<pod2usage()> will use C<$0> as the path to the pod input
-file.  Unfortunately, not all systems on which Perl runs will set C<$0>
-properly (although if C<$0> isn't found, B<pod2usage()> will search
-C<$ENV{PATH}>).  If this is the case for your system, you may need to
-explicitly specify the path to the pod docs for the invoking script
-using something similar to the following:
-
-=over 4
-
-=item *
-
-C<pod2usage(EXIT =E<gt> 2, INPUT =E<gt> "/path/to/your/pod/docs");>
-
-=back
-
-=head1 AUTHOR
-
-Brad Appleton E<lt>Brad_Appleton-GBDA001@email.mot.comE<gt>
-
-Based on code for B<Pod::Text::pod2text()> written by
-Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
-
-=cut
-
-#############################################################################
-
-use Exporter ();
-use PDL::Pod::Parser;
-use Pod::Text;
-
-@ISA = qw(Pod::Text);
-@EXPORT = qw(&pod2usage);
-
-use strict;
-use diagnostics;
-use Carp;
-
-##---------------------------------------------------------------------------
-
-##---------------------------------
-## Function definitions begin here
-##---------------------------------
-
-sub version {
-    no strict;
-    return  $VERSION;
-}
-
-sub pod2usage {
-    local($_) = @_;
-    my %options;
-    ## Collect arguments
-    if (@_ > 1) {
-        ## Too many arguments - assume that this is a hash and
-        ## the user forgot to pass a reference to it.
-        %options = @_;
-    }
-    elsif (ref $_) {
-        ## User passed a ref to a hash
-        %options = %{$_}  if (ref($_) eq 'HASH');
-    }
-    else {
-        ## User passed in the exit value to use
-        $options{"EXIT"} =  $_;
-    }
-
-    ## Now determine default EXIT and VERBOSE values to use
-    if ((! defined $options{"EXIT"}) && (! defined $options{"VERBOSE"})) {
-        $options{"EXIT"} = 2;
-        $options{"VERBOSE"} = 0;
-    }
-    elsif (! defined $options{"EXIT"}) {
-        $options{"EXIT"} = ($options{"VERBOSE"} > 0) ? 1 : 2;
-    }
-    elsif (! defined $options{"VERBOSE"}) {
-        $options{"VERBOSE"} = ($options{"EXIT"} < 2);
-    }
-
-    ## Default the output file
-    $options{"OUTPUT"} = ($options{"EXIT"} < 2) ? \*STDOUT : \*STDERR
-            unless (defined $options{"OUTPUT"});
-    ## Default the input file
-    $options{"INPUT"} = $0  unless (defined $options{"INPUT"});
-
-    ## Look up input file in path if it doesnt exist.
-    unless ((ref $options{"INPUT"}) || (-e $options{"INPUT"})) {
-        my ($dirname, $basename) = ('', $options{"INPUT"});
-        for $dirname (split(':', $ENV{PATH})) {
-            ## It would be nice if I could do this without hardcoding
-            ## the '/' (which might not work for non-Unix systems).
-            $_ = "${dirname}/${basename}";
-            last if (-e $_) && ($options{"INPUT"} = $_);
-        }
-    }
-
-    ## Now create a pod reader and constrain it to the desired sections.
-    my $parser = new PDL::Pod::Usage(VERBOSE => $options{"VERBOSE"});
-    if ($options{"VERBOSE"} == 0) {
-        $parser->select("SYNOPSIS");
-    }
-    elsif ($options{"VERBOSE"} == 1) {
-        my $opt_re = '(?i)' .
-                     '(?:OPTIONS|ARGUMENTS)' .
-                     '(?:\s*(?:AND|\/)\s*(?:OPTIONS|ARGUMENTS))?';
-        $parser->select( 'SYNOPSIS', $opt_re, "DESCRIPTION/$opt_re" );
-    }
-
-    ## Now translate the pod document and then exit with the desired status
-    $parser->parse_from_file($options{"INPUT"}, $options{"OUTPUT"});
-    exit($options{"EXIT"});
-}
-
-##---------------------------------------------------------------------------
-
-##-------------------------------
-## Method definitions begin here
-##-------------------------------
-
-sub new {
-    my $this = shift;
-    my $class = ref($this) || $this;
-    my %params = @_;
-    my $self = {%params};
-    bless $self, $class;
-    $self->initialize();
-    return $self;
-}
-
-sub preprocess_paragraph {
-    my $self = shift;
-    local($_) = shift;
-    ## See if this is a heading and we arent printing the entire manpage.
-    if (($self->{VERBOSE} < 2) && /^=head/o) {
-        ## Change the title of the SYNOPSIS section to USAGE
-        s/^=head1\s+SYNOPSIS\s*$/=head1 USAGE/o;
-        ## Try to do some lowercasing instead of all-caps in headings
-        s{([A-Z])([A-Z]+)}{((length($2) > 2) ? $1 : lc($1)) . lc($2)}ge;
-        ## Use a colon to end all headings
-        s/\s*$/:/o  unless (/:\s*$/o);
-    }
-    return  $self->SUPER::preprocess_paragraph($_);
-}
-
@@ -134,6 +134,27 @@ sub fix_html_path ($) {
 	or die "ERROR: Unable to rename $outfile\n";
 }
 
+sub fix_pp_inline ($) {
+    my $infile = shift;
+    my $outfile = "${infile}.n";
+    
+    my $ifh = new IO::File "<$infile"
+	or die "ERROR Unable to read from <$infile>\n";
+    my $ofh = new IO::File ">$outfile"
+	or die "ERROR: Unable to write to <$outfile>\n";
+    
+    # assume that links do not break across a line
+    while ( <$ifh> ) {
+	#fix the links
+	s|a href="../Inline/Pdlpp.html"|a href="./PP-Inline.html"|g;
+	print $ofh $_;
+    }
+    $ifh->close;
+    $ofh->close;
+    rename $outfile, $infile
+	or die "ERROR: Unable to rename $outfile\n";
+}
+
 ##############################################################
 ## Code
 
@@ -277,6 +298,7 @@ $sub = sub {
     hack_html( $outfile ) if $] < 5.006;
     fix_pdl_dot_html( $outfile);
     fix_html_path( $outfile);
+    fix_pp_inline( $outfile);
 
     chdir $File::Find::dir; # don't confuse File::Find
 };
@@ -43,6 +43,7 @@ $onldc->savedb();
 $outdir = "$dir/PDL";
 # ($outdir = $INC{'PDL.pm'}) =~ s/\.pm$//i;
 $outindex="$outdir/Index.pod" unless (defined $outindex);
+unlink $outindex if -e $outindex;  # Handle read only file
 open POD, ">$outindex"
   or die "couldn't open $outindex";
 print POD <<'EOPOD';
@@ -696,7 +696,7 @@ sub imag2d {
    my ($img, $name, $zoom, $off_r, $off_c) = (undef,"Figure $cur_fig_num", undef, 0, 0);
 
    # need to add error checking here
-   $img = shift;
+   $img = (shift)->copy;
    $name  = shift if scalar(@_);
    $zoom  = shift if scalar(@_);
    $off_r = shift if scalar(@_);
@@ -798,9 +798,7 @@ sub imag2d {
    glFlush();
 
    # we don't twiddle if in PDL shell and glutRunning is on
-   twiddle() unless defined $PERLDL::TERM
-      and exists($PERLDL::TERM->Features->{glutRunning})
-      and $PERLDL::TERM->glutRunning;
+   twiddle() unless defined $PERLDL::TERM and ref $Term::ReadLine::toloop;
 
    return $window_id;
 }
@@ -825,6 +823,10 @@ sub imag2d_update {
    die "imag2d_update: callback could not find image window\n" unless defined $img;
 
    # update display window
+   # TODO: do we need to save and restore the current window?
+   # For now: calling imag2d_update makes that window current
+   glutSetWindow($win_id);
+
    $img .= $image->sever;
    glutPostRedisplay();
 
@@ -857,7 +859,6 @@ sub close_imag2d_window {
 
    if ($found_it) {
       @imag2d_list = grep { $_->{window_id} != $win_id } @imag2d_list;
-      $imag2d_keep_twiddling = 0 unless scalar(@imag2d_list);
    } else {
       warn "close_imag2d_window: could not find open window\n";
    }
@@ -887,6 +888,7 @@ sub twiddle {
    while ($imag2d_keep_twiddling && scalar(@imag2d_list)) {
       glutMainLoopEvent();
    }
+   glutMainLoopEvent();
    print STDERR "Stopped twiddle-ing!\n";
 }
 
@@ -5,5 +5,6 @@ WriteMakefile(
  'NAME'         => 'PDL::Graphics::LUT',
  'VERSION_FROM' => '../../Basic/Core/Version.pm',
  'DIR'          => [ 'tables', 'ramps' ],
+ (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -15,6 +15,7 @@ WriteMakefile(
   'VERSION_FROM' => '../../../Basic/Core/Version.pm',
   'PM' => {
       (map {($_,'$(INST_LIBDIR)/'.$_)} @tables)
-   }
+   },
+   (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -15,6 +15,7 @@ WriteMakefile(
   'VERSION_FROM' => '../../../Basic/Core/Version.pm',
   'PM' => {
       (map {($_,'$(INST_LIBDIR)/'.$_)} @tables)
-   }
+   },
+   (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -18,6 +18,7 @@ our @EXPORT = qw(
 );
 
 our $VERSION = '0.01';
+$VERSION = eval $VERSION;
 
 
 # Preloaded methods go here.
@@ -10,5 +10,6 @@ use ExtUtils::MakeMaker;
 WriteMakefile(
 	      'NAME'  	=> 'PDL::Graphics::Limits',
 	      'VERSION_FROM' => '../../Basic/Core/Version.pm',
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -41,4 +41,5 @@ WriteMakefile(
                'PM'           => \%pm,
                'MAN3PODS'     => \%man3pods,
                'DIR'          => [@subdirs],
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
@@ -10,6 +10,7 @@ use ExtUtils::MakeMaker;
 WriteMakefile(
 	      'NAME'  	=> 'PDL::Graphics::PGPLOT',
 	      'VERSION_FROM' => '../../Basic/Core/Version.pm',
-	      'DIR' => ['Window']
+	      'DIR' => ['Window'],
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -10,6 +10,7 @@ use ExtUtils::MakeMaker;
 WriteMakefile(
 	      'NAME'  	=> 'PDL::Graphics::PGPLOT::Window',
 	      'VERSION_FROM' => '../../../Basic/Core/Version.pm',
-	      'INC' => '-I../../../Basic/Core/' # for ppport.h
+	      'INC' => '-I../../../Basic/Core/', # for ppport.h
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -739,8 +739,6 @@ where C<$win> is a PDL::Graphics::PGPLOT::Window object. That is all.
 
 =head2 Window control functions.
 
-=for ref Internal
-
 =head2 pgwin
 
 =for ref
@@ -975,8 +973,6 @@ working with several panels.
 
 =head2 Plotting functions
 
-=for ref Internal
-
 =head2 env
 
 =for ref
@@ -1493,10 +1489,10 @@ set pen=0 for both that point and the point before it.
 
 =for usage
 
- Usage: $w->( $x, $y, [$pen], [$opt] );
-        $w->( $xy, [$pen], [$opt] );
-        $w->( \@xvects, \@yvects, [\@pen], [$opt] );
-        $w->( \@xyvects, [\@pen], [$opt] );
+ Usage: $w->lines( $x, $y, [$pen], [$opt] );
+        $w->lines( $xy, [$pen], [$opt] );
+        $w->lines( \@xvects, \@yvects, [\@pen], [$opt] );
+        $w->lines( \@xyvects, [\@pen], [$opt] );
 
 The following standard options influence this command:
  AXIS, BORDER, COLO(U)R, LINESTYLE, LINEWIDTH, MISSING,
@@ -2058,9 +2054,6 @@ Note that C<$x> and C<$y> must be the same size (>1D is OK, though meaningless a
 
 =head2 Text routines
 
-=for ref Internal
-
-
 =head2 text
 
 =for ref
@@ -2186,8 +2179,6 @@ is desired. You can also use the synonyms C<Bg> and C<BackgroundColor>.
 
 =head2 Cursor routines
 
-=for ref Internal
-
 =head2 cursor
 
 =for ref
@@ -2246,9 +2237,7 @@ To select a region of the X-axis:
   ($x2, $y2, $ch) = cursor({Type => 'TwoVerticalLines', XRef => $x1});
 
 
-=head2 Internal routines
-
-=for ref Internal
+=head1 Internal routines
 
 =cut
 
@@ -2311,8 +2300,6 @@ $PDL::Graphics::PGPLOT::RECORDING = 0; # By default recording is off..
 
 =head2 signal_catcher, catch_signals, release_signals
 
-=for ref Internal PDL/PGPLOT signal handlers
-
 To prevent pgplot from doing a fandango on core, we have to block interrupts
 during PGPLOT calls.  Specifically, INT needs to get caught.  These internal
 routines provide a mechanism for that.
@@ -259,8 +259,11 @@ sub compileAndRun {
   system "$cc $ccflags $flags temp.c $flags -o temp > $devnull 2>&1";
   unlink('./temp.c');
   die "Cannot compile test program: $code" unless (-e 'temp' or -e 'temp.exe');
-  return unless ($run);
-
+  unless ($run){
+      unlink './temp';
+      unlink './temp.exe';
+      return;
+  }
   my $res = `./temp`;
   unlink ('./temp');
   return $res;
@@ -2012,6 +2012,11 @@ pp_addhdr(<<'EOH');
 #include <plplotP.h>
 #include <plevent.h>
 #include <stdio.h>
+
+#ifdef plwidth
+#define c_plwid c_plwidth
+#endif
+
 EOH
 
 # The create_low_level_constants function is used to make the #define'd
@@ -2247,7 +2252,7 @@ C:
 
 perl:
 
-  my ($legend_width, $legend_height) = 
+  my ($legend_width, $legend_height) =
     pllegend ($position, $opt, $x, $y, $plot_width, $bg_color, $nlegend,
     \@opt_array,
     $text_offset, $text_scale, $text_spacing, $test_justification,
@@ -4623,7 +4628,7 @@ pp_addpm (<<'EOPM');
 
 =for sig
 
-my ($legend_width, $legend_height) = 
+my ($legend_width, $legend_height) =
     pllegend ($position, $opt, $x, $y, $plot_width, $bg_color, $nlegend,
     \@opt_array,
     $text_offset, $text_scale, $text_spacing, $test_justification,
@@ -4696,35 +4701,35 @@ PPCODE:
     elem = av_fetch((AV *)SvRV(text_rv),            i, 0); text[i]            = (char *)SvPV_nolen(*elem);
     box_colors[i] = 0;
     if (SvROK(box_colors_rv)) {
-      elem = av_fetch((AV *)SvRV(box_colors_rv),    i, 0); 
+      elem = av_fetch((AV *)SvRV(box_colors_rv),    i, 0);
       if (elem && SvOK(*elem)) {
         box_colors[i] = (int)SvIV(*elem);
       }
     }
     box_patterns[i] = 0;
     if (SvROK(box_patterns_rv)) {
-      elem = av_fetch((AV *)SvRV(box_patterns_rv),  i, 0); 
+      elem = av_fetch((AV *)SvRV(box_patterns_rv),  i, 0);
       if (elem && SvOK(*elem)) {
         box_patterns[i] = (int)SvIV(*elem);
       }
     }
     box_scales[i] = 0.0;
     if (SvROK(box_scales_rv)) {
-      elem = av_fetch((AV *)SvRV(box_scales_rv),    i, 0); 
+      elem = av_fetch((AV *)SvRV(box_scales_rv),    i, 0);
       if (elem && SvOK(*elem)) {
         box_scales[i] = (double)SvNV(*elem);
       }
     }
     box_line_widths[i] = 0;
     if (SvROK(box_line_widths_rv)) {
-      elem = av_fetch((AV *)SvRV(box_line_widths_rv), i, 0); 
+      elem = av_fetch((AV *)SvRV(box_line_widths_rv), i, 0);
       if (elem && SvOK(*elem)) {
         box_line_widths[i] = (int)SvIV(*elem);
       }
     }
     line_colors[i] = 0;
     if (SvROK(line_colors_rv)) {
-      elem = av_fetch((AV *)SvRV(line_colors_rv), i, 0); 
+      elem = av_fetch((AV *)SvRV(line_colors_rv), i, 0);
       if (elem && SvOK(*elem)) {
         line_colors[i] = (int)SvIV(*elem);
       }
@@ -4732,7 +4737,7 @@ PPCODE:
 
     line_styles[i] = 0;
     if (SvROK(line_styles_rv)) {
-      elem = av_fetch((AV *)SvRV(line_styles_rv), i, 0); 
+      elem = av_fetch((AV *)SvRV(line_styles_rv), i, 0);
       if (elem && SvOK(*elem)) {
         line_styles[i] = (int)SvIV(*elem);
       }
@@ -4740,7 +4745,7 @@ PPCODE:
 
     line_widths[i] = 0;
     if (SvROK(line_widths_rv)) {
-      elem = av_fetch((AV *)SvRV(line_widths_rv), i, 0); 
+      elem = av_fetch((AV *)SvRV(line_widths_rv), i, 0);
       if (elem && SvOK(*elem)) {
         line_widths[i] = (int)SvIV(*elem);
       }
@@ -4748,7 +4753,7 @@ PPCODE:
 
     symbol_colors[i] = 0;
     if (SvROK(symbol_colors_rv)) {
-      elem = av_fetch((AV *)SvRV(symbol_colors_rv), i, 0); 
+      elem = av_fetch((AV *)SvRV(symbol_colors_rv), i, 0);
       if (elem && SvOK(*elem)) {
         symbol_colors[i] = (int)SvIV(*elem);
       }
@@ -4756,7 +4761,7 @@ PPCODE:
 
     symbol_scales[i] = 0.0;
     if (SvROK(symbol_scales_rv)) {
-      elem = av_fetch((AV *)SvRV(symbol_scales_rv), i, 0); 
+      elem = av_fetch((AV *)SvRV(symbol_scales_rv), i, 0);
       if (elem && SvOK(*elem)) {
         symbol_scales[i] = (double)SvNV(*elem);
       }
@@ -4764,7 +4769,7 @@ PPCODE:
 
     symbol_numbers[i] = 0;
     if (SvROK(symbol_numbers_rv)) {
-      elem = av_fetch((AV *)SvRV(symbol_numbers_rv), i, 0); 
+      elem = av_fetch((AV *)SvRV(symbol_numbers_rv), i, 0);
       if (elem && SvOK(*elem)) {
         symbol_numbers[i] = (int)SvIV(*elem);
       }
@@ -4772,7 +4777,7 @@ PPCODE:
 
     symbols[i] = "0";
     if (SvROK(symbols_rv)) {
-      elem = av_fetch((AV *)SvRV(symbols_rv), i, 0); 
+      elem = av_fetch((AV *)SvRV(symbols_rv), i, 0);
       if (elem && SvOK(*elem)) {
         symbols[i] = (char *)SvPV_nolen(*elem);
       }
@@ -4866,13 +4871,13 @@ EOPM
 pp_addxs (<<"EOC");
 void
 plbtime (ctime)
-  double ctime 
+  double ctime
 PPCODE:
   PLINT year;
   PLINT month;
   PLINT day;
   PLINT hour;
-  PLINT min; 
+  PLINT min;
   PLFLT sec;
   c_plbtime(&year, &month, &day, &hour, &min, &sec, ctime);
   EXTEND (SP, 6);
@@ -4896,7 +4901,7 @@ pp_addpm (<<'EOPM');
 
 =for ref
 
-Configure transformation between continuous and broken-down time (and                                                           
+Configure transformation between continuous and broken-down time (and
 vice versa) for current stream.
 
 =cut
@@ -4917,8 +4922,8 @@ plconfigtime(scale, offset1, offset2, ccontrol, ifbtime_offset, year, month, day
   int min
   double sec
 PPCODE:
-  c_plconfigtime((PLFLT) scale, (PLFLT) offset1, (PLFLT) offset2, 
-                 (PLINT) ccontrol, (PLBOOL) ifbtime_offset, (PLINT) year, 
+  c_plconfigtime((PLFLT) scale, (PLFLT) offset1, (PLFLT) offset2,
+                 (PLINT) ccontrol, (PLBOOL) ifbtime_offset, (PLINT) year,
                  (PLINT) month, (PLINT) day, (PLINT) hour, (PLINT) min, (PLFLT) sec);
 EOC
 pp_add_exported ('plconfigtime');
@@ -31,4 +31,5 @@ WriteMakefile (
      'NAME'         => "PDL::Graphics::TriD",
      'VERSION_FROM' => '../../Basic/Core/Version.pm',
      'DIR'          => [ @subdirs ],
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
@@ -3,17 +3,17 @@ use warnings;
 use ExtUtils::MakeMaker;
 
 WriteMakefile(
-    NAME                => 'PDL::Graphics::OpenGL::Perl::OpenGL',
-    VERSION_FROM        => 'OpenGL.pm',
-    ABSTRACT_FROM       => 'OpenGL.pm',
-    ($ExtUtils::MakeMaker::VERSION >= 6.3002
+    'NAME'                => 'PDL::Graphics::OpenGL::Perl::OpenGL',
+    'VERSION_FROM'        => 'OpenGL.pm',
+    'ABSTRACT_FROM'       => 'OpenGL.pm',
+    (eval($ExtUtils::MakeMaker::VERSION) >= 6.3002
       ? ('LICENSE'=> 'perl')
       : ()),
-    PL_FILES            => {},
-    PREREQ_PM => {
+    'PL_FILES'            => {},
+    'PREREQ_PM' => {
         'Test::More' => 0,
-        'OpenGL' => 0.58004,
+        'OpenGL' => 0.58004, # TODO: this should be from perldl.conf value
     },
-    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
-    clean               => { FILES => 'PDL-Graphics-OpenGL-Perl-OpenGL-*' },
+    'dist'                => { 'COMPRESS' => 'gzip -9f', 'SUFFIX' => 'gz', },
+    'clean'               => { 'FILES' => 'PDL-Graphics-OpenGL-Perl-OpenGL-*' },
 );
@@ -59,6 +59,7 @@ Version 0.01_10
 =cut
 
 our $VERSION = '0.01_10';
+$VERSION = eval $VERSION;
 
 
 =head1 SYNOPSIS
@@ -3,4 +3,5 @@ use ExtUtils::MakeMaker;
 WriteMakefile(
 	NAME => "PDL::Graphics::VRML",
      'VERSION_FROM' => '../../../Basic/Core/Version.pm',
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
@@ -197,6 +197,7 @@ sub rdcm {
     }
 
     open(IN, $file) || die "Failed opening image $file!\n";
+    binmode IN;
     # read the whole image
     my $header;
     read(IN, $header, -s $file);
@@ -3,6 +3,7 @@ use ExtUtils::MakeMaker;
 WriteMakefile(
      NAME => "PDL::IO::Dicom",
      'VERSION_FROM' => '../../Basic/Core/Version.pm',
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
 # With dmake a postamble is sometimes (incorrectly) written
@@ -53,7 +53,7 @@ BEGIN {
 
   package PDL::IO::FITS;
 
-  $PDL::IO::FITS::VERSION = 0.91; # Will be 1.0 when ascii table read/write works.
+  $PDL::IO::FITS::VERSION = 0.92; # Will be 1.0 when ascii table read/write works.
 
   our @EXPORT_OK = qw( rfits rfitshdr wfits );
   our %EXPORT_TAGS = (Func=>[@EXPORT_OK]);
@@ -67,7 +67,7 @@ BEGIN {
   use PDL::Types;
   use PDL::Options;
   use PDL::Bad;
-  use PDL::NiceSlice;
+#  use PDL::NiceSlice;
   use Carp;
   use strict;
 
@@ -121,10 +121,13 @@ Suffix magic:
 
 In list context, C<rfits> reads the primary image and all possible
 extensions, returning them in the same order that they occurred in the
-file.  In scalar context, the default is to read the primary HDU. One
-can read other HDU's by using the [n] syntax, the second one is [1].
-Currently recognized extensions are IMAGE and BINTABLE.  (See the
-addendum on EXTENSIONS for details).
+file -- except that, by default, the primary HDU is skipped if it
+contains no data.  In scalar context, the default is to read the first
+HDU that contains data. One can read other HDU's by using the [n]
+syntax.  Using the [0] syntax forces a read of the first HDU,
+regardless of whether it contains data or no.  Currently recognized
+extensions are IMAGE and BINTABLE.  (See the addendum on EXTENSIONS
+for details).
 
 C<rfits> accepts several options that may be passed in as a hash ref
 if desired:
@@ -162,6 +165,17 @@ time, unpacking such images transparently and returning the data and header
 as if they were part of a normal IMAGE extension.  Setting "expand" to 0
 delivers the binary table, rather than unpacking it into an image.
 
+=item afh (default=1)
+
+By default rfits uses Astro::FITS::Header tied-hash objects to contain
+the FITS header information.  This permits explicit control over FITS
+card information, and conforms well with the FITS specification.  But
+Astro::FITS::Header objects are about 40-60x more memory intensive
+than comparable perl hashes, and also use ~10x more CPU to manage.
+For jobs where header processing performance is important (e.g. reading 
+just the headers of 1,000 FITS files), set afh to 0 to use the legacy parser
+and get a large boost in speed.
+
 =back
 
 FITS image headers are stored in the output PDL and can be retrieved
@@ -299,7 +313,7 @@ reading in a data structure as well.
 
 =cut
 
-our $rfits_options = new PDL::Options( { bscale=>1, data=>1, hdrcpy=>0, expand=>1 } );
+our $rfits_options = new PDL::Options( { bscale=>1, data=>1, hdrcpy=>0, expand=>1, afh=>1 } );
 
 sub PDL::rfitshdr {
   my $class = shift;
@@ -415,7 +429,7 @@ sub PDL::rfits {
    # does not exist.
    # 
 
-   if($PDL::Astro_FITS_Header) { 
+   if($PDL::Astro_FITS_Header and $opt->{afh}) { 
 
      ## Astro::FITS::Header parsing.  Snarf lines to the END card,
      ## and pass them to Astro::FITS::Header.
@@ -435,7 +449,7 @@ sub PDL::rfits {
    } else {
      
      ## Legacy (straight header-to-hash-ref) parsing.  
-     ## Deprecated but preserved.
+     ## Cheesy but fast.
      
      hdr_legacy: { do {
        no strict 'refs';
@@ -532,7 +546,18 @@ sub PDL::rfits {
    
  $fh->close;
   
- return @extensions if(wantarray);
+ if(wantarray) { 
+     ## By default, ditch primary HDU placeholder 
+     if( ref($extensions[0]) eq 'HASH'  and 
+	 $extensions[0]->{SIMPLE} and
+	 exists($extensions[0]->{NAXIS}) and
+	 $extensions[0]->{NAXIS} == 0
+	 ) {
+	 shift @extensions;
+     }
+     # Return all the extensions 
+     return @extensions;
+ } 
  return $pdl;
 }
 
@@ -776,7 +801,7 @@ $PDL::IO::FITS_bintable_handlers = {
            , sub { 
                my( $pdl, $row ) = @_;  # Ignore extra and rpt
                my $n = $pdl->dim(0);
-               my $p2 = byte(($pdl->(($row)) != 0));
+               my $p2 = byte(($pdl->slice("($row)") != 0));
                my $s = ${$p2->get_dataref};
                $s =~ tr/[\000\001]/[01]/;
                pack(  "B".$pdl->dim(0), $s );
@@ -901,7 +926,7 @@ sub _rdP {
     my $readlen = $oflen->at(0) * PDL::Core::howbig($type);
 
     # Store the length of this row in the header field.
-    $tbl->{"len_".$tbl->{hdr}->{"TTYPE$i"}}->($row) .= $oflen->at(0);
+    $tbl->{"len_".$tbl->{hdr}->{"TTYPE$i"}}->dice_axis(0,$row) .= $oflen->at(0);
 
     print "_rdP: pdl is ",join("x",$pdl->dims),"; reading row $row - readlen is $readlen\n"
 	if($PDL::debug);
@@ -1454,7 +1479,7 @@ sub _rfits_unpack_zimage($$$) {
 	if($tbl->{UNCOMPRESSED_DATA}->dim(1) != $tilesize) {
 	    die "rfits: tile size is $tilesize, but uncompressed data rows have size ".$tbl->{UNCOMPRESSED_DATA}->dim(1)."\n";
 	}
-	$tiles->(:,$patchup) .= $tbl->{UNCOMPRESSED_DATA}->($patchup,:)->xchg(0,1);
+	$tiles->dice_axis(1,$patchup) .= $tbl->{UNCOMPRESSED_DATA}->dice_axis(0,$patchup)->xchg(0,1);
     }
 
     ##########
@@ -1845,344 +1870,389 @@ sub PDL::wfits {
   
   #### Figure output type
 
-  unless( UNIVERSAL::isa($pdl,'PDL') ) {
-      my $ref = ref($pdl) || "";
-      if($ref eq 'HASH') {
-	  my $fh = IO::File->new( $file )
-	      or barf "Could not open $file\n";
-	  _wfits_nullhdu($fh);
-	  # default to binary table if none specified
-	  my $table_type = exists $pdl->{tbl} ?
-	      ($pdl->{tbl} =~ m/^a/i ? 'ascii' : 'binary') :
-	      "binary";
-	  _wfits_table($fh,$pdl,$table_type);
-	  $fh->close;
-	return;
-      } else {
-	  barf('wfits: multiple extensions not yet supported\n')
-      }
-  }
-
-  ### Regular image writing.
-  
-  $BITPIX = "" unless defined $BITPIX;
-  if ($BITPIX eq "") {
-    $BITPIX =   8 if $pdl->get_datatype == $PDL_B;
-    $BITPIX =  16 if $pdl->get_datatype == $PDL_S || $pdl->get_datatype == $PDL_US;
-    $BITPIX =  32 if $pdl->get_datatype == $PDL_L;
-    $BITPIX = -32 if $pdl->get_datatype == $PDL_F;
-    $BITPIX = -64 if $pdl->get_datatype == $PDL_D;
-  }
-  my $convert = sub { return $_[0] }; # Default - do nothing
-  $convert = sub {byte($_[0])}   if $BITPIX ==   8;
-  $convert = sub {short($_[0])}  if $BITPIX ==  16;
-  $convert = sub {long($_[0])}   if $BITPIX ==  32;
-  $convert = sub {float($_[0])}  if $BITPIX == -32;
-  $convert = sub {double($_[0])} if $BITPIX == -64;
-  
-  # Automatically figure output scaling
-  
-  my $bzero = 0; my $bscale = 1;
-  if ($BITPIX>0) {
-    my $min = $pdl->min;
-    my $max = $pdl->max;
-    my ($dmin,$dmax) = (0, 2**8-1)     if $BITPIX == 8;
-    ($dmin,$dmax) = (-2**15, 2**15-1)  if $BITPIX == 16;
-    ($dmin,$dmax) = (-2**31, 2**31-1)  if $BITPIX == 32;
-    
-    if ($min<$dmin || $max>$dmax) {
-      $bzero = $min - $dmin;
-      $max -= $bzero;
-      $bscale = $max/$dmax if $max>$dmax;
-    }
-    print "BSCALE = $bscale &&  BZERO = $bzero\n" if $PDL::verbose;
+#  unless( UNIVERSAL::isa($pdl,'PDL') ) {
+#      my $ref = ref($pdl) || "";
+#      if($ref eq 'HASH') {
+#	  my $fh = IO::File->new( $file )
+#	      or barf "Could not open $file\n";
+#	  _wfits_nullhdu($fh);
+#	  # default to binary table if none specified
+#	  my $table_type = exists $pdl->{tbl} ?
+#	      ($pdl->{tbl} =~ m/^a/i ? 'ascii' : 'binary') :
+#	      "binary";
+#	  _wfits_table($fh,$pdl,$table_type);
+#	  $fh->close;
+#	return;
+#     } else {
+#	  barf('wfits: multiple output xtensions not supported\n')
+#     }
+# }
+
+  my @outputs = ();
+  my $issue_nullhdu;
+
+  if( UNIVERSAL::isa($pdl,'PDL') ) {
+      $issue_nullhdu = 0;
+      push(@outputs, $pdl);
+  } elsif( ref($pdl) eq 'HASH' ) {
+      $issue_nullhdu = 1;
+      push(@outputs, $pdl);
+  } elsif( ref($pdl) eq 'ARRAY' ) {
+      $issue_nullhdu = 1;
+      @outputs = @$pdl;
+  } elsif( length(ref($pdl))==0 ) {
+      barf "wfits: needs a HASH or PDL argument to write out\n";
+  } else {
+      barf "wfits: unknown ref type ".ref($pdl)."\n";
   }
 
-  # Check for tile-compression format for the image, and handle it.
-  # We add the image-compression format tags and reprocess the whole
-  # shebang as a binary table.
-  if($opt->{compress}) {
-      croak "Placeholder -- tile compression not yet supported\n";
-  }
-  
-  
   ## Open file & prepare to write binary info
   my $fh = IO::File->new( $file )
       or barf "Unable to create FITS file $file\n";
   binmode $fh;
-  
-  ##############################
-  ## Check header and prepare to write it out
-  
-  my($h) = $pdl->gethdr();
-
-  # Extra logic: if we got handed a vanilla hash that that is *not* an Astro::FITS::Header, but 
-  # looks like it's a FITS header encoded in a hash, then attempt to process it with 
-  # Astro::FITS::Header before writing it out -- this helps with cleanup of tags.
-  if($PDL::Astro_FITS_Header and 
-     defined($h) and
-     ref($h) eq 'HASH' and
-     !defined( tied %$h )
-      ) {
-
-      my $all_valid_fits = 1;
-      for my $k(keys %$h) {
-	  if(length($k) > 8 or
-	     $k !~ m/^[A-Z_][A-Z\d\_]*$/i
-	      ) {
-	      $all_valid_fits = 0;
-	      last;
-	  }
-      }
 
-      if($all_valid_fits) {
-	  # All the keys look like valid FITS header keywords -- so 
-	  # create a tied FITS header object and use that instead.
-	  my $afh = new Astro::FITS::Header( );
-	  my %hh;
-	  tie %hh, "Astro::FITS::Header", $afh;
-	  for (keys %$h) {
-	      $hh{$_} = $h->{$_};
-	  }
-	  $h = \%hh;
-      }
+  if($issue_nullhdu) {
+      _wfits_nullhdu($fh);
   }
 
-  # Now decide whether to emit a hash or an AFH object
-  if(defined($h) && 
-     ( (defined (tied %$h)) && 
-       (UNIVERSAL::isa(tied %$h,"Astro::FITS::Header")))
-     ){
-    my $k;
-    
-    ##n############################
-    ## Tied-hash code -- I'm too lazy to incorporate this into KGB's
-    ## direct hash handler below, so I've more or less just copied and
-    ## pasted with some translation.  --CED
-    ##
-    my $hdr = tied %$h;
-    
-    #
-    # Put advertising comment in the SIMPLE field
-    #n
-    $h->{SIMPLE} = 'T';
-    my(@a) = $hdr->itembyname('SIMPLE');
-    $a[0]->comment('Created with PDL (http://pdl.perl.org)');
-    
-    # and register it as a LOGICAL rather than a string
-    $a[0]->type('LOGICAL');
-    
-    #
-    # Use tied interface to set all the keywords.  Note that this
-    # preserves existing per-line comments, only changing the values.
-    #
-    $h->{BITPIX} = $BITPIX;
-    $h->{NAXIS} = $pdl->getndims;
-    my $correction = 0;
-    for $k(1..$h->{NAXIS}) { 
-      $correction |= (exists $h->{"NAXIS$k"} and 
-                      $h->{"NAXIS$k"} != $pdl->dim($k-1)
-                      );
-      $h->{"NAXIS$k"} = $pdl->getdim($k-1); 
-    }
-    carp("Warning: wfits corrected dimensions of FITS header") 
-      if($correction);
-    
-    $h->{BUNIT} = "Data Value" unless exists $h->{BUNIT};
-    $h->{BSCALE} = $bscale if($bscale != 1);
-    $h->{BZERO}  = $bzero  if($bzero  != 0);
-    
-    if ( $pdl->badflag() ) {
-      if ( $BITPIX > 0 ) { my $a = &$convert(pdl(0.0));
-			   $h->{BLANK} = $a->badvalue(); }
-      else               { delete $h->{BLANK}; }
-    }
-    
-    # Use object interface to sort the lines. This is complicated by
-    # the need for an arbitrary number of NAXIS<n> lines in the middle
-    # of the sorting.  Keywords with a trailing '1' in the sorted-order
-    # list get looped over.
-    my($kk) = 0; 
-    my(@removed_naxis) = ();
-    for $k(0..$#PDL::IO::FITS::wfits_keyword_order) {
-      my($kn) = 0;
-      
-      my @index;
-      do {            # Loop over numericised keywords (e.g. NAXIS1)
-        
-        my $kw = $PDL::IO::FITS::wfits_keyword_order[$k]; # $kw get keyword
-        $kw .= (++$kn) if( $kw =~ s/\d$//);               # NAXIS1 -> NAXIS<n>
-        @index = $hdr->index($kw);
-        
-        if(defined $index[0]) {
-	    if($kn <= $pdl->getndims){
-		$hdr->insert($kk, $hdr->remove($index[0])) 
-		    unless ($index[0] == $kk) ;
-		$kk++;
-	    } 
-	    else{ #remove e.g. NAXIS3 from hdr if NAXIS==2
-		$hdr->removebyname($kw);
-		push(@removed_naxis,$kw);
-	    }
-	}
-      } while((defined $index[0]) && $kn);
-    }
-
-    foreach my $naxis(@removed_naxis){
-	$naxis =~ m/(\d)$/;
-	my $n = $1;
-	foreach my $kw(@PDL::IO::FITS::wfits_numbered_keywords){
-	    $hdr->removebyname($kw . $n);
-	}
-    }
-    #
-    # Delete the END card if necessary (for later addition at the end)
-    #
-    $hdr->removebyname('END');
-    
-    #
-    # Make sure that the HISTORY lines all come at the end
-    # 
-    my @hindex = $hdr->index('HISTORY');
-    for $k(0..$#hindex) {
-      $hdr->insert(-1-$k, $hdr->remove($hindex[-1-$k]));
-    }
-    
-    #
-    # Make sure the last card is an END
-    #
-    $hdr->insert(scalar($hdr->cards),
-                 Astro::FITS::Header::Item->new(Keyword=>'END'));
-    
-    #
-    # Write out all the cards, and note how many bytes for later padding.
-    #
-    my $s = join("",$hdr->cards);
-    
-    $fh->print( $s );
-    $nbytes = length $s;
-  } else {
-    ##
-    ## Legacy emitter (note different advertisement in the SIMPLE
-    ## comment, for debugging!)
-    ##
-    
-    $fh->printf( "%-80s", "SIMPLE  =                    T / PDL::IO::FITS::wfits (http://pdl.perl.org)" );
-    
-    $nbytes = 80; # Number of bytes written so far
-    
-    # Write FITS header
-    
-    %hdr = ();
-    if (defined($h)) {
-      for (keys %$h) { $hdr{uc $_} = $$h{$_} } # Copy (ensuring keynames are uppercase)
-    }
-
-    delete $hdr{SIMPLE}; delete $hdr{'END'};
-    
-    $hdr{BITPIX} =  $BITPIX;
-    $hdr{BUNIT} = "Data Value" unless exists $hdr{BUNIT};
-    wheader($fh, 'BITPIX');
-    
-    $ndims = $pdl->getndims; # Dimensions of data array
-    $hdr{NAXIS}  = $ndims;
-    wheader($fh, 'NAXIS');
-    for $k (1..$ndims) { $hdr{"NAXIS$k"} = $pdl->getdim($k-1) }
-    for $k (1..$ndims) { wheader($fh,"NAXIS$k") }
-    
-    if ($bscale != 1 || $bzero  != 0) {
-      $hdr{BSCALE} =  $bscale;
-      $hdr{BZERO}  =  $bzero;
-      wheader($fh,'BSCALE');
-      wheader($fh,'BZERO');
-    }
-    wheader($fh,'BUNIT');
-    
-    # IF badflag is set
-    #   and BITPIX > 0 - ensure the header contains the BLANK keyword
-    #                    (make sure it's for the correct type)
-    #   otherwise      - make sure the BLANK keyword is removed
-    if ( $pdl->badflag() ) {
-      if ( $BITPIX > 0 ) { my $a = &$convert(pdl(0.0)); $hdr{BLANK} = $a->badvalue(); }
-      else               { delete $hdr{BLANK}; }
-    }
-    
-    for $k (sort fits_field_cmp keys %hdr) { 
-	wheader($fh,$k) unless $k =~ m/HISTORY/;
-    }
-    wheader($fh, 'HISTORY'); # Make sure that HISTORY entries come last.
-    $fh->printf( "%-80s", "END" );
-    $nbytes += 80;
-  }
-  
-  #
-  # Pad the header to a legal value and write the rest of the FITS file.
-  #
-  $nbytes %= 2880;
-  $fh->print( " "x(2880-$nbytes) )
-      if $nbytes != 0; # Fill up HDU
-  
-  # Decide how to byte swap - note does not quite work yet. Needs hack
-  # to IO.xs
-  
-  my $bswap = sub {};     # Null routine
-  if ( !isbigendian() ) { # Need to set a byte swap routine
-    $bswap = \&bswap2 if $BITPIX==16;
-    $bswap = \&bswap4 if $BITPIX==32 || $BITPIX==-32;
-    $bswap = \&bswap8 if $BITPIX==-64;
-  }
-  
-  # Write FITS data
-  
-  my $p1d = $pdl->copy->reshape($pdl->nelem); # Data as 1D stream;
-  
-  $off = 0;
-  $sz  = PDL::Core::howbig(&$convert($p1d->slice('0:0'))->get_datatype);
-  
-  $nbytes = $p1d->getdim(0) * $sz;
-  
-  # Transfer data in blocks (because might need to byte swap)
-  # Buffer is also type converted on the fly
-  
-  my $BUFFSZ = 360*2880; # = ~1Mb - must be multiple of 2880
-  my $tmp;
-  
-  if ( $pdl->badflag() and $BITPIX < 0 and $PDL::Bad::UseNaN == 0 ) {
-    # just print up a message - conversion is actually done in the loop
-    print "Converting PDL bad value to NaN\n" if $PDL::verbose;
-  }
-  
-  while ($nbytes - $off > $BUFFSZ) {
-    
-    # Data to be transferred
-    
-    $buff = &$convert( ($p1d->slice( ($off/$sz).":". (($off+$BUFFSZ)/$sz-1))
-                        -$bzero)/$bscale );
-    
-    # if there are bad values present, and output type is floating-point,
-    # convert the bad values to NaN's.  We can ignore integer types, since
-    # we have set the BLANK keyword
-    #
-    if ( $pdl->badflag() and $BITPIX < 0 and $PDL::Bad::UseNaN == 0 ) {
-      $buff->inplace->setbadtonan();
-    }
-    
-    &$bswap($buff);
-    $fh->print( ${$buff->get_dataref} );
-    $off += $BUFFSZ;
-}
-$buff = &$convert( ($p1d->slice($off/$sz.":-1") - $bzero)/$bscale );
+  for $pdl(@outputs) {
 
-if ( $pdl->badflag() and $BITPIX < 0 and $PDL::Bad::UseNaN == 0 ) {
-  $buff->inplace->setbadtonan();
-}
+      if(ref($pdl) eq 'HASH') {
+	  my $table_type = ( exists($pdl->{tbl}) ? 
+			     ($pdl->{tbl} =~ m/^a/i ? 'ascii' : 'binary') : 
+			     "binary" 
+	      );
+	  _wfits_table($fh,$pdl,$table_type);
+      } elsif( UNIVERSAL::isa($pdl,'PDL') ) {
+
+	  ### Regular image writing.
+	  
+	  $BITPIX = "" unless defined $BITPIX;
+	  if ($BITPIX eq "") {
+	      $BITPIX =   8 if $pdl->get_datatype == $PDL_B;
+	      $BITPIX =  16 if $pdl->get_datatype == $PDL_S || $pdl->get_datatype == $PDL_US;
+	      $BITPIX =  32 if $pdl->get_datatype == $PDL_L;
+	      $BITPIX = -32 if $pdl->get_datatype == $PDL_F;
+	      $BITPIX = -64 if $pdl->get_datatype == $PDL_D;
+	  }
+	  my $convert = sub { return $_[0] }; # Default - do nothing
+	  $convert = sub {byte($_[0])}   if $BITPIX ==   8;
+	  $convert = sub {short($_[0])}  if $BITPIX ==  16;
+	  $convert = sub {long($_[0])}   if $BITPIX ==  32;
+	  $convert = sub {float($_[0])}  if $BITPIX == -32;
+	  $convert = sub {double($_[0])} if $BITPIX == -64;
+	  
+	  # Automatically figure output scaling
+	  
+	  my $bzero = 0; my $bscale = 1;
+	  if ($BITPIX>0) {
+	      my $min = $pdl->min;
+	      my $max = $pdl->max;
+	      my ($dmin,$dmax) = (0, 2**8-1)     if $BITPIX == 8;
+	      ($dmin,$dmax) = (-2**15, 2**15-1)  if $BITPIX == 16;
+	      ($dmin,$dmax) = (-2**31, 2**31-1)  if $BITPIX == 32;
+	      
+	      if ($min<$dmin || $max>$dmax) {
+		  $bzero = $min - $dmin;
+		  $max -= $bzero;
+		  $bscale = $max/$dmax if $max>$dmax;
+	      }
+	      print "BSCALE = $bscale &&  BZERO = $bzero\n" if $PDL::verbose;
+	  }
+	  
+	  # Check for tile-compression format for the image, and handle it.
+	  # We add the image-compression format tags and reprocess the whole
+	  # shebang as a binary table.
+	  if($opt->{compress}) {
+	      croak "Placeholder -- tile compression not yet supported\n";
+	  }
+	  
+	  
+	  ##############################
+	  ## Check header and prepare to write it out
+	  
+	  my($h) = $pdl->gethdr();
+	  
+	  # Extra logic: if we got handed a vanilla hash that that is *not* an Astro::FITS::Header, but 
+	  # looks like it's a FITS header encoded in a hash, then attempt to process it with 
+	  # Astro::FITS::Header before writing it out -- this helps with cleanup of tags.
+	  if($PDL::Astro_FITS_Header and 
+	     defined($h) and
+	     ref($h) eq 'HASH' and
+	     !defined( tied %$h )
+	      ) {
+	      
+	      my $all_valid_fits = 1;
+	      for my $k(keys %$h) {
+		  if(length($k) > 8 or
+		     $k !~ m/^[A-Z_][A-Z\d\_]*$/i
+		      ) {
+		      $all_valid_fits = 0;
+		      last;
+		  }
+	      }
+	      
+	      if($all_valid_fits) {
+		  # All the keys look like valid FITS header keywords -- so 
+		  # create a tied FITS header object and use that instead.
+		  my $afh = new Astro::FITS::Header( );
+		  my %hh;
+		  tie %hh, "Astro::FITS::Header", $afh;
+		  for (keys %$h) {
+		      $hh{$_} = $h->{$_};
+		  }
+		  $h = \%hh;
+	      }
+	  }
+	  
+	  # Now decide whether to emit a hash or an AFH object
+	  if(defined($h) && 
+	     ( (defined (tied %$h)) && 
+	       (UNIVERSAL::isa(tied %$h,"Astro::FITS::Header")))
+	      ){
+	      my $k;
+	      
+	      ##n############################
+	      ## Tied-hash code -- I'm too lazy to incorporate this into KGB's
+	      ## direct hash handler below, so I've more or less just copied and
+	      ## pasted with some translation.  --CED
+	      ##
+	      my $hdr = tied %$h;
+	      
+	      #
+	      # Put advertising comment in the SIMPLE field
+	      #n
+	      if($issue_nullhdu) {
+		  $h->{XTENSION} = "IMAGE";
+	      } else {
+		  $h->{SIMPLE} = 'T';
+		  my(@a) = $hdr->itembyname('SIMPLE');
+		  $a[0]->comment('Created with PDL (http://pdl.perl.org)');
+		  # and register it as a LOGICAL rather than a string
+		  $a[0]->type('LOGICAL');
+	      }
+	      
+	      #
+	      # Use tied interface to set all the keywords.  Note that this
+	      # preserves existing per-line comments, only changing the values.
+	      #
+	      $h->{BITPIX} = $BITPIX;
+	      $h->{NAXIS} = $pdl->getndims;
+	      my $correction = 0;
+	      for $k(1..$h->{NAXIS}) { 
+		  $correction |= (exists $h->{"NAXIS$k"} and 
+				  $h->{"NAXIS$k"} != $pdl->dim($k-1)
+                      );
+		  $h->{"NAXIS$k"} = $pdl->getdim($k-1); 
+	      }
+	      carp("Warning: wfits corrected dimensions of FITS header") 
+		  if($correction);
+	      
+	      $h->{BUNIT} = "Data Value" unless exists $h->{BUNIT};
+	      $h->{BSCALE} = $bscale if($bscale != 1);
+	      $h->{BZERO}  = $bzero  if($bzero  != 0);
+	      
+	      if ( $pdl->badflag() ) {
+		  if ( $BITPIX > 0 ) { my $a = &$convert(pdl(0.0));
+				       $h->{BLANK} = $a->badvalue(); }
+		  else               { delete $h->{BLANK}; }
+	      }
+	      
+	      # Use object interface to sort the lines. This is complicated by
+	      # the need for an arbitrary number of NAXIS<n> lines in the middle
+	      # of the sorting.  Keywords with a trailing '1' in the sorted-order
+	      # list get looped over.
+	      my($kk) = 0; 
+	      my(@removed_naxis) = ();
+	      for $k(0..$#PDL::IO::FITS::wfits_keyword_order) {
+		  my($kn) = 0;
+		  
+		  my @index;
+		  do {            # Loop over numericised keywords (e.g. NAXIS1)
+		      
+		      my $kw = $PDL::IO::FITS::wfits_keyword_order[$k]; # $kw get keyword
+		      $kw .= (++$kn) if( $kw =~ s/\d$//);               # NAXIS1 -> NAXIS<n>
+		      @index = $hdr->index($kw);
+		      
+		      if(defined $index[0]) {
+			  if($kn <= $pdl->getndims){
+			      $hdr->insert($kk, $hdr->remove($index[0])) 
+				  unless ($index[0] == $kk) ;
+			      $kk++;
+			  } 
+			  else{ #remove e.g. NAXIS3 from hdr if NAXIS==2
+			      $hdr->removebyname($kw);
+			      push(@removed_naxis,$kw);
+			  }
+		      }
+		  } while((defined $index[0]) && $kn);
+	      }
+	      
+	      foreach my $naxis(@removed_naxis){
+		  $naxis =~ m/(\d)$/;
+		  my $n = $1;
+		  foreach my $kw(@PDL::IO::FITS::wfits_numbered_keywords){
+		      $hdr->removebyname($kw . $n);
+		  }
+	      }
+	      #
+	      # Delete the END card if necessary (for later addition at the end)
+	      #
+	      $hdr->removebyname('END');
+	      
+	      #
+	      # Make sure that the HISTORY lines all come at the end
+	      # 
+	      my @hindex = $hdr->index('HISTORY');
+	      for $k(0..$#hindex) {
+		  $hdr->insert(-1-$k, $hdr->remove($hindex[-1-$k]));
+	      }
+	      
+	      #
+	      # Make sure the last card is an END
+	      #
+	      $hdr->insert(scalar($hdr->cards),
+			   Astro::FITS::Header::Item->new(Keyword=>'END'));
+	      
+	      #
+	      # Write out all the cards, and note how many bytes for later padding.
+	      #
+	      my $s = join("",$hdr->cards);
+	      
+	      $fh->print( $s );
+	      $nbytes = length $s;
+	  } else {
+	      ##
+	      ## Legacy emitter (note different advertisement in the SIMPLE
+	      ## comment, for debugging!)
+	      ##
 
-  &$bswap($buff);
-  $fh->print( ${$buff->get_dataref} );
-  # Fill HDU and close
-  # note that for the data space the fill character is \0 not " "
-  #
-  $fh->print( "\0"x(($BUFFSZ - $buff->getdim(0) * $sz)%2880) );
+	      if($issue_nullhdu) {
+		  $fh->printf( "%-80s", "XTENSION= 'IMAGE'" );
+	      } else {
+		  $fh->printf( "%-80s", "SIMPLE  =                    T / PDL::IO::FITS::wfits (http://pdl.perl.org)" );
+	      }
+	      
+	      $nbytes = 80; # Number of bytes written so far
+	      
+	      # Write FITS header
+	      
+	      %hdr = ();
+	      if (defined($h)) {
+		  for (keys %$h) { $hdr{uc $_} = $$h{$_} } # Copy (ensuring keynames are uppercase)
+	      }
+	      
+	      delete $hdr{SIMPLE}; delete $hdr{'END'};
+	      
+	      $hdr{BITPIX} =  $BITPIX;
+	      $hdr{BUNIT} = "Data Value" unless exists $hdr{BUNIT};
+	      wheader($fh, 'BITPIX');
+	      
+	      $ndims = $pdl->getndims; # Dimensions of data array
+	      $hdr{NAXIS}  = $ndims;
+	      wheader($fh, 'NAXIS');
+	      for $k (1..$ndims) { $hdr{"NAXIS$k"} = $pdl->getdim($k-1) }
+	      for $k (1..$ndims) { wheader($fh,"NAXIS$k") }
+	      
+	      if ($bscale != 1 || $bzero  != 0) {
+		  $hdr{BSCALE} =  $bscale;
+		  $hdr{BZERO}  =  $bzero;
+		  wheader($fh,'BSCALE');
+		  wheader($fh,'BZERO');
+	      }
+	      wheader($fh,'BUNIT');
+	      
+	      # IF badflag is set
+	      #   and BITPIX > 0 - ensure the header contains the BLANK keyword
+	      #                    (make sure it's for the correct type)
+	      #   otherwise      - make sure the BLANK keyword is removed
+	      if ( $pdl->badflag() ) {
+		  if ( $BITPIX > 0 ) { my $a = &$convert(pdl(0.0)); $hdr{BLANK} = $a->badvalue(); }
+		  else               { delete $hdr{BLANK}; }
+	      }
+	      
+	      for $k (sort fits_field_cmp keys %hdr) { 
+		  wheader($fh,$k) unless $k =~ m/HISTORY/;
+	      }
+	      wheader($fh, 'HISTORY'); # Make sure that HISTORY entries come last.
+	      $fh->printf( "%-80s", "END" );
+	      $nbytes += 80;
+	  }
+	  
+	  #
+	  # Pad the header to a legal value and write the rest of the FITS file.
+	  #
+	  $nbytes %= 2880;
+	  $fh->print( " "x(2880-$nbytes) )
+	      if $nbytes != 0; # Fill up HDU
+	  
+	  # Decide how to byte swap - note does not quite work yet. Needs hack
+	  # to IO.xs
+	  
+	  my $bswap = sub {};     # Null routine
+	  if ( !isbigendian() ) { # Need to set a byte swap routine
+	      $bswap = \&bswap2 if $BITPIX==16;
+	      $bswap = \&bswap4 if $BITPIX==32 || $BITPIX==-32;
+	      $bswap = \&bswap8 if $BITPIX==-64;
+	  }
+	  
+	  # Write FITS data
+	  
+	  my $p1d = $pdl->copy->reshape($pdl->nelem); # Data as 1D stream;
+	  
+	  $off = 0;
+	  $sz  = PDL::Core::howbig(&$convert($p1d->slice('0:0'))->get_datatype);
+	  
+	  $nbytes = $p1d->getdim(0) * $sz;
+	  
+	  # Transfer data in blocks (because might need to byte swap)
+	  # Buffer is also type converted on the fly
+	  
+	  my $BUFFSZ = 360*2880; # = ~1Mb - must be multiple of 2880
+	  my $tmp;
+	  
+	  if ( $pdl->badflag() and $BITPIX < 0 and $PDL::Bad::UseNaN == 0 ) {
+	      # just print up a message - conversion is actually done in the loop
+	      print "Converting PDL bad value to NaN\n" if $PDL::verbose;
+	  }
+	  
+	  while ($nbytes - $off > $BUFFSZ) {
+	      
+	      # Data to be transferred
+	      
+	      $buff = &$convert( ($p1d->slice( ($off/$sz).":". (($off+$BUFFSZ)/$sz-1))
+				  -$bzero)/$bscale );
+	      
+	      # if there are bad values present, and output type is floating-point,
+	      # convert the bad values to NaN's.  We can ignore integer types, since
+	      # we have set the BLANK keyword
+	      #
+	      if ( $pdl->badflag() and $BITPIX < 0 and $PDL::Bad::UseNaN == 0 ) {
+		  $buff->inplace->setbadtonan();
+	      }
+	      
+	      &$bswap($buff);
+	      $fh->print( ${$buff->get_dataref} );
+	      $off += $BUFFSZ;
+	  }
+	  $buff = &$convert( ($p1d->slice($off/$sz.":-1") - $bzero)/$bscale );
+	  
+	  if ( $pdl->badflag() and $BITPIX < 0 and $PDL::Bad::UseNaN == 0 ) {
+	      $buff->inplace->setbadtonan();
+	  }
+	  
+	  &$bswap($buff);
+	  $fh->print( ${$buff->get_dataref} );
+	  # Fill HDU and close
+	  # note that for the data space the fill character is \0 not " "
+	  #
+	  $fh->print( "\0"x(($BUFFSZ - $buff->getdim(0) * $sz)%2880) );
+      } # end of image writing block 
+      else { 
+	  # Not a PDL and not a hash ref
+	  barf("wfits: unknown data type - quitting");
+     }
+  } # end of output loop
   $fh->close();
   1;
 }
@@ -2459,7 +2529,7 @@ sub _prep_table {
 	my $t;
 
 	my $dims = pdl($var->dims); 
-	($t = $dims->(0)) .= 1;
+	($t = $dims->slice("(0)")) .= 1;
 	$rpt = $dims->prod;
 
 =pod
@@ -2560,7 +2630,7 @@ FOO
 	      if(ref $len eq 'ARRAY') {
 		  $l = $len->[$row];
 	      } elsif( UNIVERSAL::isa($len,'PDL') ) {
-		  $l = $len->($row);
+		  $l = $len->dice_axis(0,$row);
 	      } elsif( ref $len ) {
 		  die "wfits: Couldn't understand length spec 'len_".$keysbyname{$colnames[$i]}."' in bintable output (length spec must be a PDL or array ref).\n";
 	      } else {
@@ -2577,7 +2647,7 @@ FOO
 		  # This echoes the normal-table swap and accumulation 
 		  # stuff below, except we're accumulating into the heap.
 		  my $tmp = $csub ? &$csub($var, $row, $col) : $var;
-		  $tmp = $tmp->(0:$l-1)->sever;
+		  $tmp = $tmp->slice("0:".($l-1))->sever;
 		  
 		  if(!isbigendian()) {
 		      bswap2($tmp) if($tmp->get_datatype == $PDL_S);
@@ -2603,7 +2673,7 @@ FOO
       $hdr->{"TFORM$i"} = "$rpt$tstr";
 
       if(UNIVERSAL::isa($var, 'PDL') and $var->ndims > 1) {
-	  $hdr->{"TDIM$i"} = "(".join(",",$var->((0))->dims).")";
+	  $hdr->{"TDIM$i"} = "(".join(",",$var->slice("(0)")->dims).")";
       }
 
       $rowlen += ($field_len[$i] = $rpt * $bytes);
@@ -2623,8 +2693,8 @@ FOO
        
 	if($internaltype[$c] eq 'P') {  # PDL handling
 	  $tmp = $converters[$c]
-	    ? &{$converters[$c]}($a->($r)->flat->sever, $r, $c) 
-	      : $a->($r)->flat->sever ;
+	    ? &{$converters[$c]}($a->slice("$r")->flat->sever, $r, $c) 
+	      : $a->slice("$r")->flat->sever ;
 
 	  ## This would go faster if moved outside the loop but I'm too
 	  ## lazy to do it Right just now.  Perhaps after it actually works.
@@ -3,6 +3,7 @@ use ExtUtils::MakeMaker;
 WriteMakefile(
 	      NAME => "PDL::IO::FITS",
 	      'VERSION_FROM' => '../../Basic/Core/Version.pm',
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 	      );
 
 #
@@ -312,12 +312,14 @@ the copyright notice should be included in the file.
 
 package PDL::IO::FastRaw;
 
-use version; our $VERSION = qv('0.0.3');
+## use version; our $VERSION = qv('0.0.3');
+our $VERSION = '0.000003';
+$VERSION = eval $VERSION;
 
 BEGIN {
    our $have_file_map = 0;
 
-   eval "use File::Map 0.47 qw(:all)";
+   eval "use File::Map 0.57 qw(:all)";
    $have_file_map = 1 unless $@;
 }
 
@@ -430,6 +432,7 @@ sub PDL::mapfraw {
               ($opts->{Creat} || $opts->{Trunc} ? 1:0)
            );
         } else {
+           warn "mapfraw: direct mmap support will be deprecated, please install File::Map\n";
            $pdl->set_data_by_mmap(
               $name,
               $s,
@@ -3,4 +3,5 @@ use ExtUtils::MakeMaker;
 WriteMakefile(
 	NAME => "PDL::IO::FastRaw",
      'VERSION_FROM' => '../../Basic/Core/Version.pm',
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
@@ -338,7 +338,7 @@ package PDL::IO::FlexRaw;
 BEGIN {
    our $have_file_map = 0;
 
-   eval "use File::Map 0.47 qw(map_file)";
+   eval "use File::Map 0.57 qw(map_file)";
    $have_file_map = 1 unless $@;
 }
 
@@ -395,6 +395,10 @@ sub _read_flexhdr {
     my ($newfile) = 1;
     my ($tid, @str);
     my (@ret);
+    # check for ENVI files and bail (for now)
+    my $line1 = scalar <$hfile>;
+    barf "This is an ENVI format file, please use readenvi()\n" if $line1 =~ /^ENVI\r?$/;
+    seek $hfile, 0, 0;  # reset file pointer to beginning
  ITEM:
  while (!eof($hfile)) {
     my (@dims) = (); my ($ndims) = -1, ($mode) = -2;
@@ -423,8 +427,7 @@ sub _read_flexhdr {
                    next ITEM;
                 }
              }
-             barf("Bad typename '$token' in readflex")
-             if (!exists($flextypes{$token}));
+             barf("Bad typename '$token' in readflex") if (!exists($flextypes{$token}));
              $tid = $flextypes{$token};
              $numtokens--;
              $newfile = 0;
@@ -717,6 +720,7 @@ sub mapflex {
                             ($opts{Creat} || $opts{Trunc} ? 1:0)
                          );
     } else {
+       warn "mapflex: direct mmap support being deprecated, please install File::Map\n";
        $d->set_data_by_mmap($name,
                             $size,
                             1,
@@ -839,6 +843,7 @@ sub writeflexhdr {
     my $hname = "$name.hdr";
     my $h = new FileHandle ">$hname"
 	or barf "Couldn't open '$hname' for writing";
+    binmode $h;
     print $h
 	"# Output from PDL::IO::writeflex, data in $name\n";
     foreach (@$hdr) {
@@ -3,4 +3,5 @@ use ExtUtils::MakeMaker;
 WriteMakefile(
 	NAME => "PDL::IO::FlexRaw",
      'VERSION_FROM' => '../../Basic/Core/Version.pm',
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
@@ -105,9 +105,8 @@ FILE *out;
 
 if ($SIZE(i) != 3 || $SIZE(j) > 256)
 {
-    sprintf(str, "Wrong LUT dimensions (%d, %d)! (should be (3, X), where X <= 256)\n",
+    croak("Wrong LUT dimensions (%d, %d)! (should be (3, X), where X <= 256)\n",
             $SIZE(i), $SIZE(j) );
-    croak(str);
 }
 
 xsize = $SIZE(x);
@@ -121,8 +120,7 @@ for(ind = 0; ind < $SIZE(j); ind++)
     tmp = gdImageColorAllocate(im, $lut(i=>0,j=>ind), $lut(i=>1,j=>ind), $lut(i=>2,j=>ind));
     if (tmp != ind)
     {
-        sprintf(str, "palette mismatch on index %d (mapped to %d)!\n", ind, tmp);
-        croak(str);
+        croak("palette mismatch on index %d (mapped to %d)!\n", ind, tmp);
     }
 }
 
@@ -163,16 +161,14 @@ FILE *out;
 
 if( $COMP(level) < -1 || $COMP(level) > 9 )
 {
-    sprintf(str, "Invalid compression level %d, should be [-1,9]!\n", 
+    croak("Invalid compression level %d, should be [-1,9]!\n", 
         $COMP(level) );
-    croak(str);
 }
 
 if ($SIZE(i) != 3 || $SIZE(j) > 256)
 {
-    sprintf(str, "Wrong LUT dimensions (%d, %d)! (should be (3, X), where X <= 256)\n",
+    croak("Wrong LUT dimensions (%d, %d)! (should be (3, X), where X <= 256)\n",
             $SIZE(i), $SIZE(j) );
-    croak(str);
 }
 
 xsize = $SIZE(x);
@@ -186,8 +182,7 @@ for(ind = 0; ind < $SIZE(j); ind++)
     tmp = gdImageColorAllocate(im, $lut(i=>0,j=>ind), $lut(i=>1,j=>ind), $lut(i=>2,j=>ind));
     if (tmp != ind)
     {
-        sprintf(str, "palette mismatch on index %d (mapped to %d)!\n", ind, tmp);
-        croak(str);
+        croak("palette mismatch on index %d (mapped to %d)!\n", ind, tmp);
     }
 }
 
@@ -229,9 +224,8 @@ FILE *out;
 
 if ($SIZE(z) != 3)
 {
-    sprintf(str, "Wrong dimensions (%d, %d, %d)! (should be (X,Y,3))\n",
+    croak("Wrong dimensions (%d, %d, %d)! (should be (X,Y,3))\n",
             $SIZE(x), $SIZE(y), $SIZE(z) );
-    croak(str);
 }
 
 xsize = $SIZE(x);
@@ -276,16 +270,14 @@ FILE *out;
 
 if( $COMP(level) < -1 || $COMP(level) > 9 )
 {
-    sprintf(str, "Invalid compression level %d, should be [-1,9]!\n", 
+    croak("Invalid compression level %d, should be [-1,9]!\n", 
         $COMP(level) );
-    croak(str);
 }
 
 if ($SIZE(z) != 3)
 {
-    sprintf(str, "Wrong dimensions (%d, %d, %d)! (should be (X,Y,3))\n",
+    croak("Wrong dimensions (%d, %d, %d)! (should be (X,Y,3))\n",
             $SIZE(x), $SIZE(y), $SIZE(z) );
-    croak(str);
 }
 
 xsize = $SIZE(x);
@@ -489,15 +481,13 @@ FILE *in = NULL;
 in = fopen($COMP(filename), "rb");
 if ( in == NULL )
 {
-    sprintf(str, "%sError opening %s!\n", func, $COMP(filename));
-    croak(str);
+    croak("%sError opening %s!\n", func, $COMP(filename));
 }
 
 im = gdImageCreateFromPng(in);
 if ( im == NULL )
 {
-    sprintf(str, "%sError reading PNG data!\n", func);
-    croak(str);
+    croak("%sError reading PNG data!\n", func);
 }
 fclose(in);
 
@@ -507,9 +497,8 @@ ysize = gdImageSY(im);
 /* Check the dims... */
 if ( !( ($SIZE(x)==xsize) && ($SIZE(y)==ysize) ) )
 {
-    sprintf(str, "%sDims of %s (%dx%d) and piddle (%dx%d) do not match!\n",
+    croak("%sDims of %s (%dx%d) and piddle (%dx%d) do not match!\n",
             func, $COMP(filename), xsize, ysize, $SIZE(x), $SIZE(y));
-    croak(str);
 }
 
 /* read the data */
@@ -541,15 +530,13 @@ FILE *in = NULL;
 in = fopen($COMP(filename), "rb");
 if ( in == NULL )
 {
-    sprintf(str, "%sError opening %s!\n", func, $COMP(filename));
-    croak(str);
+    croak("%sError opening %s!\n", func, $COMP(filename));
 }
 
 im = gdImageCreateFromPng(in);
 if ( im == NULL )
 {
-    sprintf(str, "%sError reading PNG data!\n", func);
-    croak(str);
+    croak("%sError reading PNG data!\n", func);
 }
 fclose(in);
 
@@ -559,9 +546,8 @@ ysize = gdImageSY(im);
 /* Check the dims... */
 if ( !( ($SIZE(x)==xsize) && ($SIZE(y)==ysize) ) )
 {
-    sprintf(str, "%sDims of %s (%dx%d) and piddle (%dx%d) do not match!\n",
+    croak("%sDims of %s (%dx%d) and piddle (%dx%d) do not match!\n",
             func, $COMP(filename), xsize, ysize, $SIZE(x), $SIZE(y));
-    croak(str);
 }
 
 /* read the data */
@@ -592,9 +578,8 @@ ysize = gdImageSY(im);
 /* Check the dims... */
 if ( !( ($SIZE(x)==xsize) && ($SIZE(y)==ysize) ) )
 {
-    sprintf(str, "%sDims of gdImage (%dx%d) and piddle (%dx%d) do not match!\n",
+    croak("%sDims of gdImage (%dx%d) and piddle (%dx%d) do not match!\n",
             func, xsize, ysize, $SIZE(x), $SIZE(y));
-    croak(str);
 }
 
 /* read the data */
@@ -626,9 +611,8 @@ ysize = gdImageSY(im);
 /* Check the dims... */
 if ( !( ($SIZE(x)==xsize) && ($SIZE(y)==ysize) ) )
 {
-    sprintf(str, "%sDims of gdImage (%dx%d) and piddle (%dx%d) do not match!\n",
+    croak("%sDims of gdImage (%dx%d) and piddle (%dx%d) do not match!\n",
             func, xsize, ysize, $SIZE(x), $SIZE(y));
-    croak(str);
 }
 
 /* read the data */
@@ -651,9 +635,8 @@ char str[255];
 
 if ($SIZE(z) != 3)
 {
-    sprintf(str, "Wrong dimensions (%d, %d, %d)! (should be (X,Y,3))\n",
+    croak("Wrong dimensions (%d, %d, %d)! (should be (X,Y,3))\n",
             $SIZE(x), $SIZE(y), $SIZE(z) );
-    croak(str);
 }
 
 xsize = $SIZE(x);
@@ -688,9 +671,8 @@ char str[255];
 
 if ($SIZE(i) != 3 || $SIZE(j) > 256)
 {
-    sprintf(str, "Wrong LUT dimensions (%d, %d)! (should be (3, X), where X <= 256)\n",
+    croak("Wrong LUT dimensions (%d, %d)! (should be (3, X), where X <= 256)\n",
             $SIZE(i), $SIZE(j) );
-    croak(str);
 }
 
 xsize = $SIZE(x);
@@ -704,8 +686,7 @@ for(ind = 0; ind < $SIZE(j); ind++)
     tmp = gdImageColorAllocate(im, $lut(i=>0,j=>ind), $lut(i=>1,j=>ind), $lut(i=>2,j=>ind));
     if (tmp != ind)
     {
-        sprintf(str, "palette mismatch on index %d (mapped to %d)!\n", ind, tmp);
-        croak(str);
+        croak("palette mismatch on index %d (mapped to %d)!\n", ind, tmp);
     }
 }
 
@@ -755,22 +736,19 @@ FILE *in = NULL;
 /* Check dims: */
 if ( $SIZE(c) != 3 )
 {
-    sprintf(str, "%sLUT dims should be 3,256!\n", func);
-    croak(str);
+    croak("%sLUT dims should be 3,256!\n", func);
 }
 
 in = fopen($COMP(filename), "rb");
 if ( in == NULL )
 {
-    sprintf(str, "%sError opening %s!\n", func, $COMP(filename));
-    croak(str);
+    croak("%sError opening %s!\n", func, $COMP(filename));
 }
 
 im = gdImageCreateFromPng(in);
 if ( im == NULL )
 {
-    sprintf(str, "%sError reading PNG data!\n", func);
-    croak(str);
+    croak("%sError reading PNG data!\n", func);
 }
 fclose(in);
 
@@ -790,7 +768,7 @@ void
 _gdImageDestroy( im )
                 gdImagePtr              im
         CODE:
-                 /* fprintf( stderr, "_gdImageDestroy(): gdImagePtr = %p (d=%d x=%x)\n", im, im, im ); */
+                 /* fprintf( stderr, "_gdImageDestroy(): gdImagePtr = %p (d=%d x=%x l=%ld ll=%lld)\n", im, im, im, im, im);*/ 
                  gdImageDestroy ( im );
         OUTPUT:
 ENDXS
@@ -1010,7 +988,13 @@ sub _img_ptr_from_data
 
 Creates a new PDL::IO::GD object.
 
-Accepts an anonymous hash describing how to create it. Use curly braces here!
+Accepts a hash describing how to create the object. Accepts a single hash ( with
+curly braces ), an inline hash (the same, but without the braces) or a single
+string interpreted as a filename. Thus the following are all equivalent:
+
+ PDL::IO::GD->new( {filename => 'image.png'} );
+ PDL::IO::GD->new( filename => 'image.png' );
+ PDL::IO::GD->new( 'image.png' );
 
 If the hash has:
 
@@ -1061,8 +1045,41 @@ sub new
     my $sub = _pkg_name( "new" );
     
     # Figure out our options:
-    #
-    my $options = shift;
+
+    # I want a single hash. I handle several cases here
+    my $options;
+    if( @_ == 1 && ref $_[0] eq 'HASH' ) {
+      # single hash argument. Just take it
+      $options = shift;
+    }
+    elsif( @_ == 1 && ! ref $_[0] ) {
+      # single scalar argument. Treat it as a filename by default
+      my $filename = shift;
+      $options = { filename => $filename };
+    }
+    else {
+      # the only other acceptable option is an inline hash. This is valid if I
+      # have an even number of arguments, and the even-indexed ones (the keys)
+      # are scalars
+      if( @_ % 2 == 0 ) {
+        my $Npairs = scalar(@_)/2;
+
+        use List::MoreUtils 'none';
+        if( List::MoreUtils::none { ref $_[2*$_] } 0..$Npairs-1 ) {
+          # treat the arguments as a hash
+          $options = { @_ }
+        }
+      }
+    }
+
+    if( !defined $options ) {
+      die <<EOF;
+PDL::IO::GD::new couldn't parse its arguments.
+Expected a hash-ref or an inline hash or just a filename
+EOF
+    }
+
+
     
     if( defined( $options->{pdl} ) )
     {   # Create it from a PDL variable:
@@ -1073,9 +1090,10 @@ sub new
         {
             if( defined( $options->{lut} ) )
             {
-                my $ptr = zeroes( long, 1 );
+                my $ptr = zeroes( longlong, 1 );
                 my $lut = $options->{lut};
                 _pdl_to_gd_image_lut( $pdl, $lut, $ptr );
+#		print STDERR "in new (with lut), setting IMG_PTR to " . $ptr->at(0) . "\n";
                 $self->{IMG_PTR} = $ptr->at(0);
                 $ptr = null;
                 die "$sub: _pdl_to_gd_image_lut() failed!\n"
@@ -1083,9 +1101,10 @@ sub new
             }
             else
             {
-                my $ptr = zeroes( long, 1 );
+                my $ptr = zeroes( longlong, 1 );
                 my $lut = sequence(byte, 255)->slice("*3,:");
                 _pdl_to_gd_image_lut( $pdl, $lut, $ptr );
+#		print STDERR "in new (no lut), setting IMG_PTR to " . $ptr->at(0) . "\n";
                 $self->{IMG_PTR} = $ptr->at(0);
                 $ptr = null;
                 die "$sub: _pdl_to_gd_image_lut() failed!\n"
@@ -1094,8 +1113,9 @@ sub new
         }
         elsif( $num_dims == 3 )
         {
-            my $ptr = zeroes( long, 1 );
+            my $ptr = zeroes( longlong, 1 );
             _pdl_to_gd_image_true( $pdl, $ptr );
+#	    print STDERR "in new (ndims=3), setting IMG_PTR to " . $ptr->at(0) . "\n";
             $self->{IMG_PTR} = $ptr->at(0);
             $ptr = null;
             die "$sub: _pdl_to_gd_image_true() failed!\n"
@@ -1218,8 +1238,8 @@ sub DESTROY
 {
     my $self = shift;
     my $sub = _pkg_name( "DESTROY" );
-    
-    #print STDERR sprintf("$sub: destroying gdImagePtr: 0x%p (%d)!\n", $self->{IMG_PTR}, $self->{IMG_PTR});
+ 
+    #print STDERR sprintf("$sub: destroying gdImagePtr: 0x%p (%d) (%ld) (%lld)!\n", $self->{IMG_PTR}, $self->{IMG_PTR},$self->{IMG_PTR},$self->{IMG_PTR});
     
     if( defined( $self->{IMG_PTR} ) )
     {
@@ -15,7 +15,7 @@ BEGIN
     $ppfile = "GD.pd";
     $package_name = "PDL::IO::GD";
     $lib_name = "GD";
-    $find_libs = [ 'libgd.so', 'libgd.a', 'bgd.dll' ];
+    $find_libs = [ 'libgd.so', 'libgd.a', 'libgd.dll.a', 'bgd.dll' ];
     $find_incs = [ 'gd.h' ];
     $config_flag = 'WITH_GD';
     $config_libs = 'GD_LIBS';
@@ -76,7 +76,7 @@ BEGIN
                 $lib_path = $libdir;
                 $found = 1;
                 # The lib name is different on windows, so we need to adjust the LIBS, below:
-                $linkname = ( $find_lib =~ /bgd.dll/ ) ? 'bgd' : 'gd';
+                $linkname = ( $find_lib =~ /bgd.dll$/ ) ? 'bgd' : 'gd';
             }
             last if $found;
         }
@@ -36,7 +36,8 @@ interfaces, for that see the docs on those modules.
 
 =cut
 
-$VERSION = '2.0';
+our $VERSION = '2.0';
+$VERSION = eval $VERSION;
 
 use PDL::Primitive;
 use PDL::Basic;
@@ -184,6 +184,7 @@ WriteMakefile(     NAME => 'PDL::IO::HDF',
         SUFFIX => 'gz', 
     },
     DIR => [ 'SD', 'VS' ],
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
 sub MY::postamble { pdlpp_postamble_int($package); }
@@ -23,6 +23,7 @@ WriteMakefile(
         COMPRESS => 'gzip', 
         SUFFIX => 'gz'
     }, 
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
 sub MY::postamble { pdlpp_postamble_int($package); }
@@ -23,7 +23,8 @@ WriteMakefile(
     dist => { 
         COMPRESS => 'gzip', 
         SUFFIX => 'gz', 
-    }, 
+    },
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
 sub MY::postamble { pdlpp_postamble_int($package); }        
@@ -0,0 +1,870 @@
+=head1 NAME
+
+PDL::IO::IDL -- I/O of IDL Save Files
+
+=head1 DESCRIPTION
+
+PDL::IO::IDL allows you to read and write IDL(tm) data files.
+
+Currently, only reading is implemented.  Scalars, arrays,
+and structures are all supported.  Heap pointers, compiled code, and
+objects are not supported.  Of those three, only heap pointers are
+likely to be supported in the future.
+
+This code was not developed by RSI, makers of IDL.  
+
+=head1 NOTES
+
+These things seem to work:
+
+=over 3
+
+=item BYTE, SHORT, LONG, FLOAT, and DOUBLE numeric types and arrays
+
+All of these types seem to work fine.  The corresponding variable is
+stored as a PDL in the hash element with the same name as the original
+variable in the file.  Arrays are byteswapped as needed and are read in so 
+that the dim list has the same indexing order within PDL as it did within IDL.
+
+=item STRINGs and arrays of STRINGs
+
+String types are stored as Perl list refs, in the hash element with
+the same name as the original variable in the file.
+
+=item Structures
+
+Structures are stored as hash refs.  The elements of the hash may be
+accessed as values within the hash.
+
+=item Common blocks
+
+Variables that are notated as being in a common block are read as
+normal.  Common-block names are collected in the special hash value
+'+common', which contains a hash each keyword of which is the name of
+a common block and each value of which is an array of variable names.
+
+=back
+
+These things are known to be not working and may one day be fixed:
+
+=over 3
+
+=item COMPLEX numbers
+
+These could be implemented as 2-arrays or as PDL::Complex values, but aren't yet.
+
+=item PTR types
+
+These could be implemented as perl refs but currently aren't.
+
+=item writing 
+
+Maybe one day -- but why bother writing a broken file format?  NetCDF is better.
+
+=back
+
+These things are known to be not working and will probably never be fixed
+
+=over 3
+
+=item Compiled code
+
+Decompiling IDL code is a violation of the IDL end-user license.  To
+implement this, someone who does not hold an IDL license would have to
+reverse-engineer a set of .SAV files sent to that person by someone
+else with an IDL license.
+
+=item Objects
+
+IDL objects contain compiled code.
+
+=back
+
+=head1 FUNCTIONS
+
+=cut
+
+  package PDL::IO::IDL;
+  
+  BEGIN {
+    
+    use Exporter ();
+    package PDL::IO::IDL;
+    @ISA = ( Exporter );
+    @EXPORT_OK = qw( ridl );
+    @EXPORT = @EXPORT_OK;
+    @EXPORT_TAGS = ( Func=>[@EXPORT_OK] );
+
+    our $VERSION = "0.5";
+    $VERSION = eval $VERSION;
+    
+    use PDL;
+    use PDL::Exporter;
+    use Carp;
+    
+  }
+use strict;
+  
+=head2 ridl
+
+=for usage 
+
+$a = ridl("foo.sav");
+
+=for ref 
+
+Read an IDL save file from a file. 
+
+Upon successful completion, $a is a hash ref containing all of the
+variables that are present in the save file, indexed by original
+variable name.  
+
+IDL identifiers are case insensitive; they're all converted to
+upper-case in the hash that gets returned.  This may be adjustable at
+a future date.  Furthermore, because IDL identifiers can't contain
+special characters, some fields that start with '+' are used to store
+metadata about the file itself.
+
+Numeric arrays are stored as PDLs, structures are stored as hashes,
+and string and structure arrays are stored as perl lists.  Named
+structure types don't exist in perl in the same way that they do in
+IDL, so named structures are described in the 'structs' field of the
+global metadata.  Anonymous structures are treated as simple hashes.
+Named structures are also simple hashes, but they also contain a field
+'+name' that refers to the name of the structure type.  
+
+=cut
+
+
+sub ridl {
+  my( $name ) = shift;
+  
+  STDERR->autoflush(1);
+
+  open(IDLSAV,"<$name") || barf("ridl: Can't open `$name' for reading\n");
+  
+  my $hash = read_preamble();
+
+  read_records($hash);
+
+  my @snames = sort keys %{$PDL::IO::IDL::struct_table};
+  @snames = grep(!m/^\+/,@snames);
+  if(@snames) {
+    $hash->{'+structs'}={};
+    local $_;
+    for(@snames) {
+      $hash->{'+structs'}->{$_} = 
+	$PDL::IO::IDL::struct_table->{$_}->{'names'};
+    }
+  }
+
+  return $hash;
+}
+
+
+############################################################
+##
+## Data structure definitions...
+##
+## This is a list, each element of which contains a description and
+## subroutine to read that particular record type.
+##
+
+our $types = [ ['START_MARKER',undef]     # 0      (start of SAVE file)
+	      ,['COMMON_BLOCK',\&r_com]   # 1      (COMMON block definition)
+	      ,['VARIABLE',\&r_var]       # 2      (Variable data)
+	      ,['SYSTEM_VARIABLE',undef]  # 3      (System variable data)
+	      ,undef                      # 4        (??)
+	      ,undef                      # 5        (??)
+	      ,['END_MARKER',\&r_end]     # 6      (End of SAVE file)
+	      ,undef                      # 7        (??)
+	      ,undef                      # 8        (??)
+	      ,undef                      # 9        (??)
+	      ,['TIMESTAMP',\&r_ts]       # 10     (Timestamp of the save file)
+	      ,undef                      # 11       (??)
+              ,['COMPILED',undef]         # 12     (Compiled procedure or func)
+              ,['IDENTIFICATION',undef]   # 13     (Author identification)
+	      ,['VERSION',\&r_v]          # 14     (IDL Version information)
+	      ,['HEAP_HEADER',undef]      # 15     (Heap index information)
+	      ,['HEAP_DATA',undef]        # 16     (Heap data)
+	      ,['PROMOTE64',\&r_p64]      # 17     (Starts 64-bit file offsets)
+	      ];
+
+
+############################################################
+##
+## Vtypes -- Representations of IDL scalar variable types.
+## The first element is the name, the second element is either a 
+## perl string (that should be fed to unpack) or a code ref to a 
+## sub that decodes the type.
+##
+
+our $vtypes = [
+	   undef                                       #  0 
+	  ,["Byte",      \&r_byte_pdl, []            ] #  1 
+	  ,["Short",     \&r_n_cast,   [long,short]  ] #  2 
+	  ,["Long",      \&r_n_pdl,    [long]        ] #  3
+	  ,["Float",     \&r_n_pdl,    [float]       ] #  4
+	  ,["Double",    \&r_n_pdl,    [double]      ] #  5
+	  ,["Complex",   undef                       ] #  6
+	  ,["String",    \&r_strvar,   []            ] #  7
+	  ,["Structure", sub {},       []            ] #  8
+	  ,["ComplexDbl",undef                       ] #  9
+	  ,["HeapPtr",   undef                       ] # 10 
+	  ,["Object",    undef                       ] # 11
+	  ,["UShort",    \&r_n_cast,   [long,ushort] ] # 12
+	  ,["ULong",     \&r_n_pdl,    [long]        ] # 13
+	  ,["LongLong",  undef                       ] # 14
+	  ,["ULongLong", undef                       ] # 15
+];
+     
+
+###
+# Cheesy way to check if 64-bit is OK
+our $quad_ok = eval { my @a = unpack "q","00000001"; $a[0]; };
+
+### Initialized in read_preamble.
+our $little_endian;
+our $swab;
+our $p64;
+
+
+##############################
+#
+# read_preamble
+#
+# Reads the preamble of a file and returns the preamble as a hash
+# ref.  In case of failure, it barfs.  Also initializes the structure table.
+#
+
+sub read_preamble {
+  my $buf;
+  my $out;
+
+  sysread(IDLSAV,$buf,4) || barf ("PDL::IO::IDL: Couldn't read preamble\n");
+  my @sig = unpack("a2S",$buf);
+
+  barf("PDL::IO::IDL: This isn't an IDL save file (wrong magic)\n")
+    if($sig[0] ne 'SR');
+
+  if($sig[1] == 1024 || $sig[1] == 4) {
+    $little_endian = ($sig[1] == 1024);
+  } else {
+    barf "Unrecognized IDL save file type\n";
+  }
+
+  $swab = $little_endian;
+
+  $p64 = 0;
+
+  $PDL::IO::IDL::struct_table = {};
+
+  return {"+meta"=>{}};
+}
+
+##############################
+#
+# read_records
+#
+# Reads all the records of the file.  Splits out into several other
+# types of record reader...
+#
+# 
+
+sub read_records {
+  my $hash = shift;
+  my ($buf, $tbuf);
+
+  my $retval;
+
+  my %nexts;
+  my $tag_count = 0;
+  do { 
+
+    ### Read header of the record
+    
+    sysread(IDLSAV, $tbuf, 4) || barf("PDL::IO::IDL: unexpected EOF\n");
+    my $type = unpack "N",$tbuf;
+    
+    ### Record the next seek location
+    ### (and discard 8 more bytes)
+      
+    my $next;
+    if($p64) {
+      print "Reading 64-bit location..."  if($PDL::debug);
+      sysread(IDLSAV,$buf,8 + 8);
+      my @next = unpack "NN",$buf;
+      $next = $next[1] + 2**32 * $next[0];
+    } else {      
+      print "Reading 32-bit location..." if($PDL::debug);
+      sysread(IDLSAV,$buf,4 + 8);
+      $next = unpack "N",$buf;
+    }
+    print "$next\n" if($PDL::debug);
+    
+    ###
+    ### Infinite-loop detector
+    ###
+
+    barf("Repeat index finder was activated! This is a bug or a problem with your file.\n")
+      if($nexts{$next}) ;
+    $nexts{$next} = 1;
+
+    ###
+    ### Call the appropriate handling routine
+    ###
+
+    $retval = 1;
+
+    if(defined $types->[$type]) {
+      if(defined ($types->[$type]->[1])) {
+	print "Found record of type $types->[$type]->[0]...\n" if($PDL::debug || $PDL::IO::IDL::test);
+	$retval = &{$types->[$type]->[1]}($hash);
+	print "OK.\n" if($PDL::debug);
+      } else {
+	print STDERR "Ignoring record of type ".$types->[$type]->[0]." - not implemented.\n";
+      }
+    } else {
+      print STDERR "\nIgnoring record of unknown type $type - not implemented.\n";
+    }
+    print "Seeking $next ($tag_count tags read so far...)\n" if($PDL::debug || $PDL::IO::IDL::test);
+    $tag_count++;
+    sysseek(IDLSAV, $next, 0);
+  $FOO::hash = $hash;    
+  } while($retval);
+
+}
+
+
+
+
+##############################
+# r_com
+#
+# Jumptable entry for the COMMONBLOCK keyword -- this loads 
+# the variable names that belong in the COMMON block into a
+# metavariable.
+
+sub r_com { 
+  my $hash = shift;
+  my $buf;
+
+  sysread(IDLSAV,$buf,4);
+  my $nvars = unpack "N",$buf;
+
+  my $name = r_string();
+  $hash->{"+common"}->{$name} = [];
+  
+  for my $i(1..$nvars) {
+    push(@{$hash->{"+common"}->{$name}},r_string());
+  }
+
+  return 1;
+}
+
+    
+  
+
+##############################
+# r_end
+#
+# Jumptable entry for the END TABLE keyword -- just return 0.
+
+sub r_end { 0; }
+
+
+##############################
+# r_ts
+#
+# TIMESTAMP record handler
+#
+sub r_ts {
+  my $hash = shift;
+  my $buf;
+
+  ### Read and discard a LONARR(258) -- why? I don't know.
+  sysread(IDLSAV,$buf,1024); 
+  $hash->{"+meta"}->{t_date} = r_string();
+  $hash->{"+meta"}->{t_user} = r_string();
+  $hash->{"+meta"}->{t_host} = r_string();
+
+  return 1;
+}
+
+
+
+##############################
+# r_version
+#
+# VERSION record handler
+#
+sub r_v {
+  my $hash = shift;
+  my $buf;
+  my $version;
+
+  sysread(IDLSAV,$buf,4);
+  $version = $hash->{"+meta"}->{v_fmt} = unpack "N",$buf;
+
+#  barf("Unknown IDL save file version ".$version)
+  print STDERR "Warning: IDL file is v$version (neither 5 nor 6); winging it. Check results!\n"
+    if($version != 5 && $version != 6);
+
+  $hash->{"+meta"}->{v_arch} = r_string();
+  $hash->{"+meta"}->{v_os} = r_string();
+  $hash->{"+meta"}->{v_release} = r_string();
+  return 1;
+}
+
+##############################
+# r_p64
+sub r_p64 {
+  my $hash = shift;
+  $p64 = 1;
+}
+
+##############################
+# r_var
+#
+# VARIABLE reader - parse a single variable out of a VARIABLE record.
+#
+
+sub r_var {
+  my $hash = shift;
+
+  ### Read in the variable name 
+  my $name = r_string();
+
+
+  ### Read in and parse the type 
+
+  my $buf;
+  sysread(IDLSAV,$buf,8);
+  my ($type,$flags) = unpack "NN",$buf;
+
+  unless(defined $vtypes->[$type]) {
+      barf("PDL::IO::IDL: Unknown variable type $type");
+  }
+  
+  unless(defined $vtypes->[$type]->[1]) {
+      print STDERR "Ignoring variable $name: unsupported type ".$vtypes->[$type]->[0]."\n";
+      return 1;
+  }
+
+  print "Variable $name found (flags is $flags)...\n" if($PDL::debug);
+  
+  if((($flags & 4) == 0)  and  (($flags & 32) == 0)) {
+      print "it's a scalar\n" if($PDL::debug);
+
+
+      sysread(IDLSAV,$buf,4);
+      my($seven) = unpack "N",$buf;
+      if($seven != 7) {
+	print STDERR "Warning: expected data-start key (7) but got $seven, for variable $name\n";
+      }
+      
+      ## Scalar case
+      $hash->{$name} = 
+	  &{$vtypes->[$type]->[1]}
+              ($flags, [],   @{$vtypes->[$type]->[2]})
+  } else {
+      ## Array case
+
+      my($arrdesc) = r_arraydesc();
+
+      if(($flags & 32) == 0) {
+	
+	  ## Simple array case
+	sysread(IDLSAV,$buf,4);
+	my($indicator) = unpack "N",$buf;
+
+	print STDERR "Warning: Reading data from an array but got code $indicator (expected 7)\n"
+	  if($indicator != 7);
+	  
+	  print "simple array...type=$type\n" if($PDL::debug);
+
+	my @args= ($flags,[ @{$arrdesc->{dims}}[0..$arrdesc->{ndims}-1]], 
+		   @{$vtypes->[$type]->[2]});
+	my $pdl =  &{$vtypes->[$type]->[1]}(@args);
+	$hash->{$name} = $pdl; 
+	
+      } else {
+
+	  ## Structure case
+	  print "structure...\n" if($PDL::debug);
+	  my($sname) = r_structdesc();
+
+	  my @structs;
+	  print "Reading $arrdesc->{nelem} structures....\n" if($PDL::debug || $PDL::IO::IDL::test);
+	  my $i;
+
+	  {my $buf; sysread(IDLSAV,$buf,4);}
+
+	  for ($i=0;$i<$arrdesc->{nelem};$i++) {
+	    if($PDL::IO::IDL::test && !($i%100)){
+	      print "$i of $arrdesc->{nelem}...\n";
+	    }
+	      
+  	    push(@structs,r_struct($sname));
+	  }
+
+	  # Make a multi-dimensional list that contains the structs
+	  $hash->{$name} = multi_dimify($arrdesc,\@structs);
+
+      }
+  }
+
+
+  return 1;
+}
+  
+
+##############################
+# multi_dimify 
+#
+# Take a linear list of items and an array descriptor, and 
+# hand back a multi-dimensional perl list with the correct dimension
+# according to the descriptor.  (This isn't necessary for PDL types,
+# only for structures and strings).
+#
+
+sub multi_dimify {
+
+    my($arrdesc,$structs,$n) = @_;
+
+    return shift @{$structs} 
+	if($arrdesc->{ndims} <= $n  or
+	   $arrdesc->{ndims} == 0 or
+	   $arrdesc->{ndims}-$n == 1 && $arrdesc->{dims}->[$n]==1);
+
+
+    if($arrdesc->{ndims} - $n == 1){
+      my @ret = splice @{$structs},0,$arrdesc->{dims}->[$n];
+      return \@ret;
+    }
+    
+
+    my $out = [];
+    my $i;
+    for ($i=0;$i<$arrdesc->{dims}->[$n];$i++) {
+	push(@{$out},multi_dimify($arrdesc,$structs,$n+1));
+    }
+
+    return $out;
+}
+
+
+
+######################################################################
+######################################################################
+
+
+#
+# r_arraydesc - read an array descriptor from the file 
+# 
+
+our $r_arraydesc_table = ['a','b','nbytes','nelem','ndims','c','d','nmax'];
+
+sub r_arraydesc {
+    my $out = {};
+    my $buf;
+
+    sysread(IDLSAV,$buf,4*8);
+    
+    my(@vals) = unpack("N"x8,$buf);
+    print STDERR "r_arraydesc_table: vals[0]=".$vals[0]." (should be 8)\n"
+      if($vals[0] != 8);
+    for my $i(0..7) {
+	$out->{$r_arraydesc_table->[$i]} = $vals[$i];
+    }
+    my $nmax = $vals[7];
+    my $nelem = $vals[3];
+
+    sysread(IDLSAV,$buf,$nmax*4);
+    $out->{dims} = [unpack("N"x$nmax,$buf)];
+    my $dims = pdl(@{$out->{dims}});
+
+    $out->{pdldims} = $dims;
+
+    print STDERR "PDL::IO::IDL: Inconsistent array dimensions in variable (nelem=$nelem, dims=".join("x",@{$out->{dims}}).")"
+	if($nelem != $dims->prod);
+    
+    $out;
+}
+
+
+##############################
+#
+# r_structdesc reads a structure description and stores it in the struct_table.
+# You get back the name of the structure.
+# 
+
+sub r_structdesc {
+    my $buf;
+
+    print "Reading a structure description...\n" if($PDL::IO::IDL::test);
+
+    sysread(IDLSAV,$buf,4);   # Discard initial long (value=9) from descriptor
+    my($name) = r_string(); # Have to store structures in the structure table.
+    $name =~ s/\s//g;
+    
+    $name = "+anon".scalar(keys %{$PDL::IO::IDL::struct_table})
+	if($name eq '');
+
+    sysread(IDLSAV,$buf,4*3);
+    my($predef,$ntags,$nbytes) = unpack("N"x3,$buf);
+    print "predef=$predef,ntags=$ntags,nbytes=$nbytes\n" if($PDL::debug);
+    if(!($predef & 1)) {
+	my $i;
+	print "not predefined. ntags=$ntags..\n" if($PDL::debug || $PDL::IO::IDL::test);
+
+	my $st = $PDL::IO::IDL::struct_table->{$name} = {
+	    "ntags" => $ntags 
+		,"nbytes"=> $nbytes
+		,"names" => []
+		,"arrays" => []
+		,"structs" => []
+	    };
+	
+	### Read tag descriptors.
+	sysread(IDLSAV,$buf,3*4*$ntags);
+	$st->{descrip} = [(unpack "N"x(3*$ntags), $buf)];
+
+	
+	print "ntags is $ntags\n" if($PDL::debug || $PDL::IO::IDL::test);
+	### Read tag names.
+	for $i(0..$ntags-1) {
+	    push(@{$st->{names}},r_string());
+	}
+	
+	### Search for nested arrays & structures
+	my ($nstructs,$narrays);
+
+	for $i(0..$ntags-1) {
+	    my $a = $st->{descrip}->[$i*3+2];
+
+	    $nstructs++ if($a & 32);
+	    $narrays++  if($a & 38);
+	}
+
+	print "narrays=$narrays\n" if($PDL::debug || $PDL::IO::IDL::test);
+	for $i(0..($narrays-1)) {
+	    push( @{$st->{arrays}}, r_arraydesc() );
+	}
+
+	print "nstructs=$nstructs\n" if($PDL::debug || $PDL::IO::IDL::test);
+	for $i(0..($nstructs-1)) {
+	    push( @{$st->{structs}}, r_structdesc() );
+	}
+
+    }
+    print "finished with structure desc...\n" if($PDL::IO::IDL::test);
+    return $name;
+}
+
+##############################
+#
+# r_struct
+#
+# Given the name of a structure type, read in exactly one of them.
+# If I were smarter, this would be the same code as the variable
+# reader, but I'm not so it's only similar.
+#
+our $r_struct_recursion = 0;
+
+sub r_struct {
+    my($sname) = shift;
+ 
+
+    print ("_ "x$r_struct_recursion) . "Reading a structure...\n" if($PDL::IO::IDL::test);
+    my $zz=$r_struct_recursion;
+    local($r_struct_recursion) = $zz++;
+
+    # Get the structure descriptor from the table.
+    my($sd) = $PDL::IO::IDL::struct_table->{$sname};
+    barf "Unknown structure type $sname" unless defined($sd);
+
+    # Initialize the structure itself and the array and structure indices.
+    my($struct) = {};
+    $struct->{'+name'} = $sname unless($sname =~ m/^\+/);
+
+    my($array_no, $struct_no);
+
+    # Loop over tags and snarf each one 
+    my($i);
+    for($i=0;$i<$sd->{ntags};$i++) {
+	my($name) = $sd->{names}->[$i];
+	
+	my($type) = $sd->{descrip}->[$i*3+1];
+	my($flags) = $sd->{descrip}->[$i*3+2];
+
+	print "reading tag #$i ($sd->{names}->[$i])\n" if($PDL::debug);
+
+	barf("PDL::IO::IDL: Unknown variable type $type in structure")
+	    unless defined($vtypes->[$type]);
+	
+	unless(defined($vtypes->[$type]->[1])) {
+	    print "Skipping tag $name in structure - unsupported type ".$vtypes->[$type]->[0]."\n";
+	    $array_no++ if($flags & 38);
+	    $struct_no++ if($flags & 32);
+
+	} else {
+
+	    if( (($flags & 4)==0) and (($flags & 32)==0) ) {
+		## Scalar tag case
+		$struct->{$name} = &{$vtypes->[$type]->[1]}
+		           ($flags, [],   @{$vtypes->[$type]->[2]});
+	    } else {
+
+		### Array and/or structure case ###
+
+		my($arrdesc) = $sd->{arrays}->[$array_no++];
+#		sysread(IDLSAV,my $buf,4); # skip indicator
+		
+		if(($flags & 32) == 0) {
+
+		    ### Tag is a simple array ###
+
+		    my @args = ($flags,[ @{$arrdesc->{dims}}[0..$arrdesc->{ndims}-1]],
+				@{$vtypes->[$type]->[2]});
+		    my $pdl = &{$vtypes->[$type]->[1]}(@args);
+		    print "  pdl is $pdl\n" if($PDL::debug);
+		    $struct->{$name} = $pdl;
+
+		} else {
+
+		    ### Tag is a structure ###
+		    
+		    my $tsname = $sd->{structs}->[$struct_no++];
+		    my @structs = ();
+		    for $i(1..$arrdesc->{nelem}) {
+			push(@structs,r_struct($tsname));
+		    }
+
+		    $struct->{$name} = multi_dimify($arrdesc,\@structs);
+
+		}
+	    }
+	}
+    } # end of ntags loop
+
+    return $struct;
+}
+		
+    
+    
+
+##############################
+#
+# r_string
+#
+# Reads a string value, leaving the file pointer correctly aligned
+# on a 32-bit boundary (if it started that way).  Returns the string as
+# a perl scalar.
+#
+sub r_string{
+  my ($buf,$foo);
+  sysread(IDLSAV, $buf, 4);  # Read the length...
+
+  my ($len) = unpack "N",$buf;
+  # Pad the length out to the next 32-bit boundary
+
+  my $plen =  $len - ($len % -4) ;
+
+  sysread(IDLSAV,$buf,$plen);
+  return unpack "A$len",$buf;
+}
+
+
+##############################
+#
+# r_strvar 
+#
+# Reads a string variable (different than r_string because 
+# of the extra length duplication in the IDL file...)
+#
+sub r_strvar {
+    my $buf;
+    my $flags = shift;
+    sysread(IDLSAV,$buf,4);
+    return r_string();
+}
+
+##############################
+#
+# r_byte_pdl
+#
+# Reads a byte PDL (stored as a strvar)
+#
+sub r_byte_pdl {
+  my($flags,$dims) = @_;
+
+  sysread(IDLSAV,my $buf,4)
+    if($#$dims > 1);
+
+  $a = r_string();
+
+  my $pdl = new PDL;
+  $pdl->set_datatype(byte->enum);
+  $pdl->setdims($dims);
+  ${ $pdl->get_dataref() } = $a;
+  $pdl->upd_data;
+
+  $pdl;
+}
+
+##############################
+#
+# r_n_pdl
+#
+# Reads <n> normal integer-type numerical values as a pdl.
+# You feed in the dimlist and type, you get back the 
+# final pdl.  The read is padded to the nearest word boundary.
+#
+
+sub r_n_pdl {
+    my($flags,$dims,$type) = @_;
+    
+    my $nelem = pdl($dims)->prod;
+    my $dsize = PDL::Core::howbig($type);
+    my $hunksize = $dsize * $nelem;
+
+    my $pdl = PDL->new_from_specification($type,@$dims);
+    my $dref = $pdl->get_dataref();
+    
+    my $len = sysread(IDLSAV, $$dref, $hunksize - ($hunksize % -4) );
+    $pdl->upd_data;
+    
+    print "bytes were ",join(",",unpack "C"x($hunksize-($hunksize%-4)),$$dref),"\n" if($PDL::debug);
+    
+    
+    if($swab) {
+	bswap2($pdl) if($dsize==2);
+	bswap4($pdl) if($dsize==4);
+	bswap8($pdl) if($dsize==8);
+    }
+
+    $pdl;
+}
+
+sub r_n_cast {
+    my($flags,$dims,$type1,$type2) = @_;
+
+    (r_n_pdl($flags,$dims,$type1))->convert($type2);
+}
+
+
+=head1 AUTHOR, LICENSE, NO WARRANTY
+
+THIS CODE IS PROVIDED WITH NO WARRANTY and may be distributed and/or
+modified under the same terms as PDL itself.
+
+This code is based on the analysis of the IDL save file format
+published by Craig Markwardt in 2002. 
+
+IDL is a trademark of Research Systems Incorporated (RSI).  The PDL
+development team, and authors of this code, are not affiliated with RSI.
+
+=cut
+
+1;
@@ -0,0 +1,14 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+     NAME => "PDL::IO::IDL",
+     'VERSION_FROM' => '../../Basic/Core/Version.pm',
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
+);
+
+# With dmake a postamble is sometimes (incorrectly) written
+# in the Makefile. The following prevents that:
+
+sub MY::postamble {
+    return "";
+}
@@ -1,13 +1,56 @@
-5-May-2005
-
-Some time ago, I wrote a PDL::IO::IDL module and uplinked it to CVS.
-Due to administrative hassles with my company, I was forced to not
-release a final version of the code. At their request, I have removed
-IDL.pm from this directory.  The in-progress code is still present in
-the CVS attic at Sourceforge.net, together with the reverse-engineered
-specification published by Craig Markwardt.  If you have not signed
-the IDL license agreement, please feel free to examine the file
-specification and the prototype code in the attic, fix them up, and
-add them back in.
-
-Craig DeForest
+IDL has updated their status to allow reading of IDL SAV data
+files from other languages.  This implementation is based on
+a 3rd party spec by Craig Markwardt based on the IDL 4.x and 5.x
+save files.  It cannot read save files created by IDL 8.x.
+
++------------------------------------------------------------------+
+
+From Joe Hourcle, who worked to get permission to distribute
+this code:
+
+
+In January of 2011, our group had a meeting with our NASA account
+rep, Amanda O'Connor. I brought up that they had announced at
+the IDL User Meeting at either the 2009 or 2010 Fall AGU Meeting
+that there was now a python library to read IDL save files, and I
+asked what was the process to be allowed to read them from Perl.
+
+This was the response that I received. ...
+
+-Joe
+
+
+Begin forwarded message:
+
+> From: "Thomas Harris" <tharris@ittvis.com>
+> Date: February 3, 2011 12:29:18 PM EST
+> To: <oneiros@grace.nascom.nasa.gov>, ...
+> Cc: "Amanda O'Connor" <amandao@ittvis.com>
+> Subject: FW: ITT-VIS meeting Follow-up
+>
+> Hi all:
+> My name is Thomas Harris and I'm working with Amanda this year on NASA.
+> Amanda and I checked in to your questions regarding IDL SAV files with
+> our Product Management.  Here is their response:
+>
+> "...We are perfectly fine with people wanting to read IDL save files
+> with Data in them, in whatever language they want - IDL, Matlab, Perl,
+> Python.
+>
+> Finally, we are going to remove the Copyright restriction from data Save
+> files (probably in IDL 8.1), but keep it in for code Save files. That
+> way there should be no confusion."
+>
+> Let me know if you have any additional questions.
+> Best regards,
+>
+> Thomas Harris
+> Technical Account Manager - Federal Sales
+> ITT Visual Information Solutions
+>
+> tharris@ittvis.com
+> direct: 303.402.4666
+> tel: 303.786.9900
+> mobile: 720.256.1098
+> fax: 303.786.9909
+> www.ittvis.com
@@ -49,7 +49,8 @@ use PDL::DiskCache, which can use any desired IO read/write functionality
 =item * General Data Storage Formats
 
 PDL has a number of modules that interface general data storage libraries.
-They include PDL::IO::HDF and PDL::IO::NDF.  There is a PDL::IO::IDL,
+They include PDL::IO::HDF and PDL::IO::NDF (the latter is now a separate
+CPAN module).  There is a PDL::IO::IDL,
 though at the moment it is not distributed with PDL.  PDL::IO::FITS is
 something of a general data format, since piddle data can be stored to a
 FITS file without loss.  PDL::IO::FlexRaw and PDL::IO::FastRaw read and
@@ -3,7 +3,7 @@ PDL::Core::Dev->import();
 
 # do we build PDL::IO::Browser ?
 #
-my @dirs = qw( FastRaw Misc FlexRaw Pnm NDF Storable FITS HDF GD Dicom );
+my @dirs = qw( FastRaw Misc FlexRaw Pnm Storable FITS HDF GD Dicom IDL );
 my $build_browser = $PDL::Config{WITH_IO_BROWSER} || 0;
 if ( $build_browser and ($^O !~ /win32/i) ) {
    push @dirs, 'Browser';
@@ -24,4 +24,5 @@ WriteMakefile(
                     'IO.pod' => '$(INST_LIB)/PDL/IO.pod',
                    },
      'DIR'      => [ @dirs ],
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
@@ -544,6 +544,9 @@ RCOLS_IO: {
       $index++;
       my @v = defined($usecolsep) ? split($usecolsep,$fhline) : split(' ',$fhline);
 
+      # map empty fields '' to undef value
+      @v = map { $_ eq '' ? undef : $_ } @v;
+
       # if the first line, set up the output piddles using all the columns
       # if the user doesn't specify anything
       if ( $index == 0 ) {
@@ -1,21 +0,0 @@
-use ExtUtils::MakeMaker;
-
-# # See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# # the contents of the Makefile that is written.
-
-WriteMakefile(
-	      NAME => 'PDL::IO::NDF',
-	      PM  => { 'NDF.pm' => '$(INST_LIBDIR)/NDF.pm' },
-#     'VERSION_FROM' => 'NDF.pm',
-	      clean => { FILES => 'NDF.pm' },
-);
-
-# try and get NDF.pm to be re-created if Basic/Core/badsupport.p is changed
-#
-sub MY::postamble {
-"NDF.pm :: NDF.pm.PL ../../Basic/Core/badsupport.p
-\t\$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) NDF.pm.PL NDF.pm
-
-";
-}
-
@@ -1,1634 +0,0 @@
-# -*-perl-*-
-#
-# The contents depend on whether we have bad-value support in PDL.
-# (there's only a small amount of code that uses bad values)
-#
-# - this is called by Makefile.PL to ensure the file exists 
-#   when the makefile is written
-#
-
-use strict;
-
-use Config;
-use File::Basename qw(&basename &dirname);
-
-# check for bad value support
-use vars qw( $bvalflag $usenan );
-use File::Spec;
-require File::Spec->catfile( File::Spec->updir, File::Spec->updir, "Basic", "Core", "badsupport.p" );
-
-# This forces PL files to create target in same directory as PL file.
-# This is so that make depend always knows where to find PL derivatives.
-chdir(dirname($0));
-my $file;
-($file = basename($0)) =~ s/\.PL$//;
-$file =~ s/\.pl$//
-        if ($Config{'osname'} eq 'VMS' or
-            $Config{'osname'} eq 'OS2');  # "case-forgiving"
-
-if ( $bvalflag ) {
-    print "Extracting $file (WITH bad value support)\n";
-} else {
-    print "Extracting $file (NO bad value support)\n";
-}
-
-open OUT,">$file" or die "Can't create $file: $!";
-chmod 0644, $file;
-
-#########################################################
-
-print OUT <<"!WITH!SUBS!";
- 
-# This file is automatically created by NDF.pm.PL
-# - bad value support = $bvalflag
-!WITH!SUBS!
-
-print OUT <<'!NO!SUBS!';
-
-package PDL::IO::NDF;
-
-=head1 NAME
-
-PDL::IO::NDF - PDL Module for reading and writing Starlink
-N-dimensional data structures as PDLs.
-
-=head1 SYNOPSIS
-
- use PDL::IO::NDF;
-
- $a = PDL->rndf($file);
-
- $a = rndf('test_image');
- $a = rndf('test_image', 1);
-
- $a->wndf($file);
- wndf($a, 'out_image');
-
- propndfx($a, 'template', 'out_image');
-
-=head1 DESCRIPTION
-
-This module adds the ability to read and write Starlink N-dimensional data
-files as N-dimensional PDLs.
-
-You must have the Starlink NDF library installed to use it.  The library
-is distributed under the GPL and is available from "http://www.starlink.ac.uk".
-
-=head1 FUNCTIONS
-
-=cut
-
-@EXPORT_OK = qw/rndf wndf/;
-%EXPORT_TAGS = (Func=>[@EXPORT_OK]);
-
-@ISA    = qw( PDL::Exporter );
-
-use PDL::Core;
-use PDL::Types;
-use Carp;
-use strict;
-
-# Starlink data type conversion
-use vars qw/%pdltypes %startypes $ndf_loaded $VERSION $EXTNAME/;
-
-$VERSION = '1.03';
-
-# Set PDL -> Starlink data types
-%pdltypes = ("$PDL_B"  => "_UBYTE",     # was "_BYTE"
-	     "$PDL_S"  => "_WORD",
-	     "$PDL_US" => "_UWORD",
-	     "$PDL_L"  => "_INTEGER",
-	     "$PDL_F"  => "_REAL",
-	     "$PDL_D"  => "_DOUBLE"
-	    );
-
-# Set Starlink -> PDL data types
-%startypes = ("_BYTE"    =>$PDL_B,
-	      "_UBYTE"   =>$PDL_B,
-	      "_WORD"    =>$PDL_S,
-	      "_UWORD"   =>$PDL_US,
-	      "_INTEGER" =>$PDL_L,
-	      "_REAL"    =>$PDL_F,
-	      "_DOUBLE"  =>$PDL_D
-	     );
-
-# This is the name I use in the PDL header hash that contains the
-# NDF extensions so that they can be recreated
-
-$EXTNAME = 'NDF_EXT';
-
-# load NDF library
-sub _init_NDF {
-    return if $ndf_loaded++; # a bit pointless increasing each time?
-    # Sometimes $@ can give the wrong answer for test. Be explicit.
-    my $retval = eval 'use NDF; 1;';
-    croak "Cannot use NDF library: $@" if $retval != 1;
-}
-
-!NO!SUBS!
-
-    if ( $bvalflag ) {
-	print OUT <<'!NO!SUBS!';
-
-use PDL::Bad;
-
-# internal functions for checking bad values
-
-my $starbad = 0;  # flag
-
-use vars qw( @starbad );
-
-sub _init_starbad {
-    return if $starbad;
-    _init_NDF();  # just to be safe
-    @starbad = eval 
-          "( &NDF::VAL__BADUB,
-	     &NDF::VAL__BADW,
-	     &NDF::VAL__BADUW,
-	     &NDF::VAL__BADI,
-	     &NDF::VAL__BADF,
-	     &NDF::VAL__BADD );
-";
-    croak 'Unable to initialise bad values from NDF library' if $@ ne "";
-    $starbad = 1;
-}
-
-sub starlink_bad_value ($) { 
-    _init_starbad();
-    return $starbad[$_[0]]; 
-}
-
-# given a piddle, check if the Starlink bad value matches
-# the bad value used for this type
-sub compare_bad_values ($) { 
-    _init_starbad();
-    return ($starbad[$_[0]] == badvalue($_[0])); 
-}
-
-!NO!SUBS!
-
-} # if: $bvalflag
-
-print OUT <<'!NO!SUBS!';
-
-=head2 rndf()
-
-=for ref
-
-Reads a piddle from a NDF format data file.
-
-=for example
-
- $pdl = rndf('file.sdf');
- $pdl = rndf('file.sdf',1);
-
-The '.sdf' suffix is optional. The optional second argument turns off
-automatic quality masking and returns a quality array as well.
-
-BUG? C<rndf('bob.sdf',1)> calls ndf_sqmf(1,...), which means that
-the quality array is turned into bad pixels - ie the I<opposite> of
-above. Or am I confused?
-
-Header information and NDF Extensions are stored in the piddle as a hash
-which can be retreived with the C<$pdl-E<gt>gethdr> command.
-Array extensions are stored in the header as follows:
-
- $a - the base DATA_ARRAY
-
-If C<$hdr = $a-E<gt>gethdr>;
-
-then:
-
- %{$hdr}        contains all the FITS headers plus:
- $$hdr{Error}   contains the Error/Variance PDL
- $$hdr{Quality} The quality byte array (if reqeusted)
- @{$$hdr{Axis}} Is an array of piddles containing the information
-                for axis 0, 1, etc.
- $$hdr{NDF_EXT} Contains all the NDF extensions
- $$hdr{Hist}    Contains the history information
- $$hdr{NDF_EXT}{_TYPES}
-                Data types for non-PDL NDF extensions so that
-                wndf can reconstruct a NDF.
-
-All extension information is stored in the header hash array.
-Extension structures are preserved in hashes, so that the PROJ_PARS
-component of the IRAS.ASTROMETRY extension is stored in
-C<$$hdr{NDF_EXT}{IRAS}{ASTROMETRY}{'PROJ_PARS'}>. All array structures are
-stored as arrays in the Hdr: numeric arrays are stored as PDLs,
-logical and character arrays are stored as plain Perl arrays. FITS
-arrays are a special case and are expanded as scalars into the header.
-
-PDL does not have a signed byte datatype, so any '_BYTE' data
-is read into a C<byte> (unsigned) piddle and a warning is printed
-to C<STDOUT>.
-
-=cut
-
-!NO!SUBS!
-
-    if ( $bvalflag ) {
-	print OUT <<'!NO!SUBS!';
-=for bad
-
-If the starlink bad flag is set, then the bad flag on the output
-piddle is also set.  Starlink bad values are converted to the
-current bad value used by the piddle type (if they are different).
-
-=cut
-
-!NO!SUBS!
-} # if: $bvalflag
-
-print OUT <<'!NO!SUBS!';
-# This is one form of the new command
-
-sub rndf {PDL->rndf(@_)}
-
-# And this is the real form
-# Allows the command to be called in OO form or as a function
-sub PDL::rndf {  # Read a piddle from a NDF file
-
-  my $class = shift;
-  barf 'Usage: $a = rndf($file,[$nomask]); $a = PDL->rndf(...) '
-    if ($#_!=0 && $#_!=1);
-
-  # ensure we have the NDF module
-  _init_NDF();
-
-  # Setup the Header Hash
-  my $header = {};
-
-  # Read in the filename
-  # And setup the new PDL
-  my $file = shift; 
-  my $pdl = $class->new;
-  my $nomask = shift if $#_ > -1;
-
-  my ($infile, $status, $indf, $entry, @info, $value);
-
-  # Strip trailing .sdf if one is present
-  # remove the trailing extension names
-  # (anything after a `.' UNLESS it's part of a directory
-  # name, hence the check for ^/) and any trailing (...)
-  # specifier (NDF sections, a la PDL slices)
-  #
-  $file =~ s/\.sdf$//;
-
-  $infile = $file;
-  $infile =~ s!\.[^/]*$!!;
-  $infile =~ s/\(.*\)$//;
-
-  # If file is not there
-  croak "Cannot find $infile.sdf" unless -e "$infile.sdf";
-
-  # Set status
-  $status = &NDF::SAI__OK;
-
-  # Begin NDF and ERR session
-  err_begin($status);
-  ndf_begin();
-
-  # Open the file
-  ndf_find(&NDF::DAT__ROOT, $file, $indf, $status);
-
-  # unset automatic quality masking if $nomask is defined
-  # I think the logic here is wrong (ie 0 and 1 should be swapped)
-  $nomask = 0 unless (defined $nomask);
-  $nomask = 1 if $nomask != 0;
-  ndf_sqmf($nomask, $indf, $status);
-
-  # Read the data array (need to pass the header as well)
-  my $badflag;
-  ( $status, $badflag ) = rdata($indf, $pdl, $nomask, $header, $class, $status);
-
-  # Read the axes
-  raxes($indf, $pdl, $header, $class, $status);
-
-  # Read the header
-  rhdr($indf, $pdl, $header, $class, $status);
-
-  # Read history information
-  rhist($indf, $pdl, $header, $status);
-
-  # Read labels
-  @info = ('Label', 'Title', 'Units');
-  for $entry (@info) {
-    $value = 'NULL';
-    ndf_cget($indf, $entry, $value, $status);
-    $$header{"$entry"} = $value if $value ne 'NULL';
-    print "$entry is $value\n" if ($PDL::verbose && $value ne 'NULL');
-    undef $value;
-  }
-
-  # Tidy up
-  ndf_annul($indf, $status);
-  ndf_end($status);
-
-  if ($status != &NDF::SAI__OK) {
-    err_flush($status);         # Flush the error system
-    err_end($status);
-    croak("rndf: obtained NDF error");
-  }
-
-  err_end($status);
-
-  # Put the header into the main pdl
-  $pdl->sethdr($header);
-
-!NO!SUBS!
-
-    if ( $bvalflag ) {
-	print OUT <<'!NO!SUBS!';
-  # set the bad flag if it was set in the input file
-  print "Bad flag status is: $badflag\n" if $PDL::verbose;
-  $pdl->badflag(1) if $badflag;
-
-!NO!SUBS!
-
-} # if; $bvalflag
-
-  print OUT <<'!NO!SUBS!';
-  return $pdl;
-}
-
-=head2 wndf()
-
-=for ref
-
-Writes a piddle to a NDF format file:
-
-=for example
-
-   $pdl->wndf($file);
-   wndf($pdl,$file);
-
-wndf can be used for writing PDLs to NDF files. 
-The '.sdf' suffix is optional. All the extensions
-created by rndf are supported by wndf.  This means that error, axis
-and quality arrays will be written if they exist. Extensions are also
-reconstructed by using their name (ie FIGARO.TEST would be expanded as
-a FIGARO extension and a TEST component). Hdr keywords Label, Title
-and Units are treated as special cases and are written to the label,
-title and units fields of the NDF.
-
-Header information is written to corresponding NDF extensions.
-NDF extensions can also be created in the {NDF} hash by using a key
-containing '.', ie {NDF}{'IRAS.DATA'} would write the information to
-an IRAS.DATA extension in the NDF. rndf stores this as
-C<$$hdr{NDF}{IRAS}{DATA}> and the two systems are interchangeable.
-
-rndf stores type information in {NDF}{'_TYPES'} and below so that
-wndf can reconstruct the data type of non-PDL extensions. If no
-entry exists in _TYPES, wndf chooses between characters, integer and
-double on a best guess basis.  Any perl arrays are written as CHAR
-array extensions (on the assumption that numeric arrays will exist as
-PDLs).
-
-=cut
-
-!NO!SUBS!
-
-    if ( $bvalflag ) {
-	print OUT <<'!NO!SUBS!';
-=for bad
-
-The bad flag is written to the file, if set.
-
-=cut
-
-!NO!SUBS!
-
-} # if: $bvalflag
-
-print OUT<<'!NO!SUBS!';
-# This is one form of the new command
-# OO version.
-
-*wndf = \&PDL::wndf;
-
-# And this is the real form
-# Allows the command to be called in OO form or as a function
-sub PDL::wndf {  # Write a PDL to an NDF format file
-
-  barf 'Usage: wndf($pdl,$file)' if $#_!=1;
-
-  # ensure we have the NDF module
-  _init_NDF();
-
-  my ($indf, $place, $status, $outndf);
-  my (@lbnd, @ubnd);
-
-  my ($pdl, $outfile) = @_;
-
-  # Check that we are dealing with a PDL
-  croak 'Argument is not a PDL variable' unless $pdl->isa('PDL');
-
-  # Set status
-  $status = &NDF::SAI__OK;
-
-  # Strip trailing .sdf if one is present
-  $outfile =~ s/\.sdf$//;
-
-  # Begin context
-  ndf_begin();
-  err_begin($status);
-
-  # Open the new file
-  ndf_place(&NDF::DAT__ROOT(), $outfile, $place, $status);
-
-  # Need to create data_array component
-  # Change the bounds to match the PDL
-
-  @ubnd = $pdl->dims;
-  @lbnd = ();
-  @lbnd = map { 1 } (0..$#ubnd);
-
-  ndf_new($pdltypes{$pdl->get_datatype}, $#ubnd+1, \@lbnd, \@ubnd, $place,
-          $outndf, $status);
-
-  # Set the application name
-  ndf_happn('PDL::wndf', $status);
-
-  # Write the data to this file
-  wdata($outndf, $pdl, $status);
-
-  # Write the header and title
-  whdr($outndf, $pdl, $status);
-
-  # Create a history extension
-  ndf_hcre($outndf, $status);
-
-  # Annul the identifier
-  ndf_annul($outndf, $status);
-
-  # End context
-  ndf_end($status);
-
-  if ($status != &NDF::SAI__OK) {
-    err_flush($status);
-    croak "Bad STATUS in wndf\n";
-  }
-
-  err_end($status);
-
-  return 1;
-}
-
-=head2 propndfx()
-
-Routine to write a PDL to an NDF by copying the extension information
-from an existing NDF and writing DATA,VARIANCE, QUALITY and AXIS info
-from a PDL (if they exist).
-
-Extensions, labels and history are propogated from the old NDF.
-No new extension information is written.
-
-This command has been superseded by L<wndf()|/wndf()>.
-
-=cut
-
-*propndfx = \&PDL::propndfx;
-
-sub PDL::propndfx {  # Write a PDL to a NDF format file
-
-  barf 'Usage: propndfx($pdl, $infile, $outfile)' if $#_!=2;
-
-  # ensure we have the NDF module
-  _init_NDF();
-
-  my ($indf, $in_place, $status, $outplace, $outndf);
-
-  my ($pdl, $infile, $outfile) = @_;
-
-  # Set status
-  $status = &NDF::SAI__OK;
-
-  # Strip trailing .sdf if one is present
-  $outfile =~ s/\.sdf$//;
-  $infile =~ s/\.sdf$//;
-  # File is the first thing before a .
-  my $file = (split(/\./,$infile))[0];
-
-  croak "$file does not exist\n" unless -e "$file.sdf";
-
-  # Begin context
-  ndf_begin();
-  err_begin($status);
-
-  # Open the old file
-  ndf_find(&NDF::DAT__ROOT(), $infile, $indf, $status);
-
-  # Set the application name
-  ndf_happn('PDL::propndfx', $status);
-
-  # Open the new file
-  ndf_place(&NDF::DAT__ROOT(), $outfile, $outplace, $status);
-
-  # Copy the extension information to outfile
-  ndf_scopy($indf, ' ', $outplace, $outndf, $status);
-
-  # Annul the input file identifier
-  ndf_annul($indf, $status);
-
-  # Write the data to this file
-  wdata($outndf, $pdl, $status);
-
-  # Annul the identifier
-  ndf_annul($outndf, $status);
-
-  # End context
-  ndf_end($status);
-
-  if ($status != &NDF::SAI__OK) {
-    err_flush($status);
-    croak "Bad STATUS in propndfx\n";
-  }
-
-  err_end($status);
-
-  return 1;
-}
-
-=head1 NOTES
-
-The perl NDF module must be available. This is available from the 
-author or from Starlink (http://www.starlink.rl.ac.uk).
-
-If an NDF is read which contains AST World Coordinate information
-(a .WCS component) this information is currently ignored. Currently
-WCS information can only be written and stored using standard FITS headers.
-See L<http://rlspc5.bnsc.rl.ac.uk/star/docs/sun211.htx/sun211.html#xref_>
-for more information on AST.
-
-=head1 AUTHOR
-
-This module was written by Tim Jenness E<lt>t.jenness@jach.hawaii.eduE<gt>.
-Copyright (C) Tim Jenness 1997-2000. All Rights Reserved.
-
-=head1 SEE ALSO
-
-L<PDL::FAQ> for general information on the Perl Data language,
-L<NDF> for information on the NDF module.
-
-=cut
-
-
-#######################################################################
-
-# These are the generic routines used by the rndf command
-
-#  RDATA
-#    Read Data, Quality and Variance
-
-# returns ( $status, $badflag ), where $badflag is:
-#
-#   1 - the piddle may contain bad data
-#   0 - the piddle contains no bad data
-#
-# This reports starlink's bad-data flag (ie it's valid
-# even in bad value support is not available in PDL)
-#
-sub rdata {
-  my ($indf, $pdl, $nomask, $header, $class, $status) = @_;
-
-  return ( $status, undef ) if $status != &NDF::SAI__OK;
-
-  my ($maxdims, $ndim, @dim, @comps, $dcomp, $tcomp, $exist);
-  my ($type, $data_pntr, $el, $temppdl, $nbytes, $badbit, $dref);
-
-  ####################################################################
-  #                      D  I  M  S                                  #
-  ####################################################################
-
-  # Find the dimensions of the data array
-  $maxdims = 100;		# Maximum number of dimensions allowed
-
-  &ndf_dim($indf, $maxdims, \@dim, $ndim, $status);
-  @dim = @dim[0..$ndim-1];
-
-  print "Dims = @dim\n" if $PDL::verbose;
-
-  $$header{Extensions} = [];
-
-  ####################################################################
-  #    D A T A  +  V  A  R  I  A  N  C  E  +  Q U A L I T Y          #
-  ####################################################################
-
-  my $badflag = 0;
-
-  @comps = ('Data','Error');
-  push(@comps, 'Quality') if $nomask;
-
-  for $dcomp (@comps) {
-
-    $tcomp = $dcomp;
-    $tcomp = 'Variance' if $tcomp eq 'Error';
-
-    ndf_state($indf, $tcomp, $exist, $status);
-
-    if ($exist && ($status == &NDF::SAI__OK)) {
-
-      # Find the type of the data array
-      ndf_type($indf, $tcomp, $type, $status);
-
-      # Map the data array
-      ndf_map($indf, $dcomp, $type, 'READ', $data_pntr, $el, $status);
-
-      # Check the bad-data status of this component
-      my $this_badflag = 0;
-      my $ecomp = ( $dcomp =~ /Err/ ? "Variance" : $dcomp);
-      ndf_bad($indf, $ecomp, 0, $this_badflag, $status );
-
-      if ($status == &NDF::SAI__OK) {
-
-	print "Reading $dcomp array...\n" if $PDL::verbose;
-
-	# combine the bad data flag with the "global" one for
-	# the file
-	$badflag |= ($this_badflag != 0);
-
-	# Create a temporary PDL to deal with separate components
-	if ($dcomp eq 'Data') {
-	  $temppdl = $pdl;
-	} else {
-	  $dcomp = 'Errors' if $dcomp eq 'Error';
-	  $$header{"$dcomp"} = $class->new;
-	  $temppdl = $$header{"$dcomp"};
-	}
-
-	# Set up the PDL
-	$temppdl->set_datatype($startypes{$type});
-	$temppdl->setdims([@dim]);
-	$dref = $temppdl->get_dataref;
-
-	# warning about data loss
-	if ( $type eq "_BYTE" ) {
-	    print "Warning: NDF type (signed byte) converted to PDL's unsigned byte.\n";
-	}
-
-	# How many bytes in this data type?
-	$type =~ s/^_|^_U//;
-	$nbytes = &NDF::byte_size($type);
-
-	mem2string($data_pntr, $nbytes*$el, $$dref);
-
-	push(@{$$header{Extensions}}, $dcomp) if $dcomp ne 'Data';
-
-	if ($dcomp eq 'Quality') {
-	  # Quality bad bit mask
-	  ndf_bb($indf, $badbit, $status);
-
-	  my $qhdr = {};
-	  $$qhdr{BADBIT} = $badbit;
-	  $temppdl->sethdr($qhdr);
-	}
-
-!NO!SUBS!
-
-    if ( $bvalflag ) {
-	print OUT <<'!NO!SUBS!';
-	# if badflag is true, convert any STARLINK bad values
-	# to PDL values
-	if ( $badflag and 
-	     !compare_bad_values($temppdl->get_datatype) ) {
-	    my $star_bad = starlink_bad_value($temppdl->get_datatype);
-	    print "Converting from STARLINK bad value ($star_bad)...\n" if $PDL::verbose;
-	    $temppdl->inplace->setvaltobad( $star_bad );
-	}
-
-!NO!SUBS!
-
-} # if: $bvalflag
-
-print OUT <<'!NO!SUBS!';
-	# Flush and Clear temporary PDL
-	$temppdl->upd_data();
-	undef $temppdl;
-      }
-
-      ndf_unmap($indf, $tcomp, $status);
-    }
-  }
-  err_flush($status) if $status != &NDF::SAI__OK;
-
-  return ( $status, $badflag );
-}
-
-
-
-  ####################################################################
-  #                      A  X  I  S                                  #
-  ####################################################################
-
-# Axes are stored as follows:
-#  Array of PDL axes as an array in header of main pdl (called 'Axis')
-#  Header of this PDL contains label and errors and units etc.
-
-sub raxes {
-  my ($indf, $pdl, $header, $class, $status) = @_;
-
-  return $status if $status != &NDF::SAI__OK;
-
-  my ($there, $naxis, @dims, $axcomp, $exist, $axtype, $axpntr, $el);
-  my ($nbytes, $temppdl, $tcomp, $daxref, $dref);
-  my ($axhdr, $ndims);
-
-  # Read in axis information
-  ndf_state($indf, 'Axis', $there, $status);
-
-  $ndims = $pdl->getndims; # Find number of dimensions
-
-  if ($there) {
-
-    # Label from 0..$#dims to match array index handling
-    # Want to put the axes into an array of axes
-    # And update the extensions field
-    $$header{Axis} = [];
-    push(@{$$header{Extensions}}, "Axis");
-
-    for $naxis (0..$ndims-1) {
-      # Does a CENTRE component exist
-      $axcomp = 'CENTRE';
-      ndf_astat($indf, $axcomp, $naxis+1, $exist, $status);
-
-      if ($exist && ($status == &NDF::SAI__OK)) {
-
-	print "Reading Axis $naxis...\n" if $PDL::verbose;
-	ndf_atype($indf, $axcomp, $naxis+1, $axtype, $status);
-
-	ndf_amap($indf, $axcomp, $naxis+1, $axtype, 'READ', $axpntr,
-		 $el, $status);
-
-	# Set up new PDL for axis info if map was okay
-	if ($status == &NDF::SAI__OK) {
-	  print "Number of elements: $el\n" if $PDL::verbose;
-	  $$header{Axis}[$naxis] = $class->new;
-	  $temppdl = $$header{Axis}[$naxis];
-	  $temppdl->set_datatype($startypes{$axtype});
-	  $temppdl->setdims([$el]);
-	  $dref = $temppdl->get_dataref;
-
-
-	  # How many bytes?
-	  $axtype =~ s/^_|^_U//;
-	  $nbytes = &NDF::byte_size($axtype);
-
-	  mem2string($axpntr, $nbytes*$el, $$dref);
-	  $temppdl->upd_data();
-
-	  # Header info for axis
-	  $axhdr = {};   # somewhere to put the pdl
-
-	  # Read VARIANCE array if there
-	  $axcomp = 'Error';
-	  $tcomp = 'Variance';
-	  ndf_astat($indf, $tcomp, $naxis+1, $exist, $status);
-
-	  if ($exist && ($status == &NDF::SAI__OK)) {
-	    print "Reading Axis $naxis errors...\n" if $PDL::verbose;
-	    ndf_atype($indf, $tcomp, $naxis+1, $axtype, $status);
-
-	    ndf_amap($indf, $axcomp, $naxis+1, $axtype, 'READ', $axpntr,
-		     $el, $status);
-
-	    # Set up new PDL for axis info if map was okay
-	    if ($status == &NDF::SAI__OK) {
-
-	      $$axhdr{Errors} = $class->new;
-	      $$axhdr{Extensions} = ["Errors"];
-
-	      $$axhdr{Errors}->set_datatype($startypes{$axtype});
-	      $$axhdr{Errors}->setdims([$el]);
-	      $daxref = $$axhdr{Errors}->get_dataref;
-
-	      # How many bytes?
-	      $axtype =~ s/^_|^_U//;
-	      $nbytes = &NDF::byte_size($axtype);
-
-	      mem2string($axpntr, $nbytes*$el, $$daxref);
-	      $$axhdr{Errors}->upd_data();
-
-	    }
-	  }
-
-	  # Get label and units
-	  for my $entry ('Units', 'Label') {
-	    ndf_astat($indf, $entry, $naxis+1, $exist, $status);
-	    if ($exist) {
-	      my $value = '';
-	      ndf_acget($indf,$entry, $naxis+1, $value, $status);
-	      $axhdr->{"$entry"} = $value;
-	    }
-	  }
-	}
-	ndf_aunmp($indf,'*',$naxis+1,$status);
-
-	# Now store this header into temppdl
-	$temppdl->sethdr($axhdr);
-
-      } else {
-	err_annul($status) unless $status == &NDF::SAI__OK;
-      }
-
-    }
-
-  }
-
- return $status;
-}
-
-
-  ####################################################################
-  #                      E  X  T  E  N  S  I  O  N  S                #
-  ####################################################################
-
-sub rhdr {
-  my ($indf, $pdl, $header, $class, $status) = @_;
-
-  return $status if $status != &NDF::SAI__OK;
-
-  my ($nextn, $xname, $xloc, $extn, $size, @fits, $entry, $value);
-  my ($comment, $item, $el);
-
-  # Read in any header information from the extensions
-
-  ndf_xnumb($indf, $nextn, $status);
-  print "Reading in header information...\n"
-    if (($nextn > 0) && $PDL::verbose);
-
-  # Read in extensions one at a time
-  for $extn (1..$nextn) {
-
-    $xname = 'NULL';
-    ndf_xname($indf, $extn, $xname, $status);
-
-    undef $xloc;
-    ndf_xloc($indf, $xname, 'READ', $xloc, $status);
-
-    # FITS is a special case and must be expanded
-    if ($xname eq 'FITS') {
-      # Read in the data
-      dat_size($xloc, $size, $status);
-      &dat_getvc($xloc, $size, \@fits, $el, $status);
-
-      if ($status == &NDF::SAI__OK) {
-	print "Reading FITS header...\n" if $PDL::verbose;
-	for $entry (0..$el-1) {
-	  ($item, $value, $comment) = &fits_get_nth_item(\@fits,$entry);
-	  $$header{$item} = $value;
-	  $$header{'_COMMENTS'}{$item} = $comment;
-	}
-      } else {
-	print "Error mapping $xname\n";
-	err_annul($status);
-      }
-      undef @fits;
-    } else {
-
-      # Read in extensions to $EXTNAME
-      $status = &find_prim($xloc, \%{$$header{$EXTNAME}}, $class, $status);
-    }
-
-    dat_annul($xloc, $status);
-  }
-  return $status;
-}
-
-  ####################################################################
-  #                      H  I  S  T  O  R  Y                         #
-  ####################################################################
-
-sub rhist {
-  my ($indf, $pdl, $header, $status) = @_;
-
-  return $status if $status != &NDF::SAI__OK;
-
-  my ($nrec, $app, $date, $i);
-
-  # Read HISTORY information into a Hist header
-
-  ndf_hnrec($indf,$nrec,$status);
-
-  if ($status == &NDF::SAI__OK && ($nrec > 0)) {
-    print "Reading history information into 'Hist'...\n" if $PDL::verbose;
-
-    $$header{Hist}{'Nrecords'} = $nrec;
-
-    # Loop through the history components and find last "APPLICATION"
-    for $i (1..$nrec) {
-
-      ndf_hinfo($indf, 'APPLICATION', $i, $app, $status);
-      ndf_hinfo($indf, 'DATE', $i, $date, $status);
-
-      $$header{Hist}{"Application$i"} = $app;
-      $$header{Hist}{"Date$i"} = $date;
-
-      print "  $app on $date\n" if $PDL::verbose;
-    }
-  } else {
-    err_annul($status);
-  }
-  return $status;
-}
-
-
-
-################ Generic routines ###########################
-#################### INTERNAL ###############################
-
-# Find primitive components below a given HDS locator
-# FITS information is stored in Hdr
-# NDF extensions stored in NDF
-
-sub find_prim {
-
-  my ($loc, $href, $class, $status) = @_;
-  my ($prim, $type, $size, @dim, $ndims, $struct, $name, $nloc, $el);
-  my ($value, @values, $item, $entry, $maxdims);
-  my ($packtype, $ncomp, $packed, $comp);
-  my ($pntr, $nbytes, $comment, $dref);
-
-  # Return if bad status
-  return  0 if $status != &NDF::SAI__OK;
-
-  # Most dimensions
-  $maxdims = 100;
-
-  # Is it a primitive component
-  dat_prim($loc, $prim, $status);
-
-  # Type, size and shape
-  dat_type($loc, $type, $status);
-  dat_size($loc, $size, $status);
-  dat_shape($loc, $maxdims, \@dim, $ndims, $status);
-  dat_name($loc, $name, $status);
-
-  if ($prim) {
-    print "\tReading component: $name ($type) " if $PDL::verbose;
-
-    # Store type of information
-    $$href{"_TYPES"}{"$name"} = $type;
-
-    # Read it into the header
-    if (($size == 1) && ($ndims == 0)) {
-      if ($type  eq '_DOUBLE') {
-	# dat_get0c doesn't return full precision for doubles
-	dat_get0d($loc, $value, $status);
-	if ($status != &NDF::SAI__OK) {
-	  print "Error mapping scalar 0d $type $name\n";
-	  err_flush($status);
-	}
-
-      } else {
-	dat_get0c($loc, $value, $status);
-	if ($status != &NDF::SAI__OK) {
-	  print "Error mapping scalar 0c $name\n";
-	  err_flush($status);
-	}
-
-      }
-
-      $$href{"$name"} = $value if ($status == &NDF::SAI__OK);
-      undef $value;
-
-    } else {
-      @dim = @dim[0..$ndims-1];
-
-      # Inform the user of dimensions
-      print "[@dim]" if $PDL::verbose;
-
-      # Map arrays (don't need to unpack them)
-      if ($type =~ /CHAR|LOG/) {
-
-	# Read in the data
-	dat_getvc($loc, $size, \@values, $el, $status);
-
-	if ($status != &NDF::SAI__OK) {
-	  print "Error mapping $name\n";
-	} else {
-	  $$href{"$name"} = [@values];
-	  undef @values;
-	}
-
-      } else {
-
-	# map the data
-	dat_mapv($loc, $type, 'READ', $pntr, $el, $status);
-
-	if ($status != &NDF::SAI__OK) {
-	  print "Error mapping $name\n";
-	}
-
-
-	if ($status == &NDF::SAI__OK) {
-	  # Create the pdl
-	  $$href{"$name"} = $class->new;
-	  $$href{"$name"}->set_datatype($startypes{$type});
-	  $$href{"$name"}->setdims([@dim]);
-	  $dref = $$href{"$name"}->get_dataref();
-
-	  # How many bytes in this data type?
-	  $type =~ s/^_|^_U//;
-	  $nbytes = &NDF::byte_size($type);
-
-	  mem2string($pntr, $nbytes*$el, $$dref);
-	  $$href{"$name"}->upd_data();
-	}
-
-	dat_unmap($loc,$status);
-      }
-    }
-    print "\n" if $PDL::verbose;
-
-  } else {
-
-    my ($ndimx, @dim, $ndim);
-    dat_shape($loc, 20, \@dim, $ndim, $status);
-
-    # If we have a single dimension ($ndim=0) then
-    # proceed. Cant yet cope with multi-dimensional
-    # extensions
-    if ($ndim == 0) {
-      dat_ncomp($loc, $ncomp, $status);
-      print "$name ($type) has $ncomp components\n" if $PDL::verbose;
-
-      # Store type of extension
-      $$href{$name}{"_TYPES"}{STRUCT}{"$name"} = $type;
-
-      for $comp (1..$ncomp) {
-	dat_index($loc, $comp, $nloc, $status);
-	$status = &find_prim($nloc, \%{$$href{$name}}, $class, $status);
-	dat_annul($nloc, $status);
-      }
-    } else {
-      print "Extension $name is an array structure -- skipping\n"
-	if $PDL::verbose;
-    }
-
-  }
-  return $status;
-}
-
-
-###### Routines for WRITING data ######################################
-
-sub wdata {
-
-  my ($outndf, $pdl, $status) = @_;
-  my (@bounds, $ndims, @lower, @comps, $dcomp, $temppdl, $type);
-  my ($pntr, $el, $nbytes, $axis, $axcomp, $axpntr, %hdr, %axhdr);
-  my ($entry, $value, $i, $axndims, $axtype, $tcomp, @acomps);
-
-
-  # Return if bad status
-  return  0 if $status != &NDF::SAI__OK;
-
-  ####################################################################
-  #                      D  I  M  S                                  #
-  ####################################################################
-  # Change the bounds to match the PDL
-  @bounds = $pdl->dims;
-  $ndims = $#bounds;
-  @lower = map { 1 } (0..$ndims);
-
-  &ndf_sbnd($ndims+1, \@lower, \@bounds, $outndf, $status);
-
-
-  ####################################################################
-  #    D A T A  +  V  A  R  I  A  N  C  E  +  Q U A L I T Y          #
-  ####################################################################
-  # Map data, variance, quality...
-  @comps = ('Data','Errors','Quality');
-
-  # Retrieve header and check that the header is a hash ref
-  my $hdr = $pdl->gethdr;
-  if (ref($hdr) eq 'HASH') {
-    %hdr = %$hdr;
-  } else {
-    %hdr = ();
-  }
-
-  for $dcomp (@comps) {
-
-    if ($dcomp eq 'Data') {
-      $temppdl = $pdl;
-    } else {
-      if (exists $hdr{"$dcomp"}) {
-        $temppdl = $hdr{"$dcomp"};
-        # Check that we have a PDL
-        next unless UNIVERSAL::isa($temppdl, 'PDL');
-      } else {
-        next;			# Skip this component
-      }
-    }
-
-    # Check that we have some data
-    if ($temppdl->nelem > 0) {
-
-      if (($dcomp eq 'Quality') && ($temppdl->get_datatype != $PDL_B)) {
-        # Quality must be bytes so convert to BYTE if this is not true
-        $temppdl = byte ($$pdl{"$dcomp"});
-      }
-
-      $type = $pdltypes{$temppdl->get_datatype};
-      $type = '_UBYTE' if $dcomp eq 'Quality'; # No choice for QUALITY
-
-      # Set the output type of the NDF
-      $tcomp = $dcomp;
-      $tcomp = 'Variance' if $tcomp eq 'Errors';
-      ndf_stype($type, $outndf, $tcomp, $status) unless $dcomp eq 'Quality';
-
-      print "Mapping $dcomp , $type\n" if $PDL::verbose;
-      # Map NDF
-      $dcomp = 'Error' if $dcomp eq 'Errors';
-      ndf_map($outndf, $dcomp, $type, 'WRITE', $pntr, $el, $status);
-
-      if ($status == &NDF::SAI__OK) {
-        # Number of bytes per entry
-        $nbytes = PDL::Core::howbig($temppdl->get_datatype);
-
-        # Convert to 1D data stream
-        my $p1d = $temppdl->clump(-1);
-        # Total number of bytes
-        $nbytes *= $p1d->getdim(0);
-
-!NO!SUBS!
-
-    if ( $bvalflag ) {
-	print OUT <<'!NO!SUBS!';
-	# if badflag is true, convert any PDL bad values to STARLINK ones 
-	# note: we have to create a copy of the data to ensure that the
-	# bad data value of the original piddle does not get changed. 
-	# per-piddle bad values would obviate the need for this.
-	if ( $temppdl->badflag() ) {
-	    print "Setting bad flag for component $dcomp ...\n" if $PDL::verbose;
-	    ndf_sbad( 1, $outndf, $dcomp, $status );
-	    if ( !compare_bad_values($temppdl->get_datatype) ) {
-		my $star_bad = starlink_bad_value($temppdl->get_datatype);
-		print "Converting from PDL to STARLINK bad value ($star_bad)...\n" if $PDL::verbose;
-		$temppdl = $temppdl->setbadtoval( $star_bad ); # do NOT do inplace
-	    }
-	}
-
-!NO!SUBS!
-
-} # if: $bvalflag
-
-print OUT <<'!NO!SUBS!';
-        # Copy to disk
-        string2mem(${$temppdl->get_dataref}, $nbytes, $pntr);
-
-        # Write badbit mask
-        if ($dcomp eq 'Quality') {
-          ndf_sbb($$temppdl{Hdr}{BADBIT}, $outndf, $status)
-            if defined $$temppdl{Hdr}{BADBIT};
-        }
-      }
-      # Unmap Data
-      ndf_unmap($outndf, $tcomp, $status);
-
-    }
-
-    # free the temporary pdl
-    undef $temppdl;
-
-  }
-
-
-  ####################################################################
-  #                      A  X  I  S                                  #
-  ####################################################################
-  # A X I S information is expected as an array in the header
-  # called 'Axis'. These PDLs contain the CENTRE data and any further
-  # info is stored in their header.
-  # @bounds is accessed to find expected shape
-
-
-  # Simply look in the header for a Axis
-  if (exists $hdr{Axis}) {
-     # Check that we have an array
-     if (ref($hdr{Axis}) eq 'ARRAY') {
-       # Now loop over axes
-       for my $i (0..$#{$hdr{Axis}} ) {
-	 # Loop unless status is bad
-	 last unless $status == &NDF::SAI__OK;
-
-	 # Extract the ith axis PDL from the array
-         my $axis = $hdr{Axis}->[$i];
-
-         # If we have a PDL
-         if (UNIVERSAL::isa($axis, 'PDL')) {
-            # We now want to copy the data and if necessary the
-            # Error array. Since there are only two I will do it the
-            # long way by explcitly storing data and then error
-
-            # Set data type
-            $axtype = $pdltypes{$axis->get_datatype};
-            ndf_astyp($axtype, $outndf, 'Centre', $i+1, $status);
-
-            # Okay we can now map this pdl
-            ndf_amap($outndf, 'Centre', $i+1, $axtype, 'WRITE', $axpntr,
-                   $el, $status);
-
-            # Check that we have the correct number of entries
-	    my $nelem = $axis->nelem;
-            if ($el == $nelem) {
-	      print "Mapping axis " , $i+1 , "\n"  if $PDL::verbose;
-	    
-              # Number of bytes per entry
-              $nbytes = PDL::Core::howbig($axis->get_datatype) * $el;
-	    
-              # Copy to disk
-              string2mem( $ { $axis->get_dataref }, $nbytes, $axpntr)
-                 if ($status == &NDF::SAI__OK);
-
-            } else {
-              carp "Axis ",$i+1 .
-                   " is the wrong size ($el values required but got ".
-                   $nelem . ")- ignoring";
-            }
-            # Unmap
-            ndf_aunmp($outndf, '*', $i+1, $status);
-
-            # Errors
-            my $axhdr = $axis->gethdr; # Retrieve and check header
-            if (ref($axhdr) eq 'HASH') {
-              %axhdr = %$axhdr;
-            } else {
-              %axhdr = ();
-            }
-
-	    # Look for an Errors component in the header hash
-            if (exists $axhdr{Errors}) {
-               my $axerr = $axhdr{Errors};
-               if (UNIVERSAL::isa($axerr, 'PDL')) {
-
-                 # Set data type
-                 $axtype = $pdltypes{$axerr->get_datatype};
-                 ndf_astyp($axtype, $outndf, 'Variance', $i+1, $status);
-
-                 # Okay we can now map this pdl
-                 ndf_amap($outndf, 'Errors', $i+1, $axtype, 'WRITE',
-                   $axpntr, $el, $status);
-
-                 # Check that we have the correct number of entries
-		 my $nelem = $axerr->nelem;
-		 print "Nelem: $nelem and $el\n";
-                 if ($nelem == $el) {
-                   print "Mapping errors for axis " . $i+1 . "\n"
-                     if $PDL::verbose;
-
-                   # Number of bytes per entry
-                   $nbytes = PDL::Core::howbig($axerr->get_datatype) * $el;
-
-                   # Copy to disk
-                   string2mem($ {$axerr->get_dataref}, $nbytes, $axpntr)
-                     if ($status == &NDF::SAI__OK);
-
-                 } else {
-                    carp "Error PDL for Axis ",$i+1,
-                       " is the wrong size ($el values required but got ".
-                        $axerr->nelem . ")- ignoring";
-                 }
-                 # Unmap
-                 ndf_aunmp($outndf, '*', $i+1, $status);
-
-               }
-
-            }
-
-            # Now character components
-            foreach my $char (keys %axhdr) {
-              if ($char =~ /LABEL|UNITS/i) {
-                $value = $axhdr{"$char"};
-                ndf_acput($value, $outndf, $char, $i+1, $status)
-                  if length($value) > 0;
-              }
-
-            }
-
-         }
-
-       }
-
-     }
-
-  }
-
-}
-
-
-# Write header information to NDF extension
-# This routine does not reconstruct an NDF identically to one that
-# was read in. FITS extensions are made. All non-integer numeric types
-# are written as doubles (apart from PDLs which carry there own type
-# information) unless _TYPES information exists in {NDF}.
-
-
-sub whdr {
-
-  my ($outndf, $pdl, $status) = @_;
-
-  my (%header, @fitsdim, $fitsloc, $value);
-  my (%unused, @fits, $hashref, $hdr);
-
-  # Return if bad status
-  return 0 if $status != &NDF::SAI__OK;
-
-  print "Writing header information...\n" if $PDL::verbose;
-
-  # Write FITS header from {Hdr}
-
-  # Retrieve and check header from PDL
-  $hdr = $pdl->gethdr;
-  if (ref($hdr) eq 'HASH') {
-    %header = %$hdr;
-  } else {
-    %header = ();
-  }
-
-  %unused = ();
-  @fits = ();
-
-  foreach my $key (sort keys %header) {
-
-    next if $key eq '_COMMENTS';
-
-    if ($key =~ /^TITLE$|^UNITS$|^LABEL$/i) {
-      # This is not extension info
-      ndf_cput($header{$key}, $outndf, $key, $status)
-        if length($header{$key}) > 0;
-    }
-
-    # Only write scalars
-    if (not ref($header{"$key"})) {
-
-       push(@fits, fits_construct_string($key,$header{$key},
-            $header{'_COMMENTS'}{$key}) );
-
-    } else {
-      # Deal with later
-      $unused{$key} = $header{$key};
-    }
-
-  }
-
-  # Write the FITS extension
-  if ($#fits > -1) {
-    push(@fits, "END");
-    # Write it out
-    @fitsdim = ($#fits+1);
-    ndf_xnew($outndf, 'FITS', '_CHAR*80', 1, @fitsdim, $fitsloc, $status);
-    dat_put1c($fitsloc, $#fits+1, \@fits, $status);
-    dat_annul($fitsloc, $status);
-  }
-
-  # Loop through all NDF header info and array Hdr information
-  # Note that %unused still contains our NDF hash so
-  # we must remove that before proceeding (else we end up with
-  # an 'NDF_EXT' extension!
-
-  delete $unused{$EXTNAME};
-
-  foreach $hashref (\%unused, $header{$EXTNAME}) {
-     whash($hashref, $outndf, '', '', $status);
-  }
-}
-
-
-#-----------------------------------------------------
-# This routine writes a hash array to a NDF extension
-# Keys that have leading underscores are skipped
-# $hashname contains the extension name to use by default.
-# This is extended  by any '.' in the key.
-
-sub whash {
-
-  my ($hash, $outndf, $hashname, $stypes, $status) = @_;
-
-  my ($key, $comp, @structures, $extension, $xtype, @dim, $ndims, $loc);
-  my (@locs, $there, $type, %header, $packed, $length);
-  my (@bounds, $nbytes, $pntr, $maxsize, $which, $el, $path);
-  my ($oldhash, $oldtypes, $structs);
-
-  if (defined $hash) {
-    %header = %$hash;
-  } else {
-    %header = ();
-  }
-
-
-  my $root = 1 if length($hashname) == 0; # Mark a ROOT structure
-
-  # Return if bad status
-  return 0 if $status != &NDF::SAI__OK;
-
-  foreach $key (sort keys %header) {
-
-    next if $key =~ /^_/;
-
-    # If the key matches the Extensions (Axis or errors)
-    # then skip. Should probably use the Extensions array
-    # itself to work out which components to skip
-
-    next if $key eq 'Axis';
-    next if $key eq 'Errors';
-    next if $key eq 'Extensions';
-    next if $key eq 'Hist';
-
-    # Deal with HASH arrays early
-    ref($header{"$key"}) eq 'HASH' && do {
-      $oldhash = $hashname;
-      $oldtypes = $stypes;
-      $hashname .= ".$key";
-      $hashname =~ s/^\.//; # remove leading dot
-      $stypes .= ".".$header{"$key"}{'_TYPES'}{STRUCT}{"$key"};
-      $stypes =~ s/^\.//; # remove leading dot
-      whash(\%{$header{"$key"}}, $outndf, $hashname, $stypes, $status);
-      $hashname = $oldhash;
-      $stypes = $oldtypes;
-      next;
-    };
-
-
-
-    $path = $hashname . ".$key";
-    $path =~ s/^\.//; # remove leading dot
-
-    if ($key =~ /^TITLE$|^UNITS$|^LABEL$/i) {
-      # This is not extension info
-      ndf_cput($header{$key}, $outndf, $key, $status);
-    } else {
-
-      # Find nested structures
-      @structures = split(/\./, uc($path));
-
-      # Last entry in structure is the important name
-      $comp = pop(@structures);
-
-      # Find list of structures
-      $structs = join(".", @structures);
-      $structs = 'PERLDL' unless (defined $structs && $structs =~ /./);
-      $stypes = 'PERLDL_HDR' unless (defined $stypes && $stypes =~ /./);
-
-      $loc = mkstruct($outndf, $structs, $stypes, $status);
-      undef $stypes;
-
-      # Now write the component
-      # $loc is a locator to the last structure component
-      $type = $header{"_TYPES"}{"$key"};
-
-      # What is the data type?
-      unless ($type =~ /./) {
-        # number or character or array or pdl
-        # All arrays are chars - should be PDLs if nums
-        ref($header{"$key"}) eq 'ARRAY' && ($type = "_CHAR");
-
-        ref($header{"$key"}) eq 'PDL' &&
-          ($type = $pdltypes{$header{"$key"}{"Datatype"}});
-
-        ref($header{"$key"}) || do {
-          if ($header{"$key"} =~ /^(-?)(\d*)(\.?)(\d*)([Ee][-\+]?\d+)?$/) {
-            $header{"$key"} =~ /\.|[eE]/
-              && ($type = "_DOUBLE")
-                ||   ($type = "_INTEGER");
-          } else {
-            ($type = '_CHAR')   # Character
-          }
-        };
-
-      }
-
-      # Create and write component
-      # PDLs
-
-      if (ref($header{"$key"}) eq 'PDL') {
-        my $pdl = $header{"$key"};
-        @bounds = $pdl->dims;
-	my $n = $#bounds + 1;
-        dat_new($loc, $comp, $type, $n, \@bounds, $status);
-        $nbytes = PDL::Core::howbig($pdl->get_datatype) *
-            $pdl->nelem;
-        cmp_mapv($loc, $comp, $type, 'WRITE', $pntr, $el, $status);
-        string2mem(${$pdl->get_dataref}, $nbytes, $pntr)
-          if ($status == &NDF::SAI__OK);
-        cmp_unmap($loc, $comp, $status);
-      }
-
-      # SCALARS
-      ref($header{"$key"}) || do {
-
-        if ($type =~ /^_CHAR/) {
-          $length = length($header{"$key"});
-          dat_new0c($loc, $comp, $length, $status);
-          cmp_put0c($loc, $comp, $header{"$key"}, $status)
-            if $length > 0;
-	} elsif ($type =~ /^_LOG/) {
-	  # In this case, add a check for FALSE or TRUE as strings
-	  dat_new0l($loc, $comp, $status);
-	  my $value = $header{$key};
-	  if ($value eq 'FALSE') {
-	    $value = 0;
-	  } elsif ($value eq 'TRUE') {
-	    $value = 1;
-	  }
-	  cmp_put0l($loc, $comp, $value, $status);
-        } else {
-	  no strict "refs"; # Turn off strict
-          $which = lc(substr($type, 1,1));
-          &{"dat_new0$which"}($loc, $comp, $status);
-          &{"cmp_put0$which"}($loc, $comp, $header{"$key"}, $status);
-        }
-      };
-
-      # CHARACTER ARRAYS
-      ref($header{"$key"}) eq 'ARRAY' && do {
-        # First go through the array and remove any
-        # entries that are references. I draw the line at storing
-        # nested arrays
-        my @norefs = grep { not ref($_) } @{$header{"$key"}};
-
-        ($maxsize, $packed) = &NDF::pack1Dchar(\@norefs);
-        $ndims = 1;
-        @dim = ($#norefs+1);
-        dat_newc($loc, $comp, $maxsize, $ndims, @dim, $status);
-        cmp_putvc($loc, $comp, $dim[0], @norefs, $status);
-      };
-
-      # Annul all the locators
-      dat_annul($loc, $status);
-
-    }
-  }
-
-}
-
-# Subroutine to make extension structures of arbritrary depth
-# Just pass dot separated string to this function
-# A locator to the final structure is returned
-
-sub mkstruct {
-
-  my ($outndf, $structs, $types, $status) = @_;
-  my ($extension, @locs, @dim, $ndims, $xtype, $loc, $retloc);
-  my ($set, $prmry, $there);
-
-  my (@structures) = split('\.', $structs);
-  my (@types) = split('\.', $types);
-
-  return &NDF::DAT__NOLOC if $#structures < 0;
-  return &NDF::DAT__NOLOC if $status != &NDF::SAI__OK;
-
-  # Does extension exist
-
-  $extension = shift(@structures);
-  $xtype = shift(@types);
-
-  ndf_xstat($outndf, $extension, $there, $status);
-
-  # Make it if necessary
-  unless ($there) {
-    print "Writing $extension extension ($xtype)...\n" if $PDL::verbose;
-    @dim = (0);         # No pdl extensions!
-    $ndims = 0;
-    ndf_xnew($outndf, $extension, $xtype, $ndims, @dim, $loc, $status);
-  } else {                      # Get the locator to the extension
-    ndf_xloc($outndf, $extension, 'UPDATE', $loc, $status);
-  }
-
-
-  @locs = ();           # store the locators so that they can be annulled later
-  push(@locs, $loc);
-
-  # Make the structures, end up with a locator to the correct component
-  for (0..$#structures) {
-    dat_there($loc, $structures[$_], $there, $status);
-    unless ($there) {   # Make it if it isnt there
-      my $type = $types[$_];
-      @dim = (0);
-      dat_new($loc, $structures[$_], $type, 0, @dim, $status);
-    }
-    dat_find($loc, $structures[$_], $loc, $status);
-    push(@locs, $loc);  # Store the new locator
-  }
-
-  # Clone the locator
-  dat_clone($loc, $retloc, $status);
-  $set = 1;
-  $prmry = 1;
-  dat_prmry($set, $retloc, $prmry, $status);
-
-  # Annul all except the last locator
-  foreach (@locs) {
-    dat_annul($_, $status);
-  }
-
-  return &NDF::DAT__NOLOC unless $status == &NDF::SAI__OK;
-  return $retloc;
-
-}
-
-# end of module
-1;
-
-!NO!SUBS!
@@ -87,7 +87,7 @@ $PDL::IO::Pic::debug = $PDL::IO::Pic::debug || 0;
 
 sub init_converter_table {
   # default flag to be used with any converter unless overridden with FLAGS
-  $Dflags = '-quiet';
+  $Dflags = '';
   %converter = ();
 
   # Pbmplus systems have cjpeg/djpeg; netpbm systems have pnmtojpeg and
@@ -115,9 +115,8 @@ sub init_converter_table {
 				       get => "$conv".'topnm'} }
 
   my @special = (['PNM','NONE','NONE'],
-		 ['PS','pnmtops',
-		  'gs -sDEVICE=ppmraw -sOutputFile=- -q -dNOPAUSE -dBATCH'],
-
+		 ['PS','pnmtops -dpi=100',
+		  'pstopnm -stdout -xborder=0 -yborder=0 -quiet -dpi=100'],
 		 ['GIF','ppmtogif','giftopnm'],
 		 ['IFF','ppmtoilbm','ilbmtoppm']
 		 );
@@ -565,22 +564,27 @@ use PDL::IO::Pic;
 sub rim {
   my(@args) = @_;
 
-  if(@args == 2) {
-    my($dest) = $args[0];
-    if($dest->dim(0) == 3) {
-      $args[0] = $dest->reorder(1,2,0);
-    }
-    return rpic(@args);
+  my $out;
+
+  ## Handle dest-PDL-first case
+  if(@args >= 2 and (UNIVERSAL::isa($args[0],'PDL'))) {
+      my $dest = shift @args;
+      my $rpa = PDL->null;
+      $out = rpic(@args);
+
+      if($out->ndims == 3 && $out->dim(0) == 3 &&
+	 !( defined($out->gethdr) && $out->gethdr->{SIMPLE} )
+	  ) {
+	  $out =  $out->reorder(1,2,0);
+      }
+      
+      $dest .= $out;
+      return $out;
   }
 
-  my $out = rpic(@args);
+  # Handle no-first-PDL case
+  $out = rpic(@args);
 
-  #
-  # Check for RGB and reorder dims if necessary.  The SIMPLE test is to check
-  # if the image has a FITS header.
-  #
-  # (What a kludge -- but rpic is historical and has to be kept at this point)
-  #
   if($out->ndims == 3 && $out->dim(0) == 3 &&
      !( defined($out->gethdr) && $out->gethdr->{SIMPLE} )
      ) {
@@ -876,6 +880,7 @@ sub chkform {
     my ($format, $magic, $len, $ext) = ("","",0,"");
 
     open(IMG, $file) or barf "Can't open image file";
+    binmode IMG;
     # should first check if file is long enough
     $len = read(IMG, $magic,12);
     if (!defined($len) ||$len != 12) {
@@ -26,7 +26,9 @@ pnm I/O for PDL.
 use PDL::Core qw/howbig convert/;
 use PDL::Types;
 use PDL::Basic;  # for max/min
+use PDL::IO::Misc;
 use Carp;
+use File::Temp qw( tempfile );
 
 # return the upper limit of data values an integer PDL data type
 # can hold
@@ -69,17 +71,6 @@ sub rcarp {
   carp @_;
 }
 
-sub gettmpfile {
-    # in the future an os indep. way
-    # are there already VMS or Windows NT/95 users ?
-  my $tmpdir = '/tmp';
-  for ('TMP','TEMP','TMPDIR') {
-     $tmpdir  = $ENV{$_} if defined $ENV{$_};
-  }
-  $tmpdir =~ s|/$||;  # chop off a trailing '/'
-  barf "can't locate a temp dir" unless -d $tmpdir;
-  return "$tmpdir/.errors$$";
-}
 
 # public interface
 
@@ -137,7 +128,7 @@ sub PDL::rpnm {
         $pdl = $pdl->initialize;
     }
 
-    my $efile = gettmpfile();
+    my ($errfh, $efile) = tempfile();
     # catch STDERR
     open(SAVEERR, ">&STDERR");
     open(STDERR, ">$efile") || barf "Can't redirect stderr";
@@ -209,6 +200,14 @@ TYPES:	{  my $pdlt;
 	   $isrgb ? ", RGB data":"", $israw ? ", raw" : " ASCII"," data\n")
 	if $PDL::debug;
     unlink($efile);
+
+    # need to byte swap for little endian platforms
+    unless ( isbigendian() ) {
+       if ($israw ) {
+          $pdl->bswap2 if $type==$PDL_US or $pdl->type == ushort;
+          $pdl->bswap4 if $type==$PDL_L;  # not likely, but supported anyway
+       }
+    }
     return $pdl;
 }
 
@@ -245,6 +244,11 @@ sub PDL::wpnm {
     my ($pdl,$file,$type,$raw) = @_;
     my ($israw,$max,$isrgb,$magic) = (0,255,0,"");
 
+    # need to copy input arg since bswap[24] work inplace
+    # might be better if the bswap calls detected if run in
+    # void context
+    my $swap_inplace = $pdl->is_inplace;
+
     barf "wpnm: unknown format '$type'" if $type !~ /P[P,G,B]M/;
 
     # check the data
@@ -270,7 +274,7 @@ sub PDL::wpnm {
     $isrgb = 1 if $magic =~ /P[3,6]/;
 
     # catch STDERR and sigpipe
-    my $efile = gettmpfile();
+    my ($errfh, $efile) = tempfile();
     local $SIG{"PIPE"} = sub { show_err($efile);
 			       die "Bad write to pipe $? $!"; };
 
@@ -306,8 +310,20 @@ sub PDL::wpnm {
     # if rgb clump first two dims together
     my $out = ($isrgb ? $pdl->slice(':,:,-1:0')->clump(2)
 		 : $pdl->slice(':,-1:0'));
-    pnmout($out,$israw,$type eq "PBM",'PDL::IO::Pnm::PNM');
 
+    # handle byte swap issues for little endian platforms
+    unless ( isbigendian() ) {
+       if ($israw ) {
+          # make copy if needed
+          $out = $out->copy unless $swap_inplace;
+          if ( (255 < $max) and ($max < 65536)) {
+             $out->bswap2;
+          } elsif ($max >= 65536) {
+             $out->bswap4;
+          }
+       }
+    }
+    pnmout($out,$israw,$type eq "PBM",'PDL::IO::Pnm::PNM');
 
     # check if our child returned an error (in case of a pipe)
     if (!(close PNM)) {
@@ -43,7 +43,7 @@ make_null(sv)
         SV *sv
         CODE:
         SV *newref, *dat;
-        PDL_Long fake[1] = {0};
+        PDL_Indx fake[1] = {0};
         STRLEN n_a;
 
         /* we basically mimick pdl_null but without letting
@@ -1,36 +1,34 @@
 The following issues have been reported with this version of PDL:
 
 
-- Some systems have reported build failures that appear to be
-  a result of missing pthread_getspecific in library calls.
+- A bug in Netpbm from versions 10.56.00 through 10.61.2 may
+  result in a an invalid conversion of RAST images to PNM
+  format on some platforms, resulting in a failed picrgb test.
 
-  If you see this, please report via the perldl mailing list to
-  help us determine the origin of the probem and fix it.
-  A workaround is to set WITH_POSIX_THREADS => 0, by editing
-  the perldl.conf file.
+  
+- Bugs in Netpbm versions earlier than 10.58.00 result in
+  invalid 16bit PNG image IO and failing tests.
 
 
-- Multiple subtest failures in t/gd_oo_tests.t have been
-  seen in CPAN Testers reports, they appear to be on 64bit
-  BSD operating systems compiled for AMD processors.  Sf.net
-  bug #3518190 "t/gd_oo_tests.t fails for AMD64" tracks this
-  issue.
+- GLUT readline support in perldl with the -glut option not
+  yet implemented for win32.  Work in progress.
 
 
 - A change in perl-5.14 on how the 'x' operator works affects
   PDL's overload of that operator for matrix multiplication.
-  An example that shows the problem is code like:
+  This can affect code using parentheses to group.  An example
+  that shows the problem is code like:
 
      f( ($pdl0 * $pdl1) x $pdl2 )
 
-  which gives an error.  The fix is to force the element-wise
-  operation in parentheses to be treated in scalar context
-  rather than list context.  E.g.,
+  which now gives an error.  The fix is to force the element-wise
+  operation in parentheses to be treated in scalar context rather
+  than list context.  E.g.,
 
     f( scalar($p0 * $p1) x $p2 );
 
   Please see
-  http://mailman.jach.hawaii.edu/pipermail//pdl-porters/2012-February/004426.html
+  http://mailman.jach.hawaii.edu/pipermail//pdl-porters/2012-February/004423.html
   for a more detailed discussion and additional work-arounds.
 
 
@@ -82,13 +80,6 @@ The following issues have been reported with this version of PDL:
   the whole process exits including the perldl shell.
 
 
-- PDL::FFTW is based on version 2 of the FFTW API.  The current
-  release of the FFTW library is version 3.2.2.  To use PDL::FFTW
-  you will need to install FFTW version 2.1.5, use the built-in
-  PDL::FFT routines instead, or (better yet) submit a patch to
-  update PDL::FFTW to the version 3 API.
-
-
 - Extremely verbose but not particularly helpful text output from
   the configure-build-test process.
 
@@ -99,10 +90,9 @@ The following issues have been reported with this version of PDL:
   again.  The problem has been reported as a Term::ReadLine::Perl bug.
 
 
-- PDL on Cygwin has (by default) a 300MB process memory limit which can
-  cause out of memory crashes with large data sets.  See the cygwin users
-  guide: http://www.cygwin.com/cygwin-ug-net/setup-maxmem.html for how
-  to increase the memory limit.
+- PDL on Cygwin+32bit windows has only about 300MB which can cause
+  out of memory crashes with large data sets.  For 64bit windows hosts
+  2GB is available.
 
 
 - minimum/maximum/min/max inconsistently handle NaN values.
@@ -112,40 +102,37 @@ The following issues have been reported with this version of PDL:
   depend on the order of the input values.
 
 
-- 16-bit image IO via rpic/wpic and rim/wim do not correctly
-  handle byte order issues.  The intermediate PNM data piped
-  through the converter programs is not adjusted to network
-  byte order per the NetPBM convention/standard.  This is not
-  an issue for big-endian systems or for 8-bit/channel image
-  data.
-
-
 - The following SourceForge bugs are outstanding at time of the
-  PDL-2.4.11 release:
-
-  3528231    t/slatec.t subtest 8 fails w/ BADVAL_USENAN=1
-  3524081    t/inline-comment.t subtest 3 fails for cygwin
-  3518190    t/gd_oo_tests.t fails for AMD64
-  3515759    PDL::GIS::Proj doesn't buidl with proj-4.8.0
-  3509400    pp_def, pp_line_numbers,..not found by pdldoc
-  3503566    pdl2 enters infinite loop on DWIMPerl
-  3475075    t/pic_16bit.t subtest fails
-  3465663    perldl.conf OPTIMIZE option doesn't work
-  3363406    PDL::Minuit build can't make libminuit.a
-  3316394    'help funname' fails to show multiple function names
-  3314708    PDL install does not install scantree.pl
-  3299615    PLplot still unusable with X
-  3234141    max() fails on nan
-  3161459    online docs don't link to functions in other PDL modules
-  3018731    NiceSlice affects code where it should not
-  2995500    perl -d chokes on lvalue functions
-  2153898    default PDL build output too long
-  1507054    closing TriD window kills perldl shell
-  1205359    PGPLOT Window does not store full state info
+  PDL-2.007 release:
+
+  343    longlong constructor and display lose digits due to implicit double precision conversions
+  340    orover of byte data returns long type
+  339    PDL::Complex support is inconsistent and incomplete
+  334    Test coverage is incomplete
+  332    "isn't numeric in null operation" warning could be more helpful
+  330    NiceSlice can get confused by comments to cause compilation errors
+  324    PDL re-install wipes out non-core docs
+  322    PDL::Demos system needs overhaul
+  321    Several core modules do not have man pages
+  319    PDL::Index does not render on websites
+  313    clip() edge case not handled right
+  312    Wrong results in corner empty-set cases
+  308    propagate badflag with .=
+  274    'help funname' fails to show multiple function names
+  268    PLplot still unusable with X
+  261    max() fails on nan
+  254    online docs don't link to functions in other PDL modules
+  238    NiceSlice affects code where it should not
+  232    perl -d chokes on lvalue functions
+
+               Fixed in perl 5.16.x or use work around.
+
+  210    default PDL build output too long
+  147    closing TriD window kills perldl shell
 
 
 For more information on these and other PDL issues, and for
 submissions of patches (bug patches are always welcome!),
 see the PDL mailing lists. Links to archive list discussions
 and how to register for the mailing lists can be found at
-http://pdl.sourceforge.net/maillists/ .
+http://pdl.perl.org/?page=mailing-lists .
@@ -190,8 +190,10 @@ sub callext_cc {
 	my $eo = ( $^O =~ /MSWin/i ? '"' : '' );
 
 	# Compiler command
+        # Placing $ccflags *before* installsitelib/PDL/Core enables us to include
+        # the appropriate 'pdlsimple.h' during 'make test'.
 	my $cc_cmd = join(' ', map { $Config{$_} } qw(cc ccflags cccdlflags)) .
-		" -I$Config{installsitelib}/PDL/Core $ccflags -c $src $do$cc_obj$eo";
+		" $ccflags -I$Config{installsitelib}/PDL/Core -c $src $do$cc_obj$eo";
 
 	# The linker output flag is -o on cc and gcc, and -out: on MS Visual Studio
 	my $o = ( $Config{cc} eq 'cl' ? '-out:' : '-o ');
@@ -199,7 +201,7 @@ sub callext_cc {
 	# Setup the LD command. Do not want the env var on Windows
 	my $ld_cmd = ( $^O =~ /MSWin/i ? ' ' : 'LD_RUN_PATH="" ');
 
-	my $libs = $^O =~ /MSWin/i ? 
+	my $libs = $^O =~ /MSWin/i ?
                  $Config{libs} :
                  ''; # used to be $Config{libs} but that bombs
 	               # on recent debian platforms
@@ -9,6 +9,6 @@ WriteMakefile(
  'VERSION_FROM' => '../../Basic/Core/Version.pm',
  'INC' => "-I../../Basic/Core $mallocinc",
  'LIBS' => [$malloclib],
-
+ (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -6,8 +6,16 @@ PDL::FFT - FFTs for PDL
 
 =head1 DESCRIPTION
 
+!!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+As of PDL-2.006_04, the direction of the FFT/IFFT has been
+reversed to match the usage in the FFTW library and the convention
+in use generally.
+!!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
 FFTs for PDL.  These work for arrays of any dimension, although ones
-with small prime factors are likely to be the quickest.
+with small prime factors are likely to be the quickest.  The forward
+FFT is unnormalized while the inverse FFT is normalized so that the
+IFFT of the FFT returns the original values.
 
 For historical reasons, these routines work in-place and do not recognize
 the in-place flag.  That should be fixed.
@@ -115,7 +123,7 @@ pp_def('_fft',
 	'NoPthread' => 1, # underlying fft code (fftn.c) isn't threadsafe
 	GenericTypes => [F,D],
 	Code => '$TFD(fftnf,fftn)
-	($SIZE(n), NULL , $P(real),$P(imag), 1, 1.);',
+	($SIZE(n), NULL , $P(real),$P(imag), -1, 1.);',
 	Doc=>undef
 );
 
@@ -124,7 +132,7 @@ pp_def('_ifft',
 	'NoPthread' => 1, # underlying fft code (fftn.c) isn't threadsafe
 	GenericTypes => [F,D],
 	Code => '$TFD(fftnf,fftn)
-	($SIZE(n), NULL , $P(real),$P(imag), -1, -1.);',
+	($SIZE(n), NULL , $P(real),$P(imag), 1, -1.);',
 	Doc=>undef
 );
 
@@ -155,7 +163,11 @@ sub todecimal {
 
 =for ref
 
-Complex FFT of the "real" and "imag" arrays [inplace].
+Complex 1-D FFT of the "real" and "imag" arrays [inplace].
+
+=for sig
+
+  Signature: ([o,nc]real(n); [o,nc]imag(n))
 
 =for usage
 
@@ -189,7 +201,11 @@ sub PDL::fft {
 
 =for ref
 
-Complex inverse FFT of the "real" and "imag" arrays [inplace].
+Complex inverse 1-D FFT of the "real" and "imag" arrays [inplace].
+
+=for sig
+
+  Signature: ([o,nc]real(n); [o,nc]imag(n))
 
 =for usage
 
@@ -283,7 +299,7 @@ sub PDL::realifft {
 
 =for ref
 
-N-dimensional FFT (inplace)
+N-dimensional FFT over all pdl dims of input (inplace) 
 
 =for example
 
@@ -317,7 +333,7 @@ sub PDL::fftnd {
 
 =for ref
 
-N-dimensional inverse FFT
+N-dimensional inverse FFT over all pdl dims of input (inplace) 
 
 =for example
 
@@ -1,199 +0,0 @@
-# PDL interface to  FFTW
-# Makefile.PL for a package defined by PP code.
-
-use ExtUtils::MakeMaker;
-use Config;
-
-PDL::Core::Dev->import();
-
-BEGIN {
-
-
-	$msg = ""; $forcebuild=0;  # Note: forcebuild not used
-
-	if (defined $PDL::Config{WITH_FFTW} && $PDL::Config{WITH_FFTW}==0) {
-	   $msg = "\n   Will skip build of PDL::FFTW on this system   \n";
-	   goto skip;
-	}
-
-	if (defined $PDL::Config{WITH_FFTW} && $PDL::Config{WITH_FFTW}==1) {
-	   print "\n   Will forcibly try and build PDL::FFTW on this system   \n\n";
-	   $forcebuild=1;
-	}
-
-	# Setup the FFTW library we will link to: (single/double precision)
-	#  Default is double precision
-	$want_float = 0;
-	$want_double = 1;
-	if (defined $PDL::Config{FFTW_TYPE} && $PDL::Config{FFTW_TYPE} =~ /single/i ) {
-		$want_float = 1;
-		$want_double = 0;
-	}
-
-	$found_float = $found_double = 'none';
-
-	# Look for FFTW includes/libs
-	# default locations:
-	@FFTW_inc_locations = ('/usr/include', '/usr/local/include', $Config{usrinc}); 
-	@FFTW_lib_locations = ('/lib','/usr/lib','/usr/local/lib',split(/ /, $Config{libpth}));
-
-	# get locations from perldl.conf, if specified there:
-	@FFTW_inc_locations = @{$PDL::Config{FFTW_INC}} if( defined $PDL::Config{FFTW_INC} );
-	@FFTW_lib_locations = @{$PDL::Config{FFTW_LIBS}} if( defined $PDL::Config{FFTW_LIBS} );
-
-	foreach $i (@FFTW_inc_locations) {
-	  if (-e "$i/dfftw.h") {
-	    print  "Found FFTW2 double version in $i/dfftw.h !\n";
-	    $double_rinclude = 'drfftw.h';
-	    $double_lib = '-ldfftw -ldrfftw';
-
-	    # Inc found, now try to find libs:
-	    if( findLibs($double_lib, @FFTW_lib_locations)){
-		    print " FFTW Libs also found.\n";
-		    $found_double = 'dfftw.h';
-
-	    }
-	  }
-	  if (-e "$i/sfftw.h") {
-	    print  "Found FFTW2 single version $i/sfftw.h !\n";
-	    $single_rinclude = 'srfftw.h';
-	    $single_lib = '-lsfftw -lsrfftw';
-
-	    # Inc found, now try to find libs:
-	    if( findLibs($single_lib, @FFTW_lib_locations)){
-		    print " FFTW Libs also found.\n";
-		    $found_float = 'sfftw.h';
-	    }
-	  }
-	  if (-e "$i/fftw.h") {
-	    open F,"$i/fftw.h";
-	    $is_float=0;
-	    while (<F>) {
-	      if (/define FFTW_ENABLE_FLOAT 1/) {$is_float=1;}
-	    }
-	    close F;
-	    if ($is_float) {
-		    print "Found FFTW2 single version in $i/fftw.h !\n";
-		    $single_rinclude = 'rfftw.h';
-		    $single_lib = '-lfftw -lrfftw';
-		    # Inc found, now try to find libs:
-		    if( findLibs($single_lib, @FFTW_lib_locations)){
-			    print " FFTW Libs also found.\n";
-			    $found_float = 'fftw.h';
-		    }
-	    }
-	    else {
-		    print  "Found FFTW2 double version in $i/fftw.h !\n";
-		    $double_rinclude = 'rfftw.h';
-		    $double_lib = '-lfftw -lrfftw';
-		    if( findLibs($double_lib, @FFTW_lib_locations)){
-			    print " FFTW Libs also found.\n";
-			    $found_double = 'fftw.h';
-		    }
-	    }
-	  }
-	}
-
-	$donot = 1;
-	$wanted_not_found = 0;
-	
-        # want float, found float
-        if ($found_float ne 'none' && $want_float ) {
-            $include = $found_float;
-            print "Building single version\n";
-            $pdltype = 'PDL_F';
-            $lib = $single_lib;
-            $rinclude = $single_rinclude;
-            $out = '$fftwtype=\'float\'';
-            $donot = 0;
-        }
-
-        # want double, found double
-        elsif ($found_double ne 'none' && $want_double ) {
-            $include = $found_double;
-            print "Building double version\n";
-            $pdltype = 'PDL_D';
-            $lib = $double_lib;
-            $rinclude = $double_rinclude;
-            $out = '$fftwtype=\'double\'';
-            $donot = 0;
-        }
-
-
-        if ( $donot )   {
-
-          $msg .= "\n Skipping build of PDL::FFTW.\n";
-
-          # maybe we found something, but it wasn't what was wanted...
-          if ( $found_double ne 'none' )
-            { $msg .= "Found double version, wanted float!\n" }
-
-          if ( $found_float ne 'none' )
-            { $msg .= "Found float version, wanted double!\n" }
-        }
-
-skip:
-
-	if ($msg ne "" && $forcebuild==0) {
-
-	    warn $msg . "\n";
-	    $msg =~ s/\n//g;
-	    write_dummy_make( $msg );
-	    $donot = 1;
-	    $PDL::Config{WITH_FFTW}=0;
-	} else {
-	    $PDL::Config{WITH_FFTW}=1;
-            print "\n   Building PDL::FFTW. Turn off WITH_FFTW if there are any problems\n\n";
-	}
-
-	# Sub to find libs
-	sub findLibs {
-		my ($libstring, @libdirs) = @_;
-		# make a list of libs from the libstring
-		my @libs = split ' ',$double_lib;
-		grep s/\-l//g, @libs;
-		grep $_ = "lib$_.a", @libs;
-		my %libs;
-		my $lib;
-		foreach $libdir(@libdirs){
-			foreach $lib(@libs){
-				if( -e "$libdir/$lib"){
-					$libs{$lib} = 1;
-				}
-			}
-	
-		}
-		if( scalar(keys %libs) == scalar(@libs) ){
-			return 1;	# all libs in the list were found
-		}
-		print "     Libs: '".join("', '",@libs)."' Not Found\n";
-		print "     Looked in: '".join("', '",@libdirs)."'\n";
-		return 0; # all libs in the list not found
-	
-	}
-}
-##############################################################################
-
-
-return if $donot;
-
-open F,'>typespec';
-print F $out,";\n";
-print F 'pp_addhdr(\'',"\n";
-print F '#include "',$include,'"',"\n";
-print F '#include "',$rinclude,'"',"\n";
-print F '#define PDL_MYTYPE ',$pdltype,"\n";
-print F '\');',"\n";
-close F;
-
-@pack = (["fftw.pd",FFTW,PDL::FFTW]);
-%hash = pdlpp_stdargs_int(@::pack);
-$hash{INC} .= " -I".join(' -I',@FFTW_inc_locations);
-$hash{clean}->{FILES} .= ' typespec';
-push @{$hash{LIBS}},"-lm -L".join(" -L",@FFTW_lib_locations)." $lib";
-WriteMakefile(%hash);
-
-
-sub MY::postamble {
-        pdlpp_postamble_int(@::pack);
-}  # Add genpp rule                             
@@ -1,8 +0,0 @@
-FFTW-PDL 0.5
-
-Interface to FFTW 2.x for PDL.
-Copyright 1999 Christian Pellegrin.
-This is free software with no warranty,
-see COPYING in the source root of PDL.
-
-Please report any bugs to <chri@infis.univ.ts.it>
@@ -1,1109 +0,0 @@
-# TODO:
-# threading? change to pp_defs
-# docs improvement
-# use PDL::Complex?
-
-require 'typespec';
-
-pp_addpm({At=>'Top'},<<'EOD');
-=head1 NAME
-
-PDL::FFTW - PDL interface to the Fastest Fourier Transform in the West v2.x
-
-=head1 DESCRIPTION
-
-This is a means to interface PDL with the FFTW library. It's similar to
-the standard FFT routine but it's usually faster and has support for
-real transforms. It works well for the types of PDLs for
-which was the library was compiled (otherwise it must do conversions).
-
-=head1 SYNOPSIS
-
-    use PDL::FFTW
-
-    load_wisdom("file_name");
-
-    out_cplx_pdl =  fftw(in_cplx_pdl);
-    out_cplx_pdl = ifftw(in_cplx_pdl);
-
-    out_cplx_pdl =  rfftw(in_real_pdl);
-    out_real_pdl = irfftw(in_cplx_pdl);
-
-    cplx_pdl = nfftw(cplx_pdl);
-    cplx_pdl = infftw(cplx_pdl);
-
-    cplx_pdl = Cmul(a_cplx_pdl, b_cplx_pdl);
-    cplx_pdl = Cconj(a_cplx_pdl);
-    real_pdl = Cmod(a_cplx_pdl); 
-    real_pdl = Cmod2(a_cplx_pdl); 
-
-=head1 FFTW documentation
-
-Please refer to the FFTW documentation for a better understanding of
-these functions.
-
-Note that complex numbers are represented as piddles with leading
-dimension size 2 (real/imaginary pairs).
-
-=cut
-
-
-EOD
-
-pp_addpm(<<'EOD');
-
-=head2 load_wisdom
-
-=for ref
-
-Loads the wisdom from a file for better FFTW performance.
-
-The wisdom
-is automatically saved when the program ends. It will be automagically
-called when the variable C<$PDL::FFT::wisdom> is set to a file name.
-For example, the following is a useful idiom to have in your F<.perldlrc>
-file:
-
-  $PDL::FFT::wisdom = "$ENV{HOME}/.fftwisdom"; # save fftw wisdom in this file
-
-Explicit usage:
-
-=for usage
-
-  load_wisdom($fname);
-
-=head2 fftw
-
-=for ref 
-
-calculate the complex FFT of a real piddle (complex input, complex output)
-
-=for usage
-
-   $pdl_cplx = fftw $pdl_cplx;
-
-=head2 ifftw
-
-=for ref 
-
-Complex inverse FFT (complex input, complex output).
-
-=for usage
-
-   $pdl_cplx = ifftw $pdl_cplx;
-
-=head2 nfftw
-
-=for ref 
-
-Complex inplace FFT (complex input, complex output).
-
-=for usage
-
-   $pdl_cplx = nfftw $pdl_cplx;
-
-=head2 infftw
-
-=for ref 
-
-Complex inplace inverse FFT (complex input, complex output).
-
-=for usage
-
-   $pdl_cplx = infftw $pdl_cplx;
-
-=head2 rfftw
-
-=for ref 
-
-Real FFT. For an input piddle of dimensions [n1,n2,...] the 
-output is [2,(n1/2)+1,n2,...] (real input, complex output).
-
-=for usage
-
-  $pdl_cplx = fftw $pdl_real;
-
-=head2 irfftw
-
-=for ref 
-
-Real inverse FFT. Have a look at rfftw to understand the format. USE
-ONLY an even n1! (complex input, real output)
-
-=for usage
-
-  $pdl_real = ifftw $pdl_cplx;
-
-=head2 nrfftw
-
-=for ref 
-
-Real inplace FFT. If you want a transformation on a piddle
-with dimensions [n1,n2,....] you MUST pass in a piddle
-with dimensions [2*(n1/2+1),n2,...] (real input, complex output).
-
-Use with care due to dimension restrictions mentioned below.
-For details check the html docs that come with the fftw library.
-
-=for usage
-
-  $pdl_cplx = nrfftw $pdl_real;
-
-=head2 inrfftw
-
-=for ref 
-
-Real inplace inverse FFT. Have a look at nrfftw to understand the format. USE
-ONLY an even first dimension size! (complex input, real output)
-
-=for usage
-
-  $pdl_real = infftw $pdl_cplx;
-
-=cut
-
-
-EOD
-
-
-pp_addpm('
-
-use PDL;
-use PDL::ImageND qw/kernctr/;
-use strict;
-
-my ($wisdom_fname, $wisdom_loaded, %plan_cache, $datatype, $warn_conv);
-
-#
-# package vriables: $wisdom_fname, $wisdom_loaded, %plan_cache, $datatype, $warn_conv, 
-#           $COMPILED_TYPE: (Type "double" or "float") that PDL::FFTW was compiled/linked to
-#
-
-$wisdom_loaded = 0;
-
-$PDL::FFTW::COMPILED_TYPE = "'.$fftwtype.'";
-
-sub load_wisdom {
-    $wisdom_fname = shift;
-    
-    if (!$wisdom_loaded) {
-	my ($wisdom, $ok);
-	$wisdom_loaded = 1;
-	if (!open(TMPFILE,$wisdom_fname)) {
-	    print STDERR "Warning: couldn\'t find wisdom file\n";
-	    return;
-	}
-	$wisdom = <TMPFILE>;
-	close(TMPFILE);
-	$ok = PDL_fftw_import_wisdom_from_string($wisdom);
-	if (!$ok) {
-	    print STDERR "Warning: couldn\'t import wisdom\n";
-	}
-    }
-}
-
-sub save_wisdom {
-  if ($wisdom_loaded) {
-    my $wisdom = PDL_fftw_export_wisdom_to_string();
-
-    if (!open(TMPFILE,">$wisdom_fname")) {
-      print STDERR "Warning: couldn\'t write wisdom file\n";
-      return;
-    }
-    print TMPFILE $wisdom;
-    close(TMPFILE);
-  }
-}
-
-sub BEGIN {
-  my $HOME=$ENV{HOME};
-  my $test_type = ' . $fftwtype  . ' 1;
-
-  $datatype = $test_type->get_datatype;
-  $warn_conv = 0;
-#  if ( -e "$HOME/.wisdom" ) {
-#    print STDERR "Autoloading wisdom\n";
-#    load_wisdom("$HOME/.wisdom");
-#  }
-}
-
-sub END {
-  save_wisdom();
-}
-
-if (defined $PDL::FFT::wisdom) {
-    load_wisdom($PDL::FFT::wisdom);
-    print "loading wisdom from $PDL::FFT::wisdom\n" if $PDL::debug;
-}
-
-# real fftw
-*PDL::rfftw = \&rfftw;
-sub rfftw {
-  my $in = PDL::Core::topdl(shift);
-  my @dims = $in->dims;
-  my @newdims;
-  my ($out,$name,$i);
-
- 
-  if ($datatype != $in->get_datatype) {
-    $in = convert $in, ' . $fftwtype . ';
-    if ($warn_conv != 1) {
-      print STDERR "PDL::FFTW Warning! doing conversion.\n";
-      $warn_conv = 1;
-    }
-  }
-  foreach $i (@dims) {
-    unshift @newdims, $i;
-  }
-  $name="r_@{newdims}_f";
-  if ( !defined($plan_cache{$name}) ) {
-    my $pdldims = long [@newdims];
-    $plan_cache{$name} = PDL_rfftwnd_create_plan($pdldims,0,$wisdom_loaded);
-  }
-  $dims[0]= int($dims[0]/2)+1;
-  unshift @dims, 2;
-  $out = zeroes ' . $fftwtype . ',@dims;
-  $in->make_physical;
-  PDL_rfftwnd_one_real_to_complex($plan_cache{$name},$in,$out);
-  return $out;
-}
-
-# this assumes even last input dimension!
-
-*PDL::irfftw = \&irfftw;
-sub irfftw {
-  my $in = PDL::Core::topdl(shift);
-  my @dims = $in->dims;
-  my @newdims;
-  my ($out,$name,$i);
-
-  $i = shift @dims;
-  if ($i != 2) {
-     barf("Working only on complex numbers!");
-  } 
-  if ($datatype != $in->get_datatype) {
-    $in = convert $in, ' . $fftwtype . ';
-    if ($warn_conv != 1) {
-      print STDERR "PDL::FFTW Warning! doing conversion.\n";
-      $warn_conv = 1;
-    }
-  }
-  $i= shift @dims;
-  unshift @newdims, 2*($i-1);
-  foreach $i (@dims) {
-    unshift @newdims, $i;
-  } 
-  $name="r_@{newdims}_b";
-  if ( !defined($plan_cache{$name}) ) {
-    my $pdldims = long [@newdims];
-    $plan_cache{$name} = PDL_rfftwnd_create_plan($pdldims,1,$wisdom_loaded);
-  }
-  unshift @dims, 2*($i-1);
-  $out = zeroes ' . $fftwtype . ',@dims;
-  $in->make_physical;
-  PDL_rfftwnd_one_complex_to_real($plan_cache{$name},$in,$out);
-  return $out;
-}
-
-# real inplace fftw
-
-*PDL::nrfftw = \&nrfftw;
-sub nrfftw {
-  my ($in)=@_;
-  my @dims = $in->dims;
-  my @newdims;
-  my ($out,$name,$i,$ndim);
-
- 
-  if ($datatype != $in->get_datatype) {
-	barf("Cannot do inplace fftw: compiled for ' . $fftwtype . ' !");
-  }
-  foreach $i (@dims) {
-    unshift @newdims, $i;
-  }
-  $ndim = $newdims[$#newdims] = 2*(int($newdims[$#newdims]/2) - 1);
-  $name="nr_@{newdims}_f";
-  if ( !defined($plan_cache{$name}) ) {
-    my $pdldims = long [@newdims];
-    $plan_cache{$name} = PDL_rfftwnd_create_plan($pdldims,0,$wisdom_loaded+2);
-  }
-  $dims[0]= int($ndim/2)+1;
-  unshift @dims, 2;
-  $in->make_physical;
-  PDL_inplace_rfftwnd_one_real_to_complex($plan_cache{$name},$in);
-  $in->reshape(@dims);
-  return $in;
-}
-
-# this assumes even last input dimension!
-
-*PDL::inrfftw = \&inrfftw;
-sub inrfftw {
-  my ($in)=@_;
-  my @dims = $in->dims;
-  my @newdims;
-  my ($out,$name,$i,$ndim);
-
-  $i = shift @dims;
-  if ($i != 2) {
-     barf("Working only on complex numbers!");
-  } 
-  if ($datatype != $in->get_datatype) {
-	barf("Cannot do inplace fftw: compiled for ' . $fftwtype . ' !");
-  }
-  $i= shift @dims;
-  $ndim =  2*($i-1);
-  unshift @newdims, $ndim;
-  foreach $i (@dims) {
-    unshift @newdims, $i;
-  } 
-  $name="nr_@{newdims}_b";
-  if ( !defined($plan_cache{$name}) ) {
-    my $pdldims = long [@newdims];
-    $plan_cache{$name} = PDL_rfftwnd_create_plan($pdldims,1,$wisdom_loaded+2);
-  }
-  unshift @dims, 2*(int($ndim/2)+1);
-  $in->make_physical;
-  PDL_inplace_rfftwnd_one_complex_to_real($plan_cache{$name},$in);
-  $in->reshape(@dims);
-  return $in;
-}
-
-# complex fftw
-
-*PDL::fftw = \&fftw;
-sub fftw {
-  my $in = PDL::Core::topdl(shift);
-  my @dims = $in->dims;
-  my @newdims;
-  my ($out,$name,$i);
-
-  if ($datatype != $in->get_datatype) {
-    $in = convert $in, ' . $fftwtype . ';
-    if ($warn_conv != 1) {
-      print STDERR "PDL::FFTW Warning! doing conversion.\n";
-      $warn_conv = 1;
-    }
-  }
-  $i=shift @dims;
-  if ($i!=2) {
-    barf("It works only on complex!");
-  }
-  foreach $i (@dims) {
-    unshift @newdims, $i;
-  }
-  $name="c_@{newdims}_f";
-  if ( !defined($plan_cache{$name}) ) {
-    my $pdldims = long [@newdims];
-    $plan_cache{$name} = PDL_fftwnd_create_plan($pdldims,0,$wisdom_loaded);
-  }
-  unshift @dims, 2;
-  $out = zeroes ' . $fftwtype . ',@dims;
-  $in->make_physical;
-  PDL_fftwnd_one($plan_cache{$name},$in,$out);
-  return $out;
-}
-
-*PDL::ifftw = \&ifftw;
-sub ifftw {
-  my $in = PDL::Core::topdl(shift);
-  my @dims = $in->dims;
-  my @newdims;
-  my ($out,$name,$i);
-
-  if ($datatype != $in->get_datatype) {
-    $in = convert $in, ' . $fftwtype . ';
-    if ($warn_conv != 1) {
-      print STDERR "PDL::FFTW Warning! doing conversion.\n";
-      $warn_conv = 1;
-    }
-  } 
-  $i = shift @dims;
-  if ($i != 2) {
-     barf("Working only on complex numbers!");
-  }
-  foreach $i (@dims) {
-    unshift @newdims, $i;
-  } 
-  $name="c_@{newdims}_b";
-  if ( !defined($plan_cache{$name}) ) {
-    my $pdldims = long [@newdims];
-    $plan_cache{$name} = PDL_fftwnd_create_plan($pdldims,1,$wisdom_loaded);
-  }
-  unshift @dims, 2;
-  $out = zeroes ' . $fftwtype . ',@dims;
-  $in->make_physical;
-  PDL_fftwnd_one($plan_cache{$name},$in,$out);
-  return $out;
-}
-
-# complex inplace fftw
-
-*PDL::nfftw = \&nfftw;
-sub nfftw {
-  my ($in)=@_;
-  my @dims = $in->dims;
-  my @newdims;
-  my ($name,$i);
-
-  if ($datatype != $in->get_datatype) {
-	barf("Cannot do inplace fftw: compiled for ' . $fftwtype . ' !");
-  } 
-  $i=shift @dims;
-  if ($i!=2) {
-    barf("It works only on complex!");
-  }
-  foreach $i (@dims) {
-    unshift @newdims, $i;
-  }
-  $name="n_@{newdims}_f";
-  if ( !defined($plan_cache{$name}) ) {
-    my $pdldims = long [@newdims];
-    $plan_cache{$name} = PDL_fftwnd_create_plan($pdldims,0,$wisdom_loaded+2);
-  }
-  $in->make_physical;
-  PDL_inplace_fftwnd_one($plan_cache{$name},$in);
-  return $in;
-}
-
-*PDL::infftw = \&infftw;
-sub infftw {
-  my ($in)=@_;
-  my @dims = $in->dims;
-  my @newdims;
-  my ($out,$name,$i);
-
-  if ($datatype != $in->get_datatype) {
-	barf("Cannot do inplace fftw: compiled for ' . $fftwtype . q| !");
-  } 
-  $i = shift @dims;
-  if ($i != 2) {
-     barf("Working only on complex numbers!");
-  } 
-  foreach $i (@dims) {
-    unshift @newdims, $i;
-  } 
-  $name="n_@{newdims}_b";
-  if ( !defined($plan_cache{$name}) ) {
-    my $pdldims = long [@newdims];
-    $plan_cache{$name} = PDL_fftwnd_create_plan($pdldims,1,$wisdom_loaded+2);
-  }
-  $in->make_physical;
-  PDL_inplace_fftwnd_one($plan_cache{$name},$in);
-  return $in;
-}
-
-=head2 rfftwconv
-
-=for ref
-
-ND convolution using real ffts from the FFTW library
-
-=for example
-
-  $conv = rfftwconv $im, kernctr $im, $k; # kernctr is from PDL::FFT
-
-=cut
-
-*PDL::rfftwconv = \&rfftwconv;
-sub rfftwconv {
-  my ($a,$b) = @_;
-  my ($ca,$cb) = (rfftw($a), rfftw($b));
-  my $cmul = Cmul($ca,$cb);
-  my $ret = irfftw($cmul);
-  my $mul = 1; for (0..$a->getndims-1) {$mul *= $a->getdim($_)}
-  $ret /= $mul;
-  return $ret;
-}
-
-=head2 fftwconv
-
-=for ref
-
-ND convolution using complex ffts from the FFTW library
-
-Assumes real input!
-
-=for example
-
-  $conv = fftwconv $im, kernctr $im, $k; # kernctr is from PDL::FFT
-
-=cut
-
-*PDL::fftwconv = \&fftconv;
-sub fftwconv {
-  my ($a,$b) = @_;
-  my ($ca,$cb) = (PDL->zeroes(2,$a->dims),PDL->zeroes(2,$b->dims));
-  $ca->slice('(0)') .= $a;
-  $cb->slice('(0)') .= $b;
-  nfftw($ca); nfftw($cb);
-  my $cmul = Cmul($ca,$cb);
-  infftw $cmul;  # transfer back inplace
-  # and return real part only
-  my $ret = $cmul->slice('(0)')->sever;
-  my $mul = 1; for (0..$a->getndims-1) {$mul *= $a->getdim($_)}
-  $ret /= $mul;
-  return $ret;
-}
-
-|);
-
-pp_def('Cmul',
-       Pars => 'a(n); b(n); [o]c(n);',
-       Code => '
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-$c(n => 0)= $a(n => 0)*$b(n => 0) - $a(n => 1)*$b(n => 1);
-$c(n => 1)= $a(n => 0)*$b(n => 1) + $a(n => 1)*$b(n => 0);
-%}
-',
-	Doc => <<'EOD',
-=head2 Cmul
-
-=for ref
-
-Complex multiplication
-
-=for usage
-
-   $out_pdl_cplx = Cmul($a_pdl_cplx,$b_pdl_cplx);
-
-=cut
-
-EOD
-      );
-
-pp_def('Cscale',
-       Pars => 'a(n); b(); [o]c(n);',
-       Code => '
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-$c(n => 0)= $a(n => 0)*$b();
-$c(n => 1)= $a(n => 1)*$b();
-%}
-',
-	Doc => <<'EOD',
-=head2 Cscale
-
-=for ref
-
-Complex by real multiplation.
-
-=for usage
-
-  $out_pdl_cplx = Cscale($a_pdl_cplx,$b_pdl_real);
-
-=cut
-
-EOD
-      );
-
-pp_def('Cdiv',
-       Pars => 'a(n); b(n); [o]c(n);',
-       Code => '
-$GENERIC() divi;
-
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-divi = $b(n => 0)*$b(n => 0) + $b(n => 1)*$b(n => 1);
-
-$c(n => 0)= ( $a(n => 0)*$b(n => 0) + $a(n => 1)*$b(n => 1) ) / divi;
-$c(n => 1)= ( $a(n => 1)*$b(n => 0) - $a(n => 0)*$b(n => 1) ) / divi;
-%}
-',
-	Doc => <<'EOD',
-=head2 Cdiv
-
-=for ref
-
-Complex division.
-
-=for usage
-
-  $out_pdl_cplx = Cdiv($a_pdl_cplx,$b_pdl_cplx);
-
-=cut
-
-EOD
-      );
-
-pp_def('Cbmul',
-       Pars => 'a(n); b(n);',
-       Code => '
-$GENERIC() tmp1,tmp;
-
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-tmp = $a(n => 0);
-tmp1 = $a(n => 1);
-$a(n => 0)= tmp * $b(n => 0) - tmp1 * $b(n => 1);
-$a(n => 1)= tmp * $b(n => 1) + tmp1 * $b(n => 0);
-%}
-',
-	Doc => <<'EOD',
-=head2 Cbmul
-
-=for ref
-
-Complex inplace multiplication.
-
-=for usage
-
-   Cbmul($a_pdl_cplx,$b_pdl_cplx);
-
-=cut
-
-EOD
-      );
-
-pp_def('Cbscale',
-       Pars => 'a(n); b();',
-       Code => '
-$GENERIC() tmp1,tmp,divi;
-
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-$a(n => 0) *= $b();
-$a(n => 1) *= $b();
-%}
-',
-	Doc => <<'EOD',
-=head2 Cbscale
-
-=for ref
-
-Complex inplace multiplaction by real.
-
-=for usage
-
-   Cbscale($a_pdl_cplx,$b_pdl_real);
-
-=cut
-
-EOD
-      );
-
-pp_def('Cconj',
-       Pars => 'a(n); [o]c(n);',
-       Code => '
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-$c(n => 0)= $a(n => 0);
-$c(n => 1)= -$a(n => 1);
-%}
-',
-	Doc => <<'EOD',
-=head2 Cconj
-
-=for ref
-
-Complex conjugate.
-
-=for usage
-
-   $out_pdl_cplx = Cconj($a_pdl_cplx);
-
-=cut
-
-EOD
-      );
-
-pp_def('Cbconj',
-       Pars => 'a(n);',
-       Code => '
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-$a(n => 1)= -$a(n => 1);
-%}
-',
-	Doc => <<'EOD',
-=head2 Cbconj
-
-=for ref
-
-Complex inplace conjugate.
-
-=for usage
-
-   Cbconj($a_pdl_cplx);
-
-=cut
-
-EOD
-      );
-
-pp_def('Cexp',
-       Pars => 'a(n); [o]c(n);',
-       Code => '
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-$c(n => 0)= exp($a(n => 0)) * cos($a(n => 1));
-$c(n => 1)= exp($a(n => 0)) * sin($a(n => 1));
-%}
-',
-	Doc => <<'EOD',
-=head2 Cexp
-
-=for ref
-
-Complex exponentation.
-
-=for usage
-
-   $out_pdl_cplx = Cexp($a_pdl_cplx);
-
-=cut
-
-EOD
-      );
-
-pp_def('Cbexp',
-       Pars => 'a(n);',
-       Code => '
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-double re = $a(n => 0);
-double im = $a(n => 1);
-
-$a(n => 0)= exp(re) * cos(im);
-$a(n => 1)= exp(re) * sin(im);
-%}
-',
-	Doc => <<'EOD',
-=head2 Cbexp
-
-=for ref
-
-Complex inplace exponentation.
-
-=for usage
-
-   $out_pdl_cplx = Cbexp($a_pdl_cplx);
-
-=cut
-
-EOD
-      );
-
-pp_def('Cmod',
-       Pars => 'a(n); [o]c();',
-       Code => '
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-$c()= sqrt ( $a(n => 0)*$a(n => 0) + $a(n => 1)*$a(n => 1) );
-%}
-',
-	Doc => <<'EOD',
-=head2 Cmod
-
-=for ref
-
-modulus of a complex piddle.
-
-=for usage
-
-  $out_pdl_real = Cmod($a_pdl_cplx);
-
-=cut
-
-EOD
-      );
-
-pp_def('Carg',
-       Pars => 'a(n); [o]c();',
-       Code => '
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-$c()= atan2($a(n=>1),$a(n=>0));
-%}
-',
-	Doc => <<'EOD',
-=head2 Carg
-
-=for ref
-
-argument of a complex number.
-
-=for usage
-
-   $out_pdl_real = Carg($a_pdl_cplx);
-
-=cut
-
-EOD
-      );
-
-pp_def('Cmod2',
-       Pars => 'a(n); [o]c();',
-       Code => '
-if ($SIZE(n)!=2) barf("This function works only on complex\n");
-threadloop %{
-$c()= ( $a(n => 0)*$a(n => 0) + $a(n => 1)*$a(n => 1) );
-%}
-',
-	Doc => <<'EOD',
-=head2 Cmod2
-
-=for ref
-
-Returns squared modulus of a complex number.
-
-=for usage
-
-   $out_pdl_real = Cmod2($a_pdl_cplx);
-
-=cut
-
-EOD
-      );
-
-
-### real fftw
-
-pp_addxs('','
-MODULE = PDL::FFTW PACKAGE = PDL::FFTW
-
-void *
-PDL_rfftwnd_create_plan(dims, dir, flag)
-  pdl* dims
-  int dir
-  int flag
-CODE:
- {
-  fftw_direction fdir=0;
-  int fflag=FFTW_USE_WISDOM;
-
-  if (dims->ndims != 1) {barf("Only 1d input dimesions make sense");} 
-  if (dims->data == NULL) {barf("input piddles must be physical");} 
-  if (dims->datatype != PDL_L) {barf("Only integers please");} 
-
-  if (dir) {
-    fdir=FFTW_COMPLEX_TO_REAL;
-  }
-  else {
-    fdir=FFTW_REAL_TO_COMPLEX;
-  }
-  if (flag & 1 ) { 
-    fflag |= FFTW_ESTIMATE;
-  }
-  else {
-    fflag |= FFTW_MEASURE;
-  }
-  if (flag & 2 ) { 
-    fflag |= FFTW_IN_PLACE;
-  }
-  else {
-    fflag |= FFTW_OUT_OF_PLACE;
-  }
- 
-  RETVAL = 
-      (void *) rfftwnd_create_plan( dims->dims[0], 
-			    ( int *) dims->data,
-			    fdir,
-			    fflag);
-
- }
-OUTPUT:
- RETVAL
-'
-);
-
-pp_addxs('','
-MODULE = PDL::FFTW PACKAGE = PDL::FFTW
-
-void
-PDL_rfftwnd_one_real_to_complex(plan, in, out)
-  void * plan
-  pdl* in
-  pdl* out
- CODE:
-  if (in->data==NULL || out->data==NULL) {barf("Need a physical pdl!");}
-  if (in->datatype != PDL_MYTYPE || out->datatype != PDL_MYTYPE) {barf("Bad Type");}
-  rfftwnd_one_real_to_complex( (rfftwnd_plan) plan, (fftw_real *) in->data, (fftw_complex *) out->data);
-');
-
-pp_addxs('','
-MODULE = PDL::FFTW PACKAGE = PDL::FFTW
-
-void
-PDL_rfftwnd_one_complex_to_real(plan, in, out)
-  void * plan
-  pdl* in
-  pdl* out
- CODE:
-  if (in->data==NULL || out->data==NULL) {barf("Need a physical pdl!");}
-  if (in->datatype != PDL_MYTYPE || out->datatype != PDL_MYTYPE) {barf("Bad type");} 
-  rfftwnd_one_complex_to_real( (rfftwnd_plan) plan, (fftw_complex *) in->data, (fftw_real *) out->data);
-
-
-');
-
-# NOTE: BUG! the inplace code below will not work with slices!
-# no backpropagation of results!
-pp_addxs('','
-MODULE = PDL::FFTW PACKAGE = PDL::FFTW
-
-void
-PDL_inplace_rfftwnd_one_real_to_complex(plan, in)
-  void * plan
-  pdl* in
- CODE:
-  if (in->data==NULL) {barf("Need a physical pdl!");}
-  if (in->datatype != PDL_MYTYPE) {barf("Bad Type");}
-  PDL->children_changesoon(in, PDL_PARENTDATACHANGED);
-  rfftwnd_one_real_to_complex( (rfftwnd_plan) plan, (fftw_real *) in->data, NULL);
-  /* this call is crucial to propagate changes back if slices are given as arguments
-   * Note: must not used vaffinechanged (!) since any slice has physical data
-   */
-  PDL->changed( in , PDL_PARENTDATACHANGED , 0 );
-');
-
-pp_addxs('','
-MODULE = PDL::FFTW PACKAGE = PDL::FFTW
-
-void
-PDL_inplace_rfftwnd_one_complex_to_real(plan, in)
-  void * plan
-  pdl* in
- CODE:
-  if (in->data==NULL) {barf("Need a physical pdl!");}
-  if (in->datatype != PDL_MYTYPE) {barf("Bad type");} 
-  PDL->children_changesoon(in, PDL_PARENTDATACHANGED);
-  rfftwnd_one_complex_to_real( (rfftwnd_plan) plan, (fftw_complex *) in->data, NULL);
-  /* this call is crucial to propagate changes back if slices are given as arguments
-   * Note: must not used vaffinechanged (!) since any slice has physical data
-   */
-  PDL->changed( in , PDL_PARENTDATACHANGED , 0 );
-
-');
-
-### complex fftw
-
-pp_addxs('','
-MODULE = PDL::FFTW PACKAGE = PDL::FFTW
-
-void *
-PDL_fftwnd_create_plan(dims, dir, flag)
-  pdl* dims
-  int dir
-  int flag
-CODE:
- {
-  fftw_direction fdir=0;
-  int fflag=FFTW_USE_WISDOM;
-
-  if (dims->ndims != 1) {barf("Only 1d input dimesions make sense");} 
-  if (dims->data == NULL) {barf("input piddles must be physical");} 
-  if (dims->datatype != PDL_L) {barf("Only integers please");} 
-
-  if (dir) {
-    fdir=FFTW_BACKWARD;
-  }
-  else {
-    fdir=FFTW_FORWARD;
-  }
-  if (flag & 1 ) { 
-    fflag |= FFTW_ESTIMATE;
-  }
-  else {
-    fflag |= FFTW_MEASURE;
-  }
-  if (flag & 2 ) { 
-    fflag |= FFTW_IN_PLACE;
-  }
-  else {
-    fflag |= FFTW_OUT_OF_PLACE;
-  }
- 
-  RETVAL = 
-  (void *) fftwnd_create_plan( dims->dims[0], 
-			    ( int *) dims->data,
-			    fdir,
-			    fflag);
-
- }
-OUTPUT:
- RETVAL
-'
-);
-
-pp_addxs('','
-MODULE = PDL::FFTW PACKAGE = PDL::FFTW
-
-void
-PDL_fftwnd_one(plan, in, out)
-  void * plan
-  pdl* in
-  pdl* out
- CODE:
-  if (in->data==NULL || out->data==NULL) {barf("Need a physical pdl!");}
-  if (in->datatype != PDL_MYTYPE || out->datatype != PDL_MYTYPE) {barf("Bad type!");} 
-  fftwnd_one( (fftwnd_plan) plan, (fftw_complex *) in->data, (fftw_complex *) out->data);
-');
-
-pp_addxs('','
-MODULE = PDL::FFTW PACKAGE = PDL::FFTW
-
-void
-PDL_inplace_fftwnd_one(plan, in)
-  void * plan
-  pdl* in
- CODE:
-  if (in->data==NULL) {barf("Need a physical pdl!");}
-  if (in->datatype != PDL_MYTYPE) {barf("Only float please");} 
-  PDL->children_changesoon(in, PDL_PARENTDATACHANGED);
-  fftwnd_one( (fftwnd_plan) plan, (fftw_complex *) in->data, NULL);
-  /* this call is crucial to propagate changes back if slices are given as arguments
-   * Note: must not used vaffinechanged (!) since any slice has physical data
-   */
-  PDL->changed( in , PDL_PARENTDATACHANGED , 0 );
-');
-
-### wisdom stuff
-
-pp_addxs('','
-MODULE = PDL::FFTW PACKAGE = PDL::FFTW
-
-int
-PDL_fftw_import_wisdom_from_string (wisdom)
- char* wisdom
- CODE:
-  RETVAL = ( fftw_import_wisdom_from_string(wisdom) == FFTW_SUCCESS );
- OUTPUT:
-  RETVAL
-');
-
-pp_addxs('','
-MODULE = PDL::FFTW PACKAGE = PDL::FFTW
-
-char* 
-PDL_fftw_export_wisdom_to_string ()
- CODE:
-  RETVAL = fftw_export_wisdom_to_string();
- OUTPUT:
-  RETVAL
-');
-
-
-pp_add_exported('','load_wisdom save_wisdom rfftw irfftw fftw ifftw
-nfftw infftw nrfftw inrfftw fftwconv rfftwconv kernctr');
-
-# I don't see a point in exporting these (CS)
-# 'PDL_rfftwnd_create_plan PDL_rfftwnd_one_real_to_complex PDL_rfftwnd_one_complex_to_real PDL_fftw_export_wisdom_to_string PDL_fftw_import_wisdom_from_string PDL_inplace_fftwnd_one PDL_fftwnd_one PDL_fftwnd_create_plan PDL_inplace_rfftwnd_one_real_to_complex PDL_inplace_rfftwnd_one_complex_to_real';
-
-pp_addpm({At => 'Bot'},<< 'EOD');
-=head1 AUTHOR
-
-Copyright (C) 1999 Christian Pellegrin, 2000 Christian Soeller.
-All rights reserved. There is no warranty. You are allowed
-to redistribute this software / documentation under certain
-conditions. For details, see the file COPYING in the PDL
-distribution. If this file is separated from the PDL distribution,
-the copyright notice should be included in the file.
-
-=cut
-
-
-EOD
-
-pp_done();
@@ -4,7 +4,8 @@ WriteMakefile(
         VERSION_FROM => '../../Basic/Core/Version.pm',
         PM => {
          map {($_ => '$(INST_LIBDIR)/Filter/'.$_)} <*.pm>
-        }
+        },
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
        );
 __END__
 
@@ -6,5 +6,6 @@ WriteMakefile(
 	VERSION_FROM => '../../Basic/Core/Version.pm',
 	DIR =>  [ qw/Gaussian/ ],
 	PM => { map {($_ => '$(INST_LIBDIR)/Fit/'.$_)} <*.pm> },
+        (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -1,7 +1,7 @@
 
 =head1 NAME
 
-PDL::Func - useful functions
+PDL::Func - interpolation, integration, & gradient estimation (differentiation) of functions
 
 =head1 SYNOPSIS
 
@@ -480,8 +480,8 @@ sub _get_value {
 
 =for usage
 
- my $nset = $obj->set( x => $newx, $y => $newy );
- my $nset = $obj->set( { x => $newx, $y => $newy } );
+ my $nset = $obj->set( x => $newx, y => $newy );
+ my $nset = $obj->set( { x => $newx, y => $newy } );
 
 =for ref
 
@@ -933,11 +933,6 @@ current implementation, as it is not too sensible.
 
 Thanks to Robin Williams, Halldór Olafsson, and Vince McIntyre.
 
-=head1 THE FUTURE
-
-Robin is working on a new version, that improves on the current version
-a lot. No time scale though!
-
 =head1 AUTHOR
 
 Copyright (C) 2000,2001 Doug Burke (dburke@cfa.harvard.edu).
@@ -4,5 +4,6 @@ WriteMakefile(
     'NAME' => 'PDL::Lib::GIS',
     VERSION_FROM => '../../Basic/Core/Version.pm',
     DIR =>  [ qw/ Proj / ],
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -115,6 +115,19 @@ BEGIN
       . "\tPlease add the correct library path to Makefile.PL or install $lib_name.\n";
    }
 
+   # Check for PROJ4 library version
+   {
+      open PJAPI, "$include_path/proj_api.h" or warn "Couldn't open '$include_path/proj_api.h': $!"; 
+      while (<PJAPI>) {
+         $PJ_VERSION = $1 if m/^\# define \s+ PJ_VERSION \s+ (\d+)/x ;
+         if (defined($PJ_VERSION)) {
+            warn " Got PJ_VERSION=$PJ_VERSION\n";
+            last;
+         }
+      }
+      close PJAPI;
+   }
+
    #
    # Make sure everything we wanted is found:
    #
@@ -125,7 +138,7 @@ BEGIN
 
    skip:
 
-   if ($msg && $forcebuild==0)
+   if ($msg && $forcebuild==0 or !defined($PJ_VERSION))
    {
       warn " Testing support libraries for $package_name:\n$msg\n";
       $msg =~ s/\n//g;
@@ -144,8 +157,6 @@ BEGIN
 
       if (trylink($infomsg,$include,$progbody,$libs,$cflags) or $forcebuild) {
          # now see if pj_init works
-         ## print STDERR "header=>$header, LIBS=>$libs, INC=>$cflags, function=>'projPJ mypj = pj_init_plus(\"+proj=eqc +lon_0=0\"); if (! mypj) return 1; else return 0;'\n";
-
          if (
             check_lib(
                function=>'projPJ mypj = pj_init_plus("+proj=eqc +lon_0=0"); if (! mypj) return 1; else return 0;',
@@ -153,7 +164,7 @@ BEGIN
                incpath=>$include_path,
                lib=>'proj',
                libpath=>$gis_proj_lib_path,
-            ) or $forcebuild) {
+            ) or $forcebuild ) {
             print " Building $package_name. Turn off $config_flag if there are any problems\n\n";
             $PDL::Config{$config_flag}=1;
             $donot = 0;
@@ -161,13 +172,21 @@ BEGIN
          else {
             warn " PROJ4 library found but cannot initialize projection, won't build\n";
             $PDL::Config{$config_flag}=0;
-            $donot = 1;
+            $msg =~ s/\n//g;  # TODO: update $msg for tests
+            unless ($donot) {
+               write_dummy_make( $msg );
+               $donot = 1;
+            }
          }
       }
       else {
          warn " Include+Library configuration for PROJ4 does not support the projUV type\n";
          $PDL::Config{$config_flag}=0;
-         $donot = 1;
+         $msg =~ s/\n//g;  # TODO: update $msg for tests
+         unless ($donot) {
+            write_dummy_make( $msg );
+            $donot = 1;
+         }
       }
    }
 
@@ -175,13 +194,14 @@ BEGIN
 
 return if $donot;  # yes, this must be return (exit will kill Makefile.PL process)
 
+## $DB::single = 1;  # uncomment to have debugger stop here
 $ppfile = "Proj.pd";
 $package = [$ppfile, Proj, $package_name];
 %hash = pdlpp_stdargs($package);
 $hash{VERSION_FROM} = $ppfile;
 #$hash{TYPEMAPS} = [&PDL_TYPEMAP()];
 $hash{LIBS} = ["-L$gis_proj_lib_path -lproj -lm"];
-$hash{INC} = PDL_INCLUDE() . " -I$include_path";
+$hash{INC} = PDL_INCLUDE() . " -I$include_path" . ( ($PJ_VERSION==480) ? " -Iinclude/" : '' );
 WriteMakefile(%hash);
 
 sub MY::postamble { pdlpp_postamble_int( $package ); }
@@ -195,8 +195,7 @@ const double d2r = DEG_TO_RAD;
 proj = pj_init_plus( $COMP(params) );
 if( proj == NULL )
 {
-    sprintf(errstr, "%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
-    croak(errstr);
+    croak("%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
 }
 
 /* Loop over the values converting as we go */
@@ -208,9 +207,8 @@ loop (n)
     out = pj_fwd(in, proj);
     if (out.u == HUGE_VAL)
     {
-        sprintf(errstr, "%s: Projection conversion failed at (%f, %f): %s\n",
+        croak("%s: Projection conversion failed at (%f, %f): %s\n",
                 func, $lon(), $lat(), pj_strerrno(pj_errno));
-        croak(errstr);
     }
     $x() = out.u;
     $y() = out.v;
@@ -231,8 +229,7 @@ const double d2r = DEG_TO_RAD;
 proj = pj_init_plus( $COMP(params) );
 if( proj == NULL )
 {
-    sprintf(errstr, "%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
-    croak(errstr);
+    croak("%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
 }
 
 /* Loop over the values converting as we go */
@@ -251,9 +248,8 @@ loop (n)
         out = pj_fwd(in, proj);
         if (out.u == HUGE_VAL)
         {
-            sprintf(errstr, "%s: Projection conversion failed at (%f, %f): %s\n",
+            croak("%s: Projection conversion failed at (%f, %f): %s\n",
                     func, $lon(), $lat(), pj_strerrno(pj_errno));
-            croak(errstr);
         }
         $x() = out.u;
         $y() = out.v;
@@ -305,8 +301,7 @@ const double d2r = DEG_TO_RAD;
 proj = pj_init_plus( $COMP(params) );
 if( proj == NULL )
 {
-    sprintf(errstr, "%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
-    croak(errstr);
+    croak("%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
 }
 
 /* Loop over the values converting as we go */
@@ -318,9 +313,8 @@ threadloop
     out = pj_fwd(in, proj);
     if (out.u == HUGE_VAL)
     {
-        sprintf(errstr, "%s: Projection conversion failed at (%f, %f): %s\n",
+        croak("%s: Projection conversion failed at (%f, %f): %s\n",
                 func, $lon(), $lat(), pj_strerrno(pj_errno));
-        croak(errstr);
     }
     $lon() = out.u;
     $lat() = out.v;
@@ -342,8 +336,7 @@ int loud = ! $COMP(quiet);
 proj = pj_init_plus( $COMP(params) );
 if( proj == NULL )
 {
-    sprintf(errstr, "%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
-    croak(errstr);
+    croak("%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
 }
 
 /* Loop over the values converting as we go */
@@ -403,8 +396,7 @@ const double r2d = RAD_TO_DEG;
 proj = pj_init_plus( $COMP(params) );
 if( proj == NULL )
 {
-    sprintf(errstr, "Projection initialization failed: %s\n", pj_strerrno(pj_errno));
-    croak(errstr);
+    croak("Projection initialization failed: %s\n", pj_strerrno(pj_errno));
 }
 
 /* Loop over the values converting as we go */
@@ -416,8 +408,7 @@ loop (n)
     out = pj_inv(in, proj);
     if (out.u == HUGE_VAL)
     {
-        sprintf(errstr, "Projection conversion failed: %s\n", pj_strerrno(pj_errno));
-        croak(errstr);
+        croak("Projection conversion failed: %s\n", pj_strerrno(pj_errno));
     }
 
     $lon() = out.u * r2d;
@@ -439,8 +430,7 @@ const double r2d = RAD_TO_DEG;
 proj = pj_init_plus( $COMP(params) );
 if( proj == NULL )
 {
-    sprintf(errstr, "Projection initialization failed: %s\n", pj_strerrno(pj_errno));
-    croak(errstr);
+    croak("Projection initialization failed: %s\n", pj_strerrno(pj_errno));
 }
 
 /* Loop over the values converting as we go */
@@ -459,8 +449,7 @@ loop (n)
         out = pj_inv(in, proj);
         if (out.u == HUGE_VAL)
         {
-            sprintf(errstr, "Projection conversion failed: %s\n", pj_strerrno(pj_errno));
-            croak(errstr);
+            croak("Projection conversion failed: %s\n", pj_strerrno(pj_errno));
         }
 
         $lon() = out.u * r2d;
@@ -513,8 +502,7 @@ const double r2d = RAD_TO_DEG;
 proj = pj_init_plus( $COMP(params) );
 if( proj == NULL )
 {
-    sprintf(errstr, "%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
-    croak(errstr);
+    croak("%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
 }
 
 /* Loop over the values converting as we go */
@@ -526,8 +514,7 @@ threadloop
     out = pj_inv(in, proj);
     if (out.u == HUGE_VAL)
     {
-        sprintf(errstr, "%s: Projection conversion failed: %s\n", func, pj_strerrno(pj_errno));
-        croak(errstr);
+        croak("%s: Projection conversion failed: %s\n", func, pj_strerrno(pj_errno));
     }
 
     $x() = out.u * r2d;
@@ -550,8 +537,7 @@ int loud = ! $COMP(quiet);
 proj = pj_init_plus( $COMP(params) );
 if( proj == NULL )
 {
-    sprintf(errstr, "%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
-    croak(errstr);
+    croak("%s: Projection initialization failed: %s\n", func, pj_strerrno(pj_errno));
 }
 
 /* Loop over the values converting as we go */
@@ -0,0 +1,476 @@
+/******************************************************************************
+ * $Id: projects.h 2121 2011-11-22 22:51:47Z warmerdam $
+ *
+ * Project:  PROJ.4
+ * Purpose:  Primary (private) include file for PROJ.4 library.
+ * Author:   Gerald Evenden
+ *
+ ******************************************************************************
+ * Copyright (c) 2000, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *****************************************************************************/
+
+/* General projections header file */
+#ifndef PROJECTS_H
+#define PROJECTS_H
+
+#ifdef _MSC_VER
+#  ifndef _CRT_SECURE_NO_DEPRECATE
+#    define _CRT_SECURE_NO_DEPRECATE
+#  endif
+#  ifndef _CRT_NONSTDC_NO_DEPRECATE
+#    define _CRT_NONSTDC_NO_DEPRECATE
+#  endif
+#endif
+
+/* standard inclusions */
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef __cplusplus
+#define C_NAMESPACE extern "C"
+#define C_NAMESPACE_VAR extern "C"
+extern "C" {
+#else    
+#define C_NAMESPACE extern
+#define C_NAMESPACE_VAR
+#endif
+
+#ifndef NULL
+#  define NULL	0
+#endif
+
+#ifndef FALSE
+#  define FALSE	0
+#endif
+
+#ifndef TRUE
+#  define TRUE	1
+#endif
+
+#ifndef MAX
+#  define MIN(a,b)      ((a<b) ? a : b)
+#  define MAX(a,b)      ((a>b) ? a : b)
+#endif
+
+#ifndef ABS
+#  define ABS(x)        ((x<0) ? (-1*(x)) : x)
+#endif
+
+    /* maximum path/filename */
+#ifndef MAX_PATH_FILENAME
+#define MAX_PATH_FILENAME 1024
+#endif
+	/* prototype hypot for systems where absent */
+#ifndef _WIN32
+extern double hypot(double, double);
+#endif
+
+#ifdef _WIN32_WCE
+#  include <wce_stdlib.h>
+#  include <wce_stdio.h>
+#  define rewind wceex_rewind
+#  define getenv wceex_getenv
+#  define strdup _strdup
+#  define hypot _hypot
+#endif
+
+	/* some useful constants */
+#define HALFPI		1.5707963267948966
+#define FORTPI		0.78539816339744833
+#define PI		3.14159265358979323846
+#define TWOPI		6.2831853071795864769
+
+/* environment parameter name */
+#ifndef PROJ_LIB
+#define PROJ_LIB "PROJ_LIB"
+#endif
+/* maximum tag id length for +init and default files */
+#ifndef ID_TAG_MAX
+#define ID_TAG_MAX 50
+#endif
+
+/* Use WIN32 as a standard windows 32 bit declaration */
+#if defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE)
+#  define WIN32
+#endif
+
+#if defined(_WINDOWS) && !defined(WIN32) && !defined(_WIN32_WCE)
+#  define WIN32
+#endif
+
+/* directory delimiter for DOS support */
+#ifdef WIN32
+#define DIR_CHAR '\\'
+#else
+#define DIR_CHAR '/'
+#endif
+
+/* proj thread context */
+typedef struct {
+    int	    last_errno;
+    int     debug_level;
+    void    (*logger)(void *, int, const char *);
+    void    *app_data;
+} projCtx_t;
+
+/* datum_type values */
+#define PJD_UNKNOWN   0
+#define PJD_3PARAM    1   
+#define PJD_7PARAM    2   
+#define PJD_GRIDSHIFT 3
+#define PJD_WGS84     4   /* WGS84 (or anything considered equivelent) */
+
+/* library errors */
+#define PJD_ERR_GEOCENTRIC          -45
+#define PJD_ERR_AXIS                -47
+#define PJD_ERR_GRID_AREA           -48
+
+#define USE_PROJUV 
+
+typedef struct { double u, v; } projUV;
+typedef struct { double r, i; }	COMPLEX;
+
+#ifndef PJ_LIB__
+#define XY projUV
+#define LP projUV
+#else
+typedef struct { double x, y; }     XY;
+typedef struct { double lam, phi; } LP;
+#endif
+
+typedef union { double  f; int  i; char *s; } PJ_VALUE;
+struct PJconsts;
+    
+struct PJ_LIST {
+	char	*id;		/* projection keyword */
+	struct PJconsts	*(*proj)(struct PJconsts*);/* projection entry point */
+	char 	* const *descr;	/* description text */
+};
+struct PJ_ELLPS {
+	char	*id;	/* ellipse keyword name */
+	char	*major;	/* a= value */
+	char	*ell;	/* elliptical parameter */
+	char	*name;	/* comments */
+};
+struct PJ_UNITS {
+	char	*id;	/* units keyword */
+	char	*to_meter;	/* multiply by value to get meters */
+	char	*name;	/* comments */
+};
+
+struct PJ_DATUMS {
+    char    *id;     /* datum keyword */
+    char    *defn;   /* ie. "to_wgs84=..." */
+    char    *ellipse_id; /* ie from ellipse table */
+    char    *comments; /* EPSG code, etc */
+};
+
+struct PJ_PRIME_MERIDIANS {
+    char    *id;     /* prime meridian keyword */
+    char    *defn;   /* offset from greenwich in DMS format. */
+};
+
+struct DERIVS {
+    double x_l, x_p; /* derivatives of x for lambda-phi */
+    double y_l, y_p; /* derivatives of y for lambda-phi */
+};
+    
+struct FACTORS {
+	struct DERIVS der;
+	double h, k;	/* meridinal, parallel scales */
+	double omega, thetap;	/* angular distortion, theta prime */
+	double conv;	/* convergence */
+	double s;		/* areal scale factor */
+	double a, b;	/* max-min scale error */
+	int code;		/* info as to analytics, see following */
+};
+#define IS_ANAL_XL_YL 01	/* derivatives of lon analytic */
+#define IS_ANAL_XP_YP 02	/* derivatives of lat analytic */
+#define IS_ANAL_HK	04		/* h and k analytic */
+#define IS_ANAL_CONV 010	/* convergence analytic */
+    /* parameter list struct */
+typedef struct ARG_list {
+	struct ARG_list *next;
+	char used;
+	char param[1]; } paralist;
+	/* base projection data structure */
+
+
+typedef struct PJconsts {
+    projCtx_t *ctx;
+	XY  (*fwd)(LP, struct PJconsts *);
+	LP  (*inv)(XY, struct PJconsts *);
+	void (*spc)(LP, struct PJconsts *, struct FACTORS *);
+	void (*pfree)(struct PJconsts *);
+	const char *descr;
+	paralist *params;   /* parameter list */
+	int over;   /* over-range flag */
+	int geoc;   /* geocentric latitude flag */
+        int is_latlong; /* proj=latlong ... not really a projection at all */
+        int is_geocent; /* proj=geocent ... not really a projection at all */
+	double
+		a,  /* major axis or radius if es==0 */
+                a_orig, /* major axis before any +proj related adjustment */
+		es, /* e ^ 2 */
+                es_orig, /* es before any +proj related adjustment */
+		e,  /* eccentricity */
+		ra, /* 1/A */
+		one_es, /* 1 - e^2 */
+		rone_es, /* 1/one_es */
+		lam0, phi0, /* central longitude, latitude */
+		x0, y0, /* easting and northing */
+		k0,	/* general scaling factor */
+		to_meter, fr_meter; /* cartesian scaling */
+    
+        int     datum_type; /* PJD_UNKNOWN/3PARAM/7PARAM/GRIDSHIFT/WGS84 */
+        double  datum_params[7];
+        struct _pj_gi **gridlist;
+        int     gridlist_count;
+
+        int     has_geoid_vgrids;
+        struct _pj_gi **vgridlist_geoid;
+        int     vgridlist_geoid_count;
+        double  vto_meter, vfr_meter;
+
+        double  from_greenwich; /* prime meridian offset (in radians) */
+        double  long_wrap_center; /* 0.0 for -180 to 180, actually in radians*/
+        int     is_long_wrap_set;
+        char    axis[4];
+        
+#ifdef PROJ_PARMS__
+PROJ_PARMS__
+#endif /* end of optional extensions */
+} PJ;
+
+/* public API */
+#include "proj_api.h"
+
+/* Generate pj_list external or make list from include file */
+#ifndef PJ_LIST_H
+extern struct PJ_LIST pj_list[];
+#else
+#define PROJ_HEAD(id, name) \
+    struct PJconsts *pj_##id(struct PJconsts*); extern char * const pj_s_##id;
+    
+#ifndef lint
+#define DO_PJ_LIST_ID
+#endif
+#include PJ_LIST_H
+#ifndef lint
+#undef DO_PJ_LIST_ID
+#endif
+#undef PROJ_HEAD
+#define PROJ_HEAD(id, name) {#id, pj_##id, &pj_s_##id},
+	struct PJ_LIST
+pj_list[] = {
+#include PJ_LIST_H
+		{0,     0,  0},
+	};
+#undef PROJ_HEAD
+#endif
+
+#ifndef PJ_ELLPS__
+extern struct PJ_ELLPS pj_ellps[];
+#endif
+
+#ifndef PJ_UNITS__
+extern struct PJ_UNITS pj_units[];
+#endif
+
+#ifndef PJ_DATUMS__
+extern struct PJ_DATUMS pj_datums[];
+extern struct PJ_PRIME_MERIDIANS pj_prime_meridians[];
+#endif
+
+#ifdef PJ_LIB__
+    /* repeatative projection code */
+#define PROJ_HEAD(id, name) static const char des_##id [] = name
+#define ENTRYA(name) \
+        C_NAMESPACE_VAR const char * const pj_s_##name = des_##name; \
+	C_NAMESPACE PJ *pj_##name(PJ *P) { if (!P) { \
+	if( (P = (PJ*) pj_malloc(sizeof(PJ))) != NULL) { \
+        memset( P, 0, sizeof(PJ) ); \
+	P->pfree = freeup; P->fwd = 0; P->inv = 0; \
+	P->spc = 0; P->descr = des_##name;
+#define ENTRYX } return P; } else {
+#define ENTRY0(name) ENTRYA(name) ENTRYX
+#define ENTRY1(name, a) ENTRYA(name) P->a = 0; ENTRYX
+#define ENTRY2(name, a, b) ENTRYA(name) P->a = 0; P->b = 0; ENTRYX
+#define ENDENTRY(p) } return (p); }
+#define E_ERROR(err) { pj_ctx_set_errno( P->ctx, err); freeup(P); return(0); }
+#define E_ERROR_0 { freeup(P); return(0); }
+#define F_ERROR { pj_ctx_set_errno( P->ctx, -20); return(xy); }
+#define I_ERROR { pj_ctx_set_errno( P->ctx, -20); return(lp); }
+#define FORWARD(name) static XY name(LP lp, PJ *P) { XY xy = {0.0,0.0}
+#define INVERSE(name) static LP name(XY xy, PJ *P) { LP lp = {0.0,0.0}
+#define FREEUP static void freeup(PJ *P) {
+#define SPECIAL(name) static void name(LP lp, PJ *P, struct FACTORS *fac)
+#endif
+#define MAX_TAB_ID 80
+typedef struct { float lam, phi; } FLP;
+typedef struct { int lam, phi; } ILP;
+
+struct CTABLE {
+	char id[MAX_TAB_ID]; /* ascii info */
+	LP ll;      /* lower left corner coordinates */
+	LP del;     /* size of cells */
+	ILP lim;    /* limits of conversion matrix */
+	FLP *cvs;   /* conversion matrix */
+};
+
+typedef struct _pj_gi {
+    char *gridname;   /* identifying name of grid, eg "conus" or ntv2_0.gsb */
+    char *filename;   /* full path to filename */
+    
+    const char *format; /* format of this grid, ie "ctable", "ntv1", 
+                           "ntv2" or "missing". */
+
+    int   grid_offset; /* offset in file, for delayed loading */
+
+    struct CTABLE *ct;
+
+    struct _pj_gi *next;
+    struct _pj_gi *child;
+} PJ_GRIDINFO;
+
+/* procedure prototypes */
+double dmstor(const char *, char **);
+double dmstor_ctx(projCtx ctx, const char *, char **);
+void set_rtodms(int, int);
+char *rtodms(char *, double, int, int);
+double adjlon(double);
+double aacos(projCtx,double), aasin(projCtx,double), asqrt(double), aatan2(double, double);
+PJ_VALUE pj_param(projCtx ctx, paralist *, const char *);
+paralist *pj_mkparam(char *);
+int pj_ell_set(projCtx ctx, paralist *, double *, double *);
+int pj_datum_set(projCtx,paralist *, PJ *);
+int pj_prime_meridian_set(paralist *, PJ *);
+int pj_angular_units_set(paralist *, PJ *);
+
+paralist *pj_clone_paralist( const paralist* );
+paralist*pj_search_initcache( const char *filekey );
+void pj_insert_initcache( const char *filekey, const paralist *list);
+
+double *pj_enfn(double);
+double pj_mlfn(double, double, double, double *);
+double pj_inv_mlfn(projCtx, double, double, double *);
+double pj_qsfn(double, double, double);
+double pj_tsfn(double, double, double);
+double pj_msfn(double, double, double);
+double pj_phi2(projCtx, double, double);
+double pj_qsfn_(double, PJ *);
+double *pj_authset(double);
+double pj_authlat(double, double *);
+COMPLEX pj_zpoly1(COMPLEX, COMPLEX *, int);
+COMPLEX pj_zpolyd1(COMPLEX, COMPLEX *, int, COMPLEX *);
+FILE *pj_open_lib(projCtx, char *, char *);
+
+int pj_deriv(LP, double, PJ *, struct DERIVS *);
+int pj_factors(LP, PJ *, double, struct FACTORS *);
+
+struct PW_COEF {/* row coefficient structure */
+    int m;		/* number of c coefficients (=0 for none) */
+    double *c;	/* power coefficients */
+};
+ 
+/* Approximation structures and procedures */
+typedef struct {	/* Chebyshev or Power series structure */
+	projUV a, b;		/* power series range for evaluation */
+					/* or Chebyshev argument shift/scaling */
+	struct PW_COEF *cu, *cv;
+	int mu, mv;		/* maximum cu and cv index (+1 for count) */
+	int power;		/* != 0 if power series, else Chebyshev */
+} Tseries;
+Tseries *mk_cheby(projUV, projUV, double, projUV *, projUV (*)(projUV), int, int, int);
+projUV bpseval(projUV, Tseries *);
+projUV bcheval(projUV, Tseries *);
+projUV biveval(projUV, Tseries *);
+void *vector1(int, int);
+void **vector2(int, int, int);
+void freev2(void **v, int nrows);
+int bchgen(projUV, projUV, int, int, projUV **, projUV(*)(projUV));
+int bch2bps(projUV, projUV, projUV **, int, int);
+/* nadcon related protos */
+LP nad_intr(LP, struct CTABLE *);
+LP nad_cvt(LP, int, struct CTABLE *);
+struct CTABLE *nad_init(projCtx ctx, char *);
+struct CTABLE *nad_ctable_init( projCtx ctx, FILE * fid );
+int nad_ctable_load( projCtx ctx, struct CTABLE *, FILE * fid );
+struct CTABLE *nad_ctable2_init( projCtx ctx, FILE * fid );
+int nad_ctable2_load( projCtx ctx, struct CTABLE *, FILE * fid );
+void nad_free(struct CTABLE *);
+
+/* higher level handling of datum grid shift files */
+
+int pj_apply_vgridshift( PJ *defn, const char *listname,
+                         PJ_GRIDINFO ***gridlist_p, 
+                         int *gridlist_count_p,
+                         int inverse, 
+                         long point_count, int point_offset,
+                         double *x, double *y, double *z );
+int pj_apply_gridshift_2( PJ *defn, int inverse, 
+                          long point_count, int point_offset,
+                          double *x, double *y, double *z );
+int pj_apply_gridshift_3( projCtx ctx, 
+                          PJ_GRIDINFO **gridlist, int gridlist_count,
+                          int inverse, long point_count, int point_offset,
+                          double *x, double *y, double *z );
+
+PJ_GRIDINFO **pj_gridlist_from_nadgrids( projCtx, const char *, int * );
+void pj_deallocate_grids();
+
+PJ_GRIDINFO *pj_gridinfo_init( projCtx, const char * );
+int pj_gridinfo_load( projCtx, PJ_GRIDINFO * );
+void pj_gridinfo_free( projCtx, PJ_GRIDINFO * );
+
+void *proj_mdist_ini(double);
+double proj_mdist(double, double, double, const void *);
+double proj_inv_mdist(projCtx ctx, double, const void *);
+void *pj_gauss_ini(double, double, double *,double *);
+LP pj_gauss(projCtx, LP, const void *);
+LP pj_inv_gauss(projCtx, LP, const void *);
+
+extern char const pj_release[];
+
+struct PJ_ELLPS *pj_get_ellps_ref( void );
+struct PJ_DATUMS *pj_get_datums_ref( void );
+struct PJ_UNITS *pj_get_units_ref( void );
+struct PJ_LIST  *pj_get_list_ref( void );
+struct PJ_PRIME_MERIDIANS  *pj_get_prime_meridians_ref( void );
+ 
+#ifndef DISABLE_CVSID
+#  if defined(__GNUC__) && __GNUC__ >= 4
+#    define PJ_CVSID(string)     static char pj_cvsid[] __attribute__((used)) = string;
+#  else
+#    define PJ_CVSID(string)     static char pj_cvsid[] = string; \
+static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : pj_cvsid ); }
+#  endif
+#else
+#  define PJ_CVSID(string)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* end of basic projections header */
@@ -83,7 +83,7 @@ L<PDL>
 
 The GSL documentation is online at
 
-  http://sources.redhat.com/gsl/ref/gsl-ref_toc.html
+  http://www.gnu.org/software/gsl/manual/
 
 =head1 AUTHOR
 
@@ -499,7 +499,7 @@ L<PDL>
 
 The GSL documentation is online at
 
-  http://sources.redhat.com/gsl/ref/gsl-ref_toc.html
+  http://www.gnu.org/software/gsl/manual/
 
 =head1 AUTHOR
 
@@ -190,7 +190,7 @@ L<PDL>
 
 The GSL documentation is online at
 
-  http://sources.redhat.com/gsl/ref/gsl-ref_toc.html
+  http://www.gnu.org/software/gsl/manual/
 
 =head1 AUTHOR
 
@@ -57,7 +57,7 @@ void DFF(int* n, double* xval, double* vector){
   PDL->children_changesoon(px,PDL_PARENTDIMSCHANGED|PDL_PARENTDATACHANGED);
   PDL->setdims (px,pdims,ndims);
   px->state &= ~PDL_NOMYDIMS;
-  px->state |= PDL_ALLOCATED;
+  px->state |= PDL_ALLOCATED | PDL_DONTTOUCHDATA;
   PDL->changed(px,PDL_PARENTDIMSCHANGED|PDL_PARENTDATACHANGED,0);
 
   px->data = (void *) xval;
@@ -113,7 +113,7 @@ L<PDL>
 
 The GSL documentation is online at
 
-  http://sources.redhat.com/gsl/ref/gsl-ref_toc.html
+  http://www.gnu.org/software/gsl/manual/
 
 
 =head1 AUTHOR
@@ -63,6 +63,7 @@ if (! $new_enough) {
    $PDL::Config{WITH_GSL} = 1;
    WriteMakefile(
       'NAME'	=> 'PDL::GSL',
+       (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
    );
 }
 sub MY::postamble {}
@@ -36,15 +36,19 @@ in the GNU Scientific Library.
 The new method initializes a new instance of the RNG.
 
 The avaible RNGs are:
-slatec, cmrg, gfsr4, minstd, mrg, mt19937, r250, ran0, ran1, ran2,
-ran3, rand48, rand, random8_bsd, random8_glibc2, random8_libc5,
-random128_bsd, random128_glibc2, random128_libc5, random256_bsd,
-random256_glibc2, random256_libc5, random32_bsd, random32_glibc2,
-random32_libc5, random64_bsd, random64_glibc2, random64_libc5,
-random_bsd, random_glibc2, random_libc5, randu, ranf, ranlux389,
-ranlux, ranmar, taus, transputer, tt800, uni32, uni, vax, zuf,
-default. The last one (default) uses the enviroment variable
-GSL_RNG_TYPE. Please check the GSL documentation for more
+coveyou cmrg fishman18 fishman20 fishman2x gfsr4 knuthran
+knuthran2 knuthran2002 lecuyer21 minstd mrg mt19937 mt19937_1999
+mt19937_1998 r250 ran0 ran1 ran2 ran3 rand rand48 random128_bsd
+random128_glibc2 random128_libc5 random256_bsd random256_glibc2
+random256_libc5 random32_bsd random32_glibc2 random32_libc5
+random64_bsd random64_glibc2 random64_libc5 random8_bsd
+random8_glibc2 random8_libc5 random_bsd random_glibc2
+random_libc5 randu ranf ranlux ranlux389 ranlxd1 ranlxd2 ranlxs0
+ranlxs1 ranlxs2 ranmar slatec taus taus2 taus113 transputer tt800
+uni uni32 vax waterman14 zuf default
+The last one (default) uses the enviroment variable
+GSL_RNG_TYPE. Note that only a few of these rngs are recommended
+for general use. Please check the GSL documentation for more
 information.
 
 =for usage
@@ -1090,22 +1094,29 @@ new (CLASS,TYPE)
   gsl_rng * rng = NULL;
   char rngs[5000];
 strcpy(rngs,"");
-DEF_RNG(slatec)
+DEF_RNG(borosh13)
+DEF_RNG(coveyou)
 DEF_RNG(cmrg)
+DEF_RNG(fishman18)
+DEF_RNG(fishman20)
+DEF_RNG(fishman2x)
 DEF_RNG(gfsr4)
+DEF_RNG(knuthran)
+DEF_RNG(knuthran2)
+DEF_RNG(knuthran2002)
+DEF_RNG(lecuyer21)
 DEF_RNG(minstd)
 DEF_RNG(mrg)
 DEF_RNG(mt19937)
+DEF_RNG(mt19937_1999)
+DEF_RNG(mt19937_1998)
 DEF_RNG(r250)
 DEF_RNG(ran0)
 DEF_RNG(ran1)
 DEF_RNG(ran2)
 DEF_RNG(ran3)
-DEF_RNG(rand48)
 DEF_RNG(rand)
-DEF_RNG(random8_bsd)
-DEF_RNG(random8_glibc2)
-DEF_RNG(random8_libc5)
+DEF_RNG(rand48)
 DEF_RNG(random128_bsd)
 DEF_RNG(random128_glibc2)
 DEF_RNG(random128_libc5)
@@ -1118,20 +1129,32 @@ DEF_RNG(random32_libc5)
 DEF_RNG(random64_bsd)
 DEF_RNG(random64_glibc2)
 DEF_RNG(random64_libc5)
+DEF_RNG(random8_bsd)
+DEF_RNG(random8_glibc2)
+DEF_RNG(random8_libc5)
 DEF_RNG(random_bsd)
 DEF_RNG(random_glibc2)
 DEF_RNG(random_libc5)
 DEF_RNG(randu)
 DEF_RNG(ranf)
-DEF_RNG(ranlux389)
 DEF_RNG(ranlux)
+DEF_RNG(ranlux389)
+DEF_RNG(ranlxd1)
+DEF_RNG(ranlxd2)
+DEF_RNG(ranlxs0)
+DEF_RNG(ranlxs1)
+DEF_RNG(ranlxs2)
 DEF_RNG(ranmar)
+DEF_RNG(slatec)
 DEF_RNG(taus)
+DEF_RNG(taus2)
+DEF_RNG(taus113)
 DEF_RNG(transputer)
 DEF_RNG(tt800)
-DEF_RNG(uni32)
 DEF_RNG(uni)
+DEF_RNG(uni32)
 DEF_RNG(vax)
+DEF_RNG(waterman14)
 DEF_RNG(zuf)
 DEF_RNG(default)
   if (rng==NULL) {
@@ -55,5 +55,6 @@ WriteMakefile(
 	VERSION => '0.5',
 	# VERSION_FROM => '../../Basic/Core/Version.pm',
        #DIR =>  [ qw/airy bessel chebyshev clausen coulomb coupling dawson debye dilog elementary ellint elljac erf exp expint fermi_dirac gamma gegenbauer hyperg laguerre legendre log poly pow_int psi synchrotron transport trig zeta/ ],
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -10,7 +10,7 @@ PDL::Image2D - Miscellaneous 2D image processing functions
 =head1 DESCRIPTION
 
 Miscellaneous 2D image processing functions - for want
-of anywhere else to put them.  
+of anywhere else to put them.
 
 =head1 SYNOPSIS
 
@@ -44,6 +44,138 @@ the copyright notice should be included in the file.
 
 EOD
 
+#################################################
+#     BEGIN INTERNAL FUNCTION DECLARATIONS      #
+#################################################
+
+pp_addhdr('
+#define MAXSEC 32
+#define line(x1, x2, y) for (k=x1;k<=x2;k++) \
+	{ /* printf("line from %d to %d\n",x1,x2); */ \
+	image[k+wx*y] = col; }
+#define PX(n) ps[2*n]
+#define PY(n) ps[2*n+1]
+
+void polyfill(PDL_Long *image, int wx, int wy, float *ps, int n,
+	PDL_Long col, int *ierr)
+{
+   int ymin, ymax, xmin, xmax, fwrd = 1, i, j, k, nsect;
+   int x[MAXSEC], temp, l;
+   float s1, s2, t1, t2;
+
+   ymin = PY(0); ymax = PY(0);
+   xmin = PX(0); xmax = PX(0);
+   *ierr = 0;
+
+   for (i=1; i<n; i++) {
+     ymin = ymin > PY(i) ? PY(i) : ymin;
+     ymax = ymax < PY(i) ? PY(i) : ymax;
+     xmin = xmin > PX(i) ? PX(i) : xmin;
+     xmax = xmax < PX(i) ? PX(i) : xmax;
+   }
+   if (xmin < 0 || xmax >= wx || ymin < 0 || ymax >= wy) {
+   	*ierr = 1; /* clipping */
+	return;
+   }
+   s1 = PX(n-1);
+   t1 = PY(n-1);
+   for (l=ymin; l<= ymax; l++) {
+	nsect = 0;
+	fwrd = 1;
+	for (i=0; i<n; i++) {
+	  s2 = PX(i);
+	  t2 = PY(i);
+	  if ((t1 < l &&  l <= t2) || (t1 >= l && l > t2)) {
+		if (nsect > MAXSEC) {
+			*ierr = 2; /* too complex */
+			return;
+		}
+		x[nsect] = (s1+(s2-s1)*((l-t1)/(t2-t1)));
+	  	nsect += 1;
+	  }
+	  s1 = s2;
+	  t1 = t2;
+ 	}
+	/* sort the intersections */
+	for (i=1; i<nsect; i++)
+		for (j=0; j<i; j++)
+			if (x[j] > x[i]) {
+				temp = x[j];
+				x[j] = x[i];
+				x[i] = temp;
+			}
+	if (fwrd) {
+		for (i=0; i<nsect-1; i += 2)
+			line(x[i],x[i+1],l);
+		fwrd = 0;
+	} else {
+		for (i=nsect-1; i>0; i -= 2)
+			line(x[i-1],x[i],l);
+		fwrd = 1;
+	}
+   }
+}
+
+');
+
+pp_def('polyfill_pp',
+    HandleBad => 0, # a marker
+	Pars => 'int [o,nc] im(m,n); float ps(two=2,np); int col()',
+	Code => 'int ierr = 0, nerr;
+	         threadloop %{
+		   polyfill($P(im), $SIZE(m), $SIZE(n), $P(ps), $SIZE(np), $col(), &nerr);
+		   ierr = ierr < nerr ? nerr : ierr;
+		 %}
+		 if (ierr) warn("errors during polygonfilling");
+		 ',
+	Doc => undef,
+	PMFunc => ''
+);
+
+my %pnpolyFields = (
+	'pnpoly_pp' => {'pars' => 'a(m,n); ps(k,l); int [o] msk(m,n)', 'special' => '$msk() = c;'},
+	'pnpolyfill_pp' => {'pars' => '[o,nc] a(m,n); ps(k,l); int col()', 'special' => 'if(c) { $a() = $col(); }'}
+);
+
+for my $name (keys %pnpolyFields) {
+	pp_def($name,
+		HandleBad => 0,
+		PMFunc => '',
+		Doc => undef,
+		Pars => $pnpolyFields{$name}->{'pars'},
+		Code => '
+	        int i, j, c, nvert;
+	        nvert = $SIZE(l);
+
+	        #define VERTX(q) $ps(k=>0,l=>q)
+	        #define VERTY(q) $ps(k=>1,l=>q)
+
+			threadloop %{
+				loop(n) %{
+					loop(m) %{
+	                	c = 0;
+	                    for(i=0,j=nvert-1;i<nvert;j=i++) {
+	                        if( ((VERTY(i)>n) != (VERTY(j)>n)) &&
+	                            (m < (VERTX(j)-VERTX(i)) * (n-VERTY(i)) / (VERTY(j)-VERTY(i)) + VERTX(i)) )
+	                            c = !c;
+	                    }
+	                   ' . $pnpolyFields{$name}->{'special'} .'
+					%}
+				%}
+			%}
+
+	        #undef VERTX
+	        #undef VERTY
+	 '
+	);
+}
+
+pp_export_nothing();   # Clear the export list
+
+#################################################
+#      END INTERNAL FUNCTION DECLARATIONS       #
+#################################################
+
 
 pp_addhdr('
 
@@ -67,7 +199,7 @@ for (keys %PDL::Types::typehash) {
 
   pp_addhdr << "EOH";
 
-/* 
+/*
  * this routine is based on code referenced from
  * http://www.eso.org/~ndevilla/median/
  * the original algorithm is described in Numerical Recipes
@@ -75,7 +207,7 @@ for (keys %PDL::Types::typehash) {
 
 #define ELEM_SWAP(a,b) { register $ctype t=(a);(a)=(b);(b)=t; }
 
-$ctype quick_select_$ppsym($ctype arr[], int n) 
+$ctype quick_select_$ppsym($ctype arr[], int n)
 {
     int low, high ;
     int median;
@@ -130,12 +262,12 @@ EOH
 
 }
 
-my %init = 
-    ( 
+my %init =
+    (
       i => { size => 'm_size', off => 'poff', init => '1-p_size' },
       j => { size => 'n_size', off => 'qoff', init => '1-q_size' },
       );
-	     
+
 # requires 'int $var, ${var}2' to have been declared in the c code
 # (along with [pq]off and [pq]_size)
 #
@@ -147,11 +279,11 @@ sub init_map {
 
     my $href = $init{$var} ||
 	die "ERROR: unknown variable sent to init_map()\n";
-    my $size = $href->{size} || 
+    my $size = $href->{size} ||
 	die "ERROR: unable to find size for $var\n";
-    my $off  = $href->{off} || 
+    my $off  = $href->{off} ||
 	die "ERROR: unable to find off for $var\n";
-    my $init = $href->{init} || 
+    my $init = $href->{init} ||
 	die "ERROR: unable to find init for $var\n";
 
     return
@@ -168,12 +300,18 @@ sub init_map {
           if (${loop2}<0 || ${loop2} >= $size)
              $loop2 = -1;
           break;
+       case 3:      /* REPLICATE */
+          if (${loop2}<0)
+             $loop2 = 0;
+          if (${loop2} >= $size)
+             $loop2 = $size-1;
+          break;
        default:
            REALMOD($loop2,$size);
     }
     map${var}\[$loop] = $loop2;
  }\n";
-   
+
 } # sub: init_map()
 
 sub init_vars {
@@ -191,14 +329,14 @@ sub init_vars {
          int p_size = $COMP(__p_size);
          int q_size = $COMP(__q_size);
          int *mapi, *mapj;
-	 
+
          mapi = (int *) malloc((p_size+m_size)*sizeof(int));
          mapj = (int *) malloc((q_size+n_size)*sizeof(int));
 	 ';
     $str .= $href->{malloc} . "\n";
     $str .= "if ($href->{check} (mapi==NULL) || (mapj==NULL))\n";
     $str .= '  barf("Out of Memory");
-	 
+
          poff = p_size/2; mapi += p_size-1;
          qoff = q_size/2; mapj += q_size-1;
 ';
@@ -228,10 +366,11 @@ will be quicker.
 
  Boundary - controls what values are assumed for the image when kernel
             crosses its edge:
- 	    => Default  - periodic boundary conditions 
-                          (i.e. wrap around axis)
- 	    => Reflect  - reflect at boundary
- 	    => Truncate - truncate at boundary
+ 	    => Default   - periodic boundary conditions
+                           (i.e. wrap around axis)
+ 	    => Reflect   - reflect at boundary
+ 	    => Truncate  - truncate at boundary
+ 	    => Replicate - repeat boundary pixel values
 
 =cut
 
@@ -252,18 +391,19 @@ sub PDL::conv2d {
    &PDL::_conv2d_int($a,$kern,$c,
 	(!(defined $opt && exists $$opt{Boundary}))?0:
 	(($$opt{Boundary} eq "Reflect") +
-	2*($$opt{Boundary} eq "Truncate")));
+	2*($$opt{Boundary} eq "Truncate") +
+	3*($$opt{Boundary} eq "Replicate")));
    return $c;
 }
 
 ',
-        Code => 
+        Code =>
            init_vars( { vars => 'PDL_Double tmp;' } ) .
-           init_map("i") . 
+           init_map("i") .
            init_map("j") .
 '
            threadloop %{
-           for(j=0; j<n_size; j++) { 
+           for(j=0; j<n_size; j++) {
               for(i=0; i<m_size; i++) {
                  tmp = 0;
                  for(j1=0; j1<q_size; j1++) {
@@ -279,16 +419,16 @@ sub PDL::conv2d {
 		 } /* for: j1 */
                  $b(m=>i,n=>j) = tmp;
 	      } /* for: i */
-           } /* for: j */ 
+           } /* for: j */
            %}
 	   free(mapj+1-q_size); free(mapi+1-p_size);',
-        BadCode => 
+        BadCode =>
            init_vars( { vars => 'PDL_Double tmp; int flag;' } ) .
-           init_map("i") . 
+           init_map("i") .
            init_map("j") .
 '
            threadloop %{
-           for(j=0; j<n_size; j++) { 
+           for(j=0; j<n_size; j++) {
               for(i=0; i<m_size; i++) {
                  tmp = 0;
                  for(j1=0; j1<q_size; j1++) {
@@ -337,15 +477,16 @@ is rather pointless)
 
  Boundary - controls what values are assumed for the image when kernel
             crosses its edge:
- 	    => Default  - periodic boundary conditions (i.e. wrap around axis)
- 	    => Reflect  - reflect at boundary
- 	    => Truncate - truncate at boundary
+ 	    => Default   - periodic boundary conditions (i.e. wrap around axis)
+ 	    => Reflect   - reflect at boundary
+ 	    => Truncate  - truncate at boundary
+ 	    => Replicate - repeat boundary pixel values
 
 =cut
 
 EOD
-       BadDoc => 
-'Bad values are ignored in the calculation. If all elements within the 
+       BadDoc =>
+'Bad values are ignored in the calculation. If all elements within the
 kernel are bad, the output is set bad.',
        HandleBad => 1,
         Pars => 'a(m,n); kern(p,q); [o]b(m,n);',
@@ -357,26 +498,27 @@ sub PDL::med2d {
    die \'Usage: med2d( a(m,n), kern(p,q), [o]b(m,n), {Options} )\'
       if $#_<1 || $#_>2;
    my($a,$kern) = @_;
-   croak "med2d: kernel must contain some positive elements.\n" 
+   croak "med2d: kernel must contain some positive elements.\n"
        if all( $kern <= 0 );
    my $c = $#_ == 2 ? $_[2] : $a->nullcreate;
    &PDL::_med2d_int($a,$kern,$c,
-	(!(defined $opt && exists $opt->{Boundary}))?0:
+	(!(defined $opt && exists $$opt{Boundary}))?0:
 	(($$opt{Boundary} eq "Reflect") +
-	2*($$opt{Boundary} eq "Truncate")));
+	2*($$opt{Boundary} eq "Truncate") +
+	3*($$opt{Boundary} eq "Replicate")));
    return $c;
 }
 
 ',
-        Code => 
+        Code =>
            init_vars( { vars => 'PDL_Double *tmp, kk; int count;',
                         malloc => 'tmp = malloc(p_size*q_size*sizeof(PDL_Double));',
                         check => '(tmp==NULL) || ' } ) .
-           init_map("i") . 
+           init_map("i") .
            init_map("j") .
 '
            threadloop %{
-           for(j=0; j<n_size; j++) { 
+           for(j=0; j<n_size; j++) {
               for(i=0; i<m_size; i++) {
                  count = 0;
                  for(j1=0; j1<q_size; j1++) {
@@ -402,15 +544,15 @@ sub PDL::med2d {
            %}
            free(mapj+1-q_size); free(mapi+1-p_size); free(tmp);
 ',
-        BadCode => 
+        BadCode =>
            init_vars( { vars => 'PDL_Double *tmp, kk, aa; int count, flag;',
                         malloc => 'tmp = malloc(p_size*q_size*sizeof(PDL_Double));',
                         check => '(tmp==NULL) || ' } ) .
-           init_map("i") . 
+           init_map("i") .
            init_map("j") .
 '
            threadloop %{
-           for(j=0; j<n_size; j++) { 
+           for(j=0; j<n_size; j++) {
               for(i=0; i<m_size; i++) {
                  count = 0;
                  flag = 0;
@@ -470,9 +612,10 @@ Note: this routine does the median over all points in a rectangular
 
  Boundary - controls what values are assumed for the image when kernel
             crosses its edge:
- 	    => Default  - periodic boundary conditions (i.e. wrap around axis)
- 	    => Reflect  - reflect at boundary
- 	    => Truncate - truncate at boundary
+ 	    => Default   - periodic boundary conditions (i.e. wrap around axis)
+ 	    => Reflect   - reflect at boundary
+ 	    => Truncate  - truncate at boundary
+ 	    => Replicate - repeat boundary pixel values
 
 =cut
 
@@ -487,26 +630,27 @@ sub PDL::med2df {
    die \'Usage: med2df( a(m,n), [o]b(m,n), p, q, {Options} )\'
       if $#_<2 || $#_>3;
    my($a,$p,$q) = @_;
-   croak "med2df: kernel must contain some positive elements.\n" 
+   croak "med2df: kernel must contain some positive elements.\n"
        if $p == 0 && $q == 0;
    my $c = $#_ == 3 ? $_[3] : $a->nullcreate;
    &PDL::_med2df_int($a,$c,$p,$q,
-	(!(defined $opt && exists $opt->{Boundary}))?0:
+	(!(defined $opt && exists $$opt{Boundary}))?0:
 	(($$opt{Boundary} eq "Reflect") +
-	2*($$opt{Boundary} eq "Truncate")));
+	2*($$opt{Boundary} eq "Truncate") +
+	3*($$opt{Boundary} eq "Replicate")));
    return $c;
 }
 
 ',
-        Code => 
+        Code =>
            init_vars( { vars => '$GENERIC() *tmp, kk; int count;',
                         malloc => 'tmp = malloc(p_size*q_size*sizeof($GENERIC()));',
                         check => '(tmp==NULL) || ' } ) .
-           init_map("i") . 
+           init_map("i") .
            init_map("j") .
 '
            threadloop %{
-           for(j=0; j<n_size; j++) { 
+           for(j=0; j<n_size; j++) {
               for(i=0; i<m_size; i++) {
                  count = 0;
                  for(j1=0; j1<q_size; j1++) {
@@ -522,7 +666,7 @@ sub PDL::med2df {
 		 } /* for: j1 */
 
                  $b(m=>i,n=>j) =
-                        quick_select_$TBSULQFD(B,S,U,L,Q,F,D) (tmp, count );
+                        quick_select_$TBSULNQFD(B,S,U,L,N,Q,F,D) (tmp, count );
 
               } /* for: i */
            } /* for: j */
@@ -548,7 +692,7 @@ pp_def('box2d',
                 int xx,yy,y,ind1,ind2,first;
 
 		div = 1/((2.0*nx+1)*(2.0*ny+1));
-		
+
 		threadloop %{
 		  first = 1;
 		  for (y=0;y<ys;y++)
@@ -621,7 +765,7 @@ EOD
 
 =cut
 
-pp_def('patch2d', 
+pp_def('patch2d',
        Doc=><<'EOD',
 
 =for ref
@@ -632,7 +776,7 @@ patch bad pixels out of 2D images using a mask
 
  $patched = patch2d $data, $bad;
 
-C<$bad> is a 2D mask array where 1=bad pixel 0=good pixel. 
+C<$bad> is a 2D mask array where 1=bad pixel 0=good pixel.
 Pixels are replaced by the average of their non-bad neighbours;
 if all neighbours are bad, the original data value is
 copied across.
@@ -640,34 +784,34 @@ copied across.
 =cut
 
 EOD
-       BadDoc => 
+       BadDoc =>
 'This routine does not handle bad values - use L<patchbad2d|/patchbad2d> instead',
        HandleBad => 0,
         Pars => 'a(m,n); int bad(m,n); [o]b(m,n);',
-        Code => 
+        Code =>
         'int m_size, n_size,  i,j, i1,j1, i2,j2, norm;
          double tmp;
-	 
+
          m_size = $COMP(__m_size); n_size = $COMP(__n_size);
 
       threadloop %{
-	 
-         for(j=0; j<n_size; j++) { 
+
+         for(j=0; j<n_size; j++) {
             for(i=0; i<m_size; i++) {
 
                $b(m=>i,n=>j) = $a(m=>i,n=>j);
 
                if ( $bad(m=>i,n=>j)==1 ) {
                   tmp = 0; norm=0;
-                  for(j1=-1; j1<=1; j1++) { 
+                  for(j1=-1; j1<=1; j1++) {
 		     j2 = j+j1;
 		     if ( j2>=0 && j2<n_size ) {
                         for(i1=-1; i1<=1; i1++) {
                            /* ignore central pixel, which we know is bad */
 			   if ( i1!=0 || j1!=0 ) {
-                              i2 = i+i1; 
+                              i2 = i+i1;
                               if ( i2>=0 && i2<m_size && $bad(m=>i2,n=>j2)!=1 ) {
-                                 tmp += $a(m=>i2,n=>j2); 
+                                 tmp += $a(m=>i2,n=>j2);
                                  norm++;
 			      }
 			   } /* if: i1!=0 || j1!=0 */
@@ -678,7 +822,7 @@ EOD
                   if (norm>0) {  /* Patch */
                      $b(m=>i,n=>j) = tmp/norm;
 		  }
-	 
+
                } /* if: bad() */
 
 	    } /* for: i */
@@ -689,7 +833,7 @@ EOD
          ', # Code
 );
 
-pp_def('patchbad2d', 
+pp_def('patchbad2d',
        Doc=><<'EOD',
 
 =for ref
@@ -708,14 +852,14 @@ is performed (see L<patch2d|/patch2d>).
 =cut
 
 EOD
-       BadDoc => 
+       BadDoc =>
 'patchbad2d handles bad values. The output piddle I<may> contain
 bad values, depending on the pattern of bad values in the input piddle.',
        HandleBad => 1,
         Pars => 'a(m,n); [o]b(m,n);',
         Code => 'loop(n,m) %{ $b() = $a(); %}', # just copy
         CopyBadStatusCode => '', # handled by BadCode
-        BadCode => 
+        BadCode =>
         'int m_size, n_size,  i,j, i1,j1, i2,j2, norm, flag;
          double tmp;
          $GENERIC(a) a_val;
@@ -724,27 +868,27 @@ bad values, depending on the pattern of bad values in the input piddle.',
          m_size = $COMP(__m_size); n_size = $COMP(__n_size);
 
       threadloop %{
-	 
-         for(j=0; j<n_size; j++) { 
+
+         for(j=0; j<n_size; j++) {
             for(i=0; i<m_size; i++) {
 
-	       a_val = $a(m=>i,n=>j);	
+	       a_val = $a(m=>i,n=>j);
                if ( $ISGOODVAR(a_val,a) ) {
                   $b(m=>i,n=>j) = a_val;
 
-	       } else { 
+	       } else {
                   tmp = 0; norm=0;
-                  for(j1=-1; j1<=1; j1++) { 
+                  for(j1=-1; j1<=1; j1++) {
 		     j2 = j+j1;
 		     if ( j2>=0 && j2<n_size ) {
                         for(i1=-1; i1<=1; i1++) {
                            /* ignore central pixel, which we know is bad */
 			   if ( i1!=0 || j1!=0 ) {
-                              i2 = i+i1; 
+                              i2 = i+i1;
                               if ( i2>=0 && i2<m_size ) {
                                  a_val = $a(m=>i2,n=>j2);
                                  if ( $ISGOODVAR(a_val,a) ) {
-                                    tmp += a_val; 
+                                    tmp += a_val;
                                     norm++;
 				 }
 			      }
@@ -891,7 +1035,7 @@ EOD
    j2 = $y() + $box()/2; j2 = j2>=n_size ? n_size-1 : j2;
 
    sum = sumx = sumy = 0;
-   for(j=j1; j<=j2; j++) { 
+   for(j=j1; j<=j2; j++) {
       for(i=i1; i<=i2; i++) {
          data = $im(m=>i,n=>j);
          if ( $ISGOODVAR(data,im) ) {
@@ -953,7 +1097,7 @@ Connected 8-component labeling of a binary image.
 Connected 8-component labeling of 0,1 image - i.e. find separate
 segmented objects and fill object pixels with object number.
 8-component labeling includes all neighboring pixels.
-This is just a front-end to ccNcompt.  See also L<cc4compt>.
+This is just a front-end to ccNcompt.  See also L<cc4compt|cc4compt>.
 
 =for example
 
@@ -968,7 +1112,7 @@ Connected 4-component labeling of a binary image.
 Connected 4-component labeling of 0,1 image - i.e. find separate
 segmented objects and fill object pixels with object number.
 4-component labling does not include the diagonal neighbors.
-This is just a front-end to ccNcompt.  See also L<cc8compt>.
+This is just a front-end to ccNcompt.  See also L<cc8compt|cc8compt>.
 
 =for example
 
@@ -996,7 +1140,7 @@ Connected component labeling of a binary image.
 
 Connected component labeling of 0,1 image - i.e. find separate
 segmented objects and fill object pixels with object number.
-See also L<cc4compt> and L<cc8compt>.
+See also L<cc4compt|cc4compt> and L<cc8compt|cc8compt>.
 
 The connectivity parameter must be 4 or 8.
 
@@ -1110,75 +1254,62 @@ where the second parameter specifies the connectivity (4 or 8) of the labeling.
       free(equiv); /* Tidy */
 ');
 
-pp_addhdr('
-#define MAXSEC 32
-#define line(x1, x2, y) for (k=x1;k<=x2;k++) \
-	{ /* printf("line from %d to %d\n",x1,x2); */ \
-	image[k+wx*y] = col; }
-#define PX(n) ps[2*n]
-#define PY(n) ps[2*n+1]
-	
-void polyfill(PDL_Long *image, int wx, int wy, float *ps, int n,
-	PDL_Long col, int *ierr)
-{
-   int ymin, ymax, xmin, xmax, fwrd = 1, i, j, k, nsect;
-   int x[MAXSEC], temp, l;
-   float s1, s2, t1, t2;
-   
-   ymin = PY(0); ymax = PY(0);
-   xmin = PX(0); xmax = PX(0);
-   *ierr = 0;
-   
-   for (i=1; i<n; i++) {
-     ymin = ymin > PY(i) ? PY(i) : ymin;	
-     ymax = ymax < PY(i) ? PY(i) : ymax;
-     xmin = xmin > PX(i) ? PX(i) : xmin;	
-     xmax = xmax < PX(i) ? PX(i) : xmax;
-   }
-   if (xmin < 0 || xmax >= wx || ymin < 0 || ymax >= wy) {
-   	*ierr = 1; /* clipping */
-	return;
-   }
-   s1 = PX(n-1);
-   t1 = PY(n-1);
-   for (l=ymin; l<= ymax; l++) {
-	nsect = 0;
-	fwrd = 1;
-	for (i=0; i<n; i++) {
-	  s2 = PX(i);
-	  t2 = PY(i);
-	  if ((t1 < l &&  l <= t2) || (t1 >= l && l > t2)) {
-		if (nsect > MAXSEC) {
-			*ierr = 2; /* too complex */
-			return;
+pp_add_exported('polyfill');
+pp_addpm(<<'EOPM');
+=head2 polyfill
+
+=for ref
+
+fill the area of the given polygon with the given colour.
+
+This function works inplace, i.e. modifies C<im>.
+
+=for usage
+
+  polyfill($im,$ps,$colour,[\%options]);
+
+The default method of determining which points lie inside of the polygon used
+is not as strict as the method used in L<pnpoly|pnpoly>. Often, it includes vertices
+and edge points. Set the C<Method> option to change this behaviour.
+
+=for option
+
+Method   -  Set the method used to determine which points lie in the polygon.
+            => Default - internal PDL algorithm
+            => pnpoly  - use the L<pnpoly|pnpoly> algorithm
+
+=for example
+
+  # Make a convex 3x3 square of 1s in an image using the pnpoly algorithm
+  $ps = pdl([3,3],[3,6],[6,6],[6,3]);
+  polyfill($im,$ps,1,{'Method' =>'pnpoly'});
+
+=cut
+sub PDL::polyfill {
+	my $opt;
+	$opt = pop @_ if ref($_[-1]) eq 'HASH';
+	barf('Usage: polyfill($im,$ps,$colour,[\%options])') unless @_==3;
+	my ($im,$ps,$colour) = @_;
+
+	if($opt) {
+		use PDL::Options qw();
+		my $parsed = PDL::Options->new({'Method' => undef});
+		$parsed->options($opt);
+		if( $parsed->current->{'Method'} eq 'pnpoly' ) {
+			PDL::pnpolyfill_pp($im,$ps,$colour);
 		}
-		x[nsect] = (s1+(s2-s1)*((l-t1)/(t2-t1)));
-	  	nsect += 1;
-	  }
-	  s1 = s2;
-	  t1 = t2;
- 	}
-	/* sort the intersections */
-	for (i=1; i<nsect; i++)
-		for (j=0; j<i; j++)
-			if (x[j] > x[i]) {
-				temp = x[j];
-				x[j] = x[i];
-				x[i] = temp;
-			}
-	if (fwrd) {
-		for (i=0; i<nsect-1; i += 2)
-			line(x[i],x[i+1],l);
-		fwrd = 0;
-	} else {
-		for (i=nsect-1; i>0; i -= 2)
-			line(x[i-1],x[i],l);
-		fwrd = 1;
 	}
-   }
+	else
+	{
+		PDL::polyfill_pp($im,$ps,$colour);
+	}
+	return $im;
+
 }
 
-');
+*polyfill = \&PDL::polyfill;
+
+EOPM
 
 pp_add_exported('', 'pnpoly');
 pp_addpm(<<'EOPM');
@@ -1191,9 +1322,12 @@ pp_addpm(<<'EOPM');
 
 =for usage
 
+  $mask = $img->pnpoly($ps);
+
+  # Old style, do not use
   $mask = pnpoly($x, $y, $px, $py);
 
-For a closed polygon determined by the sequence of points in {$py,$py}
+For a closed polygon determined by the sequence of points in {$px,$py}
 the output of pnpoly is a mask corresponding to whether or not each
 coordinate (x,y) in the set of test points, {$x,$y}, is in the interior
 of the polygon.  This is the 'points in a polygon' algorithm from
@@ -1203,13 +1337,19 @@ and vectorized for PDL by Karl Glazebrook.
 =for example
 
   # define a 3-sided polygon (a triangle)
+  $ps = pdl([3, 3], [20, 20], [34, 3]);
+
+  # $tri is 0 everywhere except for points in polygon interior
+  $tri = $img->pnpoly($ps);
+
+  With the second form, the x and y coordinates must also be specified.
+  B< I<THIS IS MAINTAINED FOR BACKWARD COMPATIBILITY ONLY> >.
+
   $px = pdl( 3, 20, 34 );
   $py = pdl( 3, 20,  3 );
-  
-  $img = zeros(40, 40);  # create test image
   $x = $img->xvals;      # get x pixel coords
   $y = $img->yvals;      # get y pixel coords
-  
+
   # $tri is 0 everywhere except for points in polygon interior
   $tri = pnpoly($x,$y,$px,$py);
 
@@ -1218,78 +1358,93 @@ and vectorized for PDL by Karl Glazebrook.
 # From: http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
 #
 # Fixes needed to pnpoly code:
-# 
+#
 # Use topdl() to ensure piddle args
-# 
+#
 # Add POD docs for usage
-# 
+#
 # Calculate first term in & expression to use to fix divide-by-zero when
 #   the test point is in line with a vertical edge of the polygon.
 #   By adding the value of $mask we prevent a divide-by-zero since the &
 #   operator does not "short circuit".
 
 sub PDL::pnpoly {
-   my ($tx, $ty, $vertx, $verty) = @_;
-   my $testx = PDL::Core::topdl($tx)->dummy(0);
-   my $testy = PDL::Core::topdl($ty)->dummy(0);
-   my $vertxj = PDL::Core::topdl($vertx)->rotate(1);
-   my $vertyj = PDL::Core::topdl($verty)->rotate(1);
-   my $mask = ( ($verty>$testy) == ($vertyj>$testy) );
-   my $c = sumover( ! $mask & ( $testx < ($vertxj-$vertx) * ($testy-$verty)
-                                / ($vertyj-$verty+$mask) + $vertx) ) % 2;
-   return $c;
+	barf('Usage: $mask = pnpoly($img, $ps);') unless(@_==2 || @_==4);
+ 	my ($tx, $ty, $vertx, $verty) = @_;
+
+ 	# if only two inputs, use the pure PP version
+ 	unless( defined $vertx ) {
+		barf("ps must contain pairwise points.\n") unless $ty->getdim(0) == 2;
+
+		# Input mapping:  $img => $tx, $ps => $ty
+		return PDL::pnpoly_pp($tx,$ty);
+	}
+
+	my $testx = PDL::Core::topdl($tx)->dummy(0);
+	my $testy = PDL::Core::topdl($ty)->dummy(0);
+	my $vertxj = PDL::Core::topdl($vertx)->rotate(1);
+	my $vertyj = PDL::Core::topdl($verty)->rotate(1);
+	my $mask = ( ($verty>$testy) == ($vertyj>$testy) );
+	my $c = sumover( ! $mask & ( $testx < ($vertxj-$vertx) * ($testy-$verty)
+	                             / ($vertyj-$verty+$mask) + $vertx) ) % 2;
+	return $c;
 }
 
 *pnpoly = \&PDL::pnpoly;
 
 EOPM
 
-pp_def('polyfill',
-       HandleBad => 0, # a marker
-	Pars => 'int [o,nc] im(m,n); float ps(two=2,np); int col()',
-	Code => 'int ierr = 0, nerr;
-	         threadloop %{
-		   polyfill($P(im), $SIZE(m), $SIZE(n), $P(ps), $SIZE(np), $col(), &nerr);
-		   ierr = ierr < nerr ? nerr : ierr;
-		 %}
-		 if (ierr) warn("errors during polygonfilling");
-		 ',
-	Doc => << 'EOD',
-
-=for ref
+pp_add_exported('', 'polyfillv');
+pp_addpm(<<'EOPM');
 
-fill the area inside the given polygon with a given colour
+=head2 polyfillv
 
-This function works inplace, i.e. modifies C<im>.
+=for ref
 
-=cut
+return the (dataflown) area of an image described by a polygon
 
-EOD
-);
+=for usage
 
-pp_add_exported('', 'polyfillv');
-pp_addpm(<<'EOPM');
+  polyfillv($im,$ps,[\%options]);
 
-=head2 polyfillv
+The default method of determining which points lie inside of the polygon used
+is not as strict as the method used in L<pnpoly|pnpoly>. Often, it includes vertices
+and edge points. Set the C<Method> option to change this behaviour.
 
-=for ref
+=for option
 
-return the (dataflown) area of an image within a polygon
+Method   -  Set the method used to determine which points lie in the polygon.
+            => Default - internal PDL algorithm
+            => pnpoly  - use the L<pnpoly|pnpoly> algorithm
 
 =for example
 
-  # increment intensity in area bounded by $poly
-  $im->polyfillv($pol)++; # legal in perl >= 5.6
-  # compute average intensity within area bounded by $poly
+  # increment intensity in area bounded by $poly using the pnpoly algorithm
+  $im->polyfillv($poly,{'Method'=>'pnpoly'})++; # legal in perl >= 5.6
+
+  # compute average intensity within area bounded by $poly using the default algorithm
   $av = $im->polyfillv($poly)->avg;
 
 =cut
 
-sub PDL::polyfillv {
-  my ($im, $ps) = @_;
-  my $msk = zeroes(long,$im->dims);
-  polyfill($msk, $ps, 1);
-  return $im->where($msk == 1);
+sub PDL::polyfillv :lvalue {
+	my $opt;
+	$opt = pop @_ if ref($_[-1]) eq 'HASH';
+	barf('Usage: polyfillv($im,$ps,[\%options])') unless @_==2;
+
+	my ($im,$ps) = @_;
+	barf("ps must contain pairwise points.\n") unless $ps->getdim(0) == 2;
+
+	if($opt) {
+		use PDL::Options qw();
+		my $parsed = PDL::Options->new({'Method' => undef});
+		$parsed->options($opt);
+		return $im->where(PDL::pnpoly_pp($im, $ps)) if $parsed->current->{'Method'} eq 'pnpoly';
+	}
+
+	my $msk = zeroes(long,$im->dims);
+	PDL::polyfill_pp($msk, $ps, 1);
+	return $im->where($msk);
 }
 *polyfillv = \&PDL::polyfillv;
 
@@ -1333,7 +1488,7 @@ pp_def('rot2d',
 				croak("need > 2d piddle");
 			if (getnewsize($PDL(im)->dims[0],$PDL(im)->dims[1],
 				$angle(), &ncols,
-				&nrows) != 0) 
+				&nrows) != 0)
 			   croak("error during rotate, wrong angle");
 			/* printf("o: %d, p: %d\n",ncols,nrows); */
 			$SIZE(p) = ncols;
@@ -1363,8 +1518,8 @@ newly created image
 
   ($newcols,$newrows) = rotnewsz $oldn, $oldm, $angle;
 
-L<PDL::Transform|PDL::Transform> offers a more general interface to 
-distortions, including rotation, with various types of sampling; but 
+L<PDL::Transform|PDL::Transform> offers a more general interface to
+distortions, including rotation, with various types of sampling; but
 rot2d is faster.
 
 =cut
@@ -1414,7 +1569,7 @@ EOD
       }
       %}
   }
-  else { 
+  else {
     barf("the second matrix must be greater than first! (bilin2d)");
   }
 ');
@@ -1432,7 +1587,7 @@ Nothing useful is returned.
 
 If you want photometric accuracy or automatic FITS header metadata
 tracking, consider using L<PDL::Transform::map|PDL::Transform/map>
-instead: it does these things, at some speed penalty compared to 
+instead: it does these things, at some speed penalty compared to
 rescale2d.
 
 =cut
@@ -1443,10 +1598,10 @@ EOD
 int ix,iy,ox,oy,i,j,lx,ly,cx,cy,xx,yy,num;
 double kx,ky,temp;
 
-ix = $SIZE(m);   
-iy = $SIZE(n);   
-ox = $SIZE(p);   
-oy = $SIZE(q);   
+ix = $SIZE(m);
+iy = $SIZE(n);
+ox = $SIZE(p);
+oy = $SIZE(q);
 
 if(ox >= ix && oy >= iy) {
   threadloop %{
@@ -1569,14 +1724,14 @@ a coordinate transformation.
   ( $px, $py ) = fitwarp2d( $x, $y, $u, $v, $nf. { options } )
 
 Given a set of points in the output plane (C<$u,$v>), find
-the best-fit (using singular-value decomposition) 2D polynomial 
+the best-fit (using singular-value decomposition) 2D polynomial
 to describe the mapping back to the image plane (C<$x,$y>).
 The order of the fit is controlled by the C<$nf> parameter
 (the maximum power of the polynomial is C<$nf - 1>), and you
 can restrict the terms to fit using the C<FIT> option.
 
 C<$px> and C<$py> are C<np> by C<np> element piddles which describe
-a polynomial mapping (of order C<np-1>) 
+a polynomial mapping (of order C<np-1>)
 from the I<output> C<(u,v)> image to the I<input> C<(x,y)> image:
 
   x = sum(j=0,np-1) sum(i=0,np-1) px(i,j) * u^i * v^j
@@ -1603,7 +1758,7 @@ Options:
 C<FIT> allows you to restrict which terms of the polynomial to fit:
 only those terms for which the FIT piddle evaluates to true will be
 evaluated.  If a 2D piddle is sent in, then it is
-used for the x and y polynomials; otherwise 
+used for the x and y polynomials; otherwise
 C<$fit-E<gt>slice(":,:,(0)")> will be used for C<$px> and
 C<$fit-E<gt>slice(":,:,(1)")> will be used for C<$py>.
 
@@ -1625,17 +1780,17 @@ terms to fit (C<$nf*$nf> points for the default value of C<FIT>).
   # get warped to these positions
   $u = pdl( 10, 10, 90, 90 );
   $v = pdl( 10, 90, 90, 10 );
-  # 
+  #
   # shift of origin + scale x/y axis only
   $fit = byte( [ [1,1], [0,0] ], [ [1,0], [1,0] ] );
   ( $px, $py ) = fitwarp2d( $x, $y, $u, $v, 2, { FIT => $fit } );
   print "px = ${px}py = $py";
-  px = 
+  px =
   [
    [-12.5  1.25]
    [    0     0]
   ]
-  py = 
+  py =
   [
    [-12.5     0]
    [ 1.25     0]
@@ -1644,12 +1799,12 @@ terms to fit (C<$nf*$nf> points for the default value of C<FIT>).
   # Compared to allowing all 4 terms
   ( $px, $py ) = fitwarp2d( $x, $y, $u, $v, 2 );
   print "px = ${px}py = $py";
-  px = 
+  px =
   [
    [         -12.5           1.25]
    [  1.110223e-16 -1.1275703e-17]
   ]
-  py = 
+  py =
   [
    [         -12.5  1.6653345e-16]
    [          1.25 -5.8546917e-18]
@@ -1758,7 +1913,7 @@ sub PDL::fitwarp2d {
     my $fit = $$oref{FIT};
     my $fit_ndim = $fit->getndims();
     croak "fitwarp2d: FIT option must be sent a (\$nf,\$nf[,2]) element piddle"
-	unless UNIVERSAL::isa($fit,"PDL") and 
+	unless UNIVERSAL::isa($fit,"PDL") and
 	    ($fit_ndim == 2 or ($fit_ndim == 3 and $fit->getdim(2) == 2)) and
 	    $fit->getdim(0) == $nf and $fit->getdim(1) == $nf;
 
@@ -1802,16 +1957,16 @@ sub PDL::fitwarp2d {
     # re-create the matrix
     my $xtmp = zeroes( $nf, $nf );
     my $ytmp = zeroes( $nf, $nf );
-    
+
     my $kx = 0;
     my $ky = 0;
     foreach my $i ( 0 .. ($nf - 1) ) {
 	foreach my $j ( 0 .. ($nf - 1) ) {
-	    if ( $fitx->at($i,$j) ) { 
+	    if ( $fitx->at($i,$j) ) {
 		$xtmp->set($i,$j, $px->at($kx) );
 		$kx++;
 	    }
-	    if ( $fity->at($i,$j) ) { 
+	    if ( $fity->at($i,$j) ) {
 		$ytmp->set($i,$j, $py->at($ky) );
 		$ky++;
 	    }
@@ -1837,7 +1992,7 @@ sub PDL::applywarp2d {
 
     # safety check
     croak "applywarp2d: u and v must be the same size (and 1D)"
-	unless $npts == $u->nelem and $npts == $v->nelem 
+	unless $npts == $u->nelem and $npts == $v->nelem
 	    and $u->getndims == 1 and $v->getndims == 1;
 
     my $nf  = $px->getdim(0);
@@ -1848,7 +2003,7 @@ sub PDL::applywarp2d {
     #  the matrix multiplication below)
     #
     my $mat = _mkbasis( ones(byte,$nf,$nf), $npts, $u, $v );
-    
+
     my $x = reshape( $mat x $px->clump(-1)->transpose(), $npts );
     my $y = reshape( $mat x $py->clump(-1)->transpose(), $npts );
     return ( $x, $y );
@@ -1913,9 +2068,9 @@ the pixel scale.  This will (hopefully) be changed soon.
 
   $img = rvals(byte,501,501);
   imag $img, { JUSTIFY => 1 };
-  # 
+  #
   # use a not-particularly-obvious transformation:
-  #   x = -10 + 0.5 * $u - 0.1 * $v 
+  #   x = -10 + 0.5 * $u - 0.1 * $v
   #   y = -20 + $v - 0.002 * $u * $v
   #
   $px  = pdl( [ -10, 0.5 ], [ -0.1, 0 ] );
@@ -1987,14 +2142,14 @@ output image does not map onto one in the input image.
 =cut
 
 # support routine
-{ 
+{
     my %warp2d = map { ($_,1) } qw( tanh sinc sinc2 lanczos hamming hann );
- 
+
     # note: convert to lower case
     sub _check_kernel ($$) {
 	my $kernel = lc shift;
 	my $code   = shift;
-	barf "Unknown kernel $kernel sent to $code\n" . 
+	barf "Unknown kernel $kernel sent to $code\n" .
 	    "\tmust be one of [" . join(',',keys %warp2d) . "]\n"
 		unless exists $warp2d{$kernel};
 	return $kernel;
@@ -2011,7 +2166,7 @@ pp_def(
     OtherPars => 'char *kernel_type; double noval;',
     GenericTypes => [ 'F', 'D' ],
         PMCode => '
-        
+
 sub PDL::warp2d {
     my $opts = PDL::Options->new( { KERNEL => "tanh", NOVAL => 0 } );
     $opts->options( pop(@_) ) if ref($_[$#_]) eq "HASH";
@@ -2039,7 +2194,7 @@ sub PDL::warp2d {
     int         	lx_3, ly_3 ;
     double       	cur ;
     double       	neighbors[16] ;
-    double       	rsc[8], 
+    double       	rsc[8],
 					sumrs ;
     double       	x, y ;
     int     		px, py ;
@@ -2059,7 +2214,7 @@ sub PDL::warp2d {
     ly_out = $SIZE(n);
     lx_3 = lx_out - 3;
     ly_3 = ly_out - 3;
-    
+
     /* Pre compute leaps for 16 closest neighbors positions */
     da[0]  = -1;  db[0]  = -1;
     da[1]  =  0;  db[1]  = -1;
@@ -2070,12 +2225,12 @@ sub PDL::warp2d {
     da[5]  =  0;  db[5]  =  0;
     da[6]  =  1;  db[6]  =  0;
     da[7]  =  2;  db[7]  =  0;
-		      
+
     da[8]  = -1;  db[8]  =  1;
     da[9]  =  0;  db[9]  =  1;
     da[10] =  1;  db[10] =  1;
     da[11] =  2;  db[11] =  1;
-		      
+
     da[12] = -1;  db[12] =  2;
     da[13] =  0;  db[13] =  2;
     da[14] =  1;  db[14] =  2;
@@ -2113,17 +2268,17 @@ sub PDL::warp2d {
 
 		    /* Now feed the positions for the closest 16 neighbors  */
 		    for (k=0 ; k<16 ; k++) {
-			i = px + da[k]; j = py + db[k]; 
+			i = px + da[k]; j = py + db[k];
 			neighbors[k] = (double) $img( m => i, n => j );
 		    }
 
 		    /* Which tabulated value index shall we use?    */
-		    tabx = (x - (double)px) * (double)(TABSPERPIX) ; 
-		    taby = (y - (double)py) * (double)(TABSPERPIX) ; 
+		    tabx = (x - (double)px) * (double)(TABSPERPIX) ;
+		    taby = (y - (double)py) * (double)(TABSPERPIX) ;
 
 		    /* Compute resampling coefficients  */
 		    /* rsc[0..3] in x, rsc[4..7] in y   */
-	
+
 		    rsc[0] = kernel[TABSPERPIX + tabx] ;
 		    rsc[1] = kernel[tabx] ;
 		    rsc[2] = kernel[TABSPERPIX - tabx] ;
@@ -2132,7 +2287,7 @@ sub PDL::warp2d {
 		    rsc[5] = kernel[taby] ;
 		    rsc[6] = kernel[TABSPERPIX - taby] ;
 		    rsc[7] = kernel[2 * TABSPERPIX - taby] ;
-	
+
 		    sumrs = (rsc[0]+rsc[1]+rsc[2]+rsc[3]) *
 			(rsc[4]+rsc[5]+rsc[6]+rsc[7]) ;
 
@@ -2152,7 +2307,7 @@ sub PDL::warp2d {
 			    rsc[7] * (  rsc[0]*neighbors[12] +
 					rsc[1]*neighbors[13] +
 					rsc[2]*neighbors[14] +
-					rsc[3]*neighbors[15] ) ; 
+					rsc[3]*neighbors[15] ) ;
 
 		    /* Copy the value to the output image */
 		    $warp() = ($GENERIC()) (cur/sumrs);
@@ -49,9 +49,9 @@ pp_addhdr('
 
 /* Compute offset of (x,y,z,...) position in row-major list */
 
-PDL_Long ndim_get_offset(PDL_Long* pos, PDL_Long* dims, PDL_Long ndims) {
+PDL_Indx ndim_get_offset(PDL_Indx* pos, PDL_Indx* dims, PDL_Long ndims) {
    PDL_Long i;
-   PDL_Long result,size;
+   PDL_Indx result,size;
    size = 1;
    result = 0;
    for (i=0; i<ndims; i++) {
@@ -64,9 +64,10 @@ PDL_Long ndim_get_offset(PDL_Long* pos, PDL_Long* dims, PDL_Long ndims) {
 
 /* Increrement a position pointer array by one row */
 
-void ndim_row_plusplus ( PDL_Long* pos, PDL_Long* dims, PDL_Long ndims ) {
+void ndim_row_plusplus ( PDL_Indx* pos, PDL_Indx* dims, PDL_Long ndims ) {
 
-    PDL_Long i, noescape;
+    PDL_Long  noescape;
+    PDL_Indx i;
 
     i=1; noescape=1;
 
@@ -120,7 +121,7 @@ it runs faster and handles a variety of boundary conditions.
 
 
 EOD
-        Pars => 'a(m); b(n); int adims(p); int bdims(q); [o]c(m);',
+        Pars => 'a(m); b(n); indx adims(p); indx bdims(q); [o]c(m);',
         PMCode => '
 
 # Custom Perl wrapper
@@ -145,16 +146,16 @@ sub PDL::convolve{
 
 ',
         Code => '
-   PDL_Long *dimsa = $P(adims);
-   PDL_Long *dimsb = $P(bdims);
-   PDL_Long andims = $SIZE(p);
-   PDL_Long bndims = $SIZE(q);
-   PDL_Long anvals = $SIZE(m);
-   PDL_Long bnvals = $SIZE(n);
-   PDL_Long *pos,*off;
+   PDL_Indx *dimsa = $P(adims);
+   PDL_Indx *dimsb = $P(bdims);
+   PDL_Indx andims = $SIZE(p);
+   PDL_Indx bndims = $SIZE(q);
+   PDL_Indx anvals = $SIZE(m);
+   PDL_Indx bnvals = $SIZE(n);
+   PDL_Indx *pos,*off;
    double cc;
 
-   PDL_Long i,i2,j,k,n,offcen,cen,ncen,nrow;
+   PDL_Indx i,i2,j,k,n,offcen,cen,ncen,nrow;
 
    if (andims != bndims)
       barf("Arguments do not have the same dimensionality");
@@ -163,7 +164,7 @@ sub PDL::convolve{
              barf("Second argument must be smaller in all dimensions that first"
 );
 
-   pos = (PDL_Long*) malloc( andims * sizeof(PDL_Long) ); /* Init pos[] */
+   pos = (PDL_Indx*) malloc( andims * sizeof(PDL_Indx) ); /* Init pos[] */
    if (pos==NULL)
       barf("Out of Memory\n");
    for (i=0; i<andims; i++) /* Zero */
@@ -191,7 +192,7 @@ getout_$GENERIC():    i++;
 
    /* Initialise offset array to handle the relative coords efficiently */
 
-   off = (PDL_Long*) malloc(bnvals*sizeof(PDL_Long)); /* Offset array */
+   off = (PDL_Indx*) malloc(bnvals*sizeof(PDL_Indx)); /* Offset array */
    if (off==NULL)
       barf("Out of Memory\n");
 
@@ -741,18 +742,18 @@ Code => <<'EOD'
 
   short ndims;
 
-  PDL_Long   *koffs, *koff;        /* the "s<foo>" variables are static  */
+  PDL_Indx   *koffs, *koff;        /* the "s<foo>" variables are static  */
   $GENERIC() *kvals, *kval;        /* scratchspace designed to avoid dynamic */
-  static PDL_Long skoffs[256];     /* allocation.  The cost ia about 2k per */
+  static PDL_Indx skoffs[256];     /* allocation.  The cost ia about 2k per */
   static $GENERIC() skvals[256];   /* datatype, or about 20k of memory. */
 
   $GENERIC() *aptr;
   $GENERIC() *aaptr;
 
-  PDL_Long *ivec;
-  static PDL_Long sivec[16];
+  PDL_Indx *ivec;
+  static PDL_Indx sivec[16];
 
-  PDL_Long i,j;
+  PDL_Indx i,j;
 
   pdl *k     = PDL->SvPDLV($COMP(k));
   pdl *a =     PDL->SvPDLV($COMP(a));
@@ -777,14 +778,14 @@ Code => <<'EOD'
 	koffs = skoffs;
 	kvals = skvals;
   } else {	
-	koffs = (PDL_Long *)  (PDL->smalloc((STRLEN) (k->nvals * sizeof(PDL_Long))));
+	koffs = (PDL_Indx *)  (PDL->smalloc((STRLEN) (k->nvals * sizeof(PDL_Indx))));
 	kvals = ($GENERIC() *)(PDL->smalloc((STRLEN) (k->nvals * sizeof($GENERIC()))));
   }
 
   if(ndims < 16) {
 	ivec = sivec;
   } else {
-	ivec = (PDL_Long *) (PDL->smalloc((STRLEN) (ndims * sizeof(PDL_Long))));
+	ivec = (PDL_Indx *) (PDL->smalloc((STRLEN) (ndims * sizeof(PDL_Indx))));
   }
 
   if(!ivec || !koffs || !kvals) 
@@ -802,7 +803,7 @@ Code => <<'EOD'
 
 
   do {
-	PDL_Long acc; 
+	PDL_Indx acc; 
 
 	*(kval++) = *aptr;     /* Copy kernel value into kernel list */
 
@@ -7,8 +7,9 @@ WriteMakefile(
 	      'NAME' => 'PDL::Lib',
 	      VERSION_FROM => '../Basic/Core/Version.pm',
 	      DIR =>  [ qw/Opt ImageRGB Fit FFT Filter Image2D ImageND
-			CallExt Slatec GSL FFTW GIS Transform Minuit Compression
+			CallExt Slatec GSL GIS Transform Minuit Compression
 			/ ],
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 #			Interpolate
 );
 
@@ -55,7 +55,7 @@ void FCN(int* npar,double* grad,double* fval,double* xval,int* iflag,double* fut
   SV* pxvalsv;
   
   int ndims;
-  PDL_Long *pdims;
+  PDL_Indx *pdims;
 
   dSP;
   ENTER;
@@ -65,9 +65,9 @@ void FCN(int* npar,double* grad,double* fval,double* xval,int* iflag,double* fut
   funname = mnfunname;
 
   ndims = 1;
-  pdims = (PDL_Long *)  PDL->smalloc( (STRLEN) ((ndims) * sizeof(*pdims)) );
+  pdims = (PDL_Indx *)  PDL->smalloc( (STRLEN) ((ndims) * sizeof(*pdims)) );
   
-  pdims[0] = (PDL_Long) ene;
+  pdims[0] = (PDL_Indx) ene;
 
   PUSHMARK(SP);
   XPUSHs(sv_2mortal(newSVpv("PDL", 0)));
@@ -82,7 +82,7 @@ void FCN(int* npar,double* grad,double* fval,double* xval,int* iflag,double* fut
   PDL->children_changesoon(pxval,PDL_PARENTDIMSCHANGED|PDL_PARENTDATACHANGED);
   PDL->setdims (pxval,pdims,ndims);
   pxval->state &= ~PDL_NOMYDIMS;
-  pxval->state |= PDL_ALLOCATED;
+  pxval->state |= PDL_ALLOCATED | PDL_DONTTOUCHDATA;
   PDL->changed(pxval,PDL_PARENTDIMSCHANGED|PDL_PARENTDATACHANGED,0);
 
   PUSHMARK(SP);
@@ -98,7 +98,7 @@ void FCN(int* npar,double* grad,double* fval,double* xval,int* iflag,double* fut
   PDL->children_changesoon(pgrad,PDL_PARENTDIMSCHANGED|PDL_PARENTDATACHANGED);
   PDL->setdims (pgrad,pdims,ndims);
   pgrad->state &= ~PDL_NOMYDIMS;
-  pgrad->state |= PDL_ALLOCATED;
+  pgrad->state |= PDL_ALLOCATED | PDL_DONTTOUCHDATA;
   PDL->changed(pgrad,PDL_PARENTDIMSCHANGED|PDL_PARENTDATACHANGED,0);
 
   pxval->data = (void *) xval;
@@ -353,7 +353,7 @@ sub mn_init{
   if (defined (my $logfile = $mn_options->{Log})){ 
     if (-e $logfile) { unlink $logfile; }   
     PDL::Minuit::mn_abre($mn_options->{Unit},$logfile,\'new\');
-    print "Opening file $logfile....\n";
+    print STDERR "# Opening file $logfile....\n";
   }
  			
   PDL::Minuit::mninit(5,$mn_options->{Unit},$mn_options->{Unit});
@@ -10,5 +10,6 @@ WriteMakefile(
 	'NAME' => 'PDL::Opt',
 	VERSION_FROM => '../../Basic/Core/Version.pm',
 	DIR => [ @dirs ],
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -2,5 +2,6 @@ use ExtUtils::MakeMaker;
 WriteMakefile(NAME => "PDL::Opt::Simplex",
 	PM => {
 	 map {($_ => '$(INST_LIBDIR)/'.$_)} <*.pm>
-	}
+	},
+	(eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
@@ -120,28 +120,45 @@ results (in C<$r> corresponding to the rows of $y.
 
 =for usage
 
- ($ndeg, $r, $ierr, $a) = polyfit($x, $y, $w, $maxdeg, $eps);
+ ($ndeg, $r, $ierr, $a, $coeffs, $rms) = polyfit($x, $y, $w, $maxdeg, [$eps]);
+
+ $coeffs = polyfit($x,$y,$w,$maxdeg,[$eps]);
+
+where on input:
+
+C<$x> and C<$y> are the values to fit to a polynomial.
+C<$w> are weighting factors
+C<$maxdeg> is the maximum degree of polynomial to use and 
+C<$eps> is the required degree of fit.
 
- where on input:
+and the output switches on list/scalar context.  
 
- $x and $y are the values to fit to a polynomial.
- $w are weighting factors
- $maxdeg is the maximum degree of polynomial to use and 
- $eps is the required degree of fit.
+In list context: 
 
- and on output:
+C<$ndeg> is the degree of polynomial actually used
+C<$r> is the values of the fitted polynomial 
+C<$ierr> is a return status code, and
+C<$a> is some working array or other (preserved for historical purposes)
+C<$coeffs> is the polynomial coefficients of the best fit polynomial.
+C<$rms> is the rms error of the fit.
 
- $ndeg is the degree of polynomial actually used
- $r is the values of the fitted polynomial 
- $ierr is a return status code, and
- $a is some working array or other
- $ps is modified to contain the rms error of the fit.
+In scalar context, only $coeffs is returned.
+
+Historically, C<$eps> was modified in-place to be a return value of the
+rms error.  This usage is deprecated, and C<$eps> is an optional parameter now.
+It is still modified if present.
+ 
+C<$a> is a working array accessible to Slatec - you can feed it to several
+other Slatec routines to get nice things out.  It does not thread 
+correctly and should probably be fixed by someone.  If you are 
+reading this, that someone might be you.
 
 =for bad
 
-This version of polyfit handles bad values correctly.  It strips them out
-of the $x variable and creates an appropriate $y variable containing indices
-of the non-bad members of $x before calling the Slatec routine C<polfit>.
+This version of polyfit handles bad values correctly.  Bad values in
+$y are ignored for the fit and give computed values on the fitted
+curve in the return.  Bad values in $x or $w are ignored for the fit and
+result in bad elements in the output.
 
 =head2 polycoef
 
@@ -557,25 +574,37 @@ sub rfft {
 
 *polyfit = \&PDL::polyfit;
 sub PDL::polyfit {
-  barf 'Usage: polyfit($x, $y, $w, $maxdeg, $eps);'
-    unless @_ == 5;
+  barf 'Usage: polyfit($x, $y, $w, $maxdeg, [$eps]);'
+    unless (@_ == 5 || @_==4 );
+
+  my ($x_in, $y_in, $w_in, $maxdeg_in, $eps_in) = @_;
 
   # Create the output arrays
   my $r = PDL->null;
 
   # A array needs some work space
-  my $sz = ((3*$_[0]->getdim(0)) + (3*$_[3]) + 3);
-  my @otherdims = $_[0]->dims; shift @otherdims;
-  my $a = $_[0]->zeroes( $sz, @otherdims ); # This should be of type $x
+  my $sz = ((3 * $x_in->getdim(0)) + (3*$maxdeg_in) + 3); # Buffer size called for by Slatec
+  my @otherdims = $_[0]->dims; shift @otherdims;          # Thread dims
+  my $a =      PDL::new_from_specification('PDL',$x_in->type,$sz,@otherdims);
+  my $coeffs = PDL::new_from_specification('PDL',$x_in->type, $maxdeg_in + 1, @otherdims);
 
   my $ierr = PDL->null;
   my $ndeg = PDL->null;
 
-  # Now call polfit                                                           
-  polfit($_[0], $_[1], $_[2], $_[3], $ndeg, $_[4], $r, $ierr, $a);
+  # Now call polfit
+  my $rms = pdl($eps_in);                                       
+  polfit($x_in, $y_in, $w_in, $maxdeg_in, $ndeg, $rms, $r, $ierr, $a, $coeffs);
+  # Preserve historic compatibility by flowing rms error back into the argument
+  if( UNIVERSAL::isa($eps_in,'PDL') ){
+      $eps_in .= $rms;
+  }
 
   # Return the arrays
-  return ($ndeg, $r, $ierr, $a);
+  if(wantarray) {
+    return ($ndeg, $r, $ierr, $a, $coeffs, $rms );
+  } else {
+      return $coeffs;
+  }
 }
 
 
@@ -1533,18 +1562,43 @@ Error status returned by C<$ierr>:
 # This version of polfit accepts bad values and also allows threading
 #
 
+#
+# indices: 
+#  n   runs across input points; 
+#  foo runs across wacky Slatec buffer size;
+#  bar runs across polynomial coefficients.
+#
 pp_def('polfit',
-  Pars => 'x(n);y(n);w(n);int maxdeg();int [o]ndeg();[o]eps();[o]r(n);int [o]ierr();[o]a(foo);[t]xtmp(n);[t]ytmp(n);[t]wtmp(n);[t]rtmp(n)',
+  Pars => 'x(n); y(n); w(n); int maxdeg(); int [o]ndeg(); [o]eps(); [o]r(n); int [o]ierr(); [o]a(foo); [o]coeffs(bar);[t]xtmp(n);[t]ytmp(n);[t]wtmp(n);[t]rtmp(n)',
   OtherPars => '',
-  Code => '$TFD(polfit'.$uscore.',dpolft'.$uscore.')  (&$PRIV(__n_size),$P(x),$P(y),$P(w),$P(maxdeg),$P(ndeg),$P(eps),$P(r),$P(ierr),$P(a));',
+  Code => '
+           int maxord;
+           int ord;
+           int k;
+           $GENERIC() zero = 0;
+
+           $TFD(polfit'.$uscore.',dpolft'.$uscore.')  (&$PRIV(__n_size),$P(x),$P(y),$P(w),$P(maxdeg),$P(ndeg),$P(eps),$P(r),$P(ierr),$P(a)); 
+	   maxord = ($P(a))[0]+0.5;
+	   ord = ($P(a))[maxord * 3  +  2];
+	   if(ord >= $maxdeg()) {
+	     ord = $maxdeg();
+	   }
+           $TFD(pcoef'.$uscore.',dpcoef'.$uscore.') ( &(ord), &(zero), $P(coeffs), $P(a));
+           for(k=ord+1; k<=$maxdeg(); k++)
+              ($P(coeffs))[k] = 0;
+',
   GenericTypes => ['F','D'],
   HandleBad => 1, 
   NoBadifNaN => 1,
   BadCode => 'int ns = $SIZE(n);
               int i;
-	      int j = 0;
+	      int j = 0; 
+              if($SIZE(n)<$maxdeg()) {
+                barf("polfit: Must have at least <n> points to fit <n> coefficients");
+              }
+
               for (i=0;i<ns;i++) {   /* get rid of bad values.  Call polfit with [xyw]tmp instead of [xyz]. */
-                if ($ISGOOD(y(n=>i))) {
+                if ($ISGOOD(y(n=>i)) && $ISGOOD(x(n=>i)) && $ISGOOD(w(n=>i))) {
                   $xtmp(n=>j) = $x(n=>i);
                   $ytmp(n=>j) = $y(n=>i);
                   $wtmp(n=>j) = $w(n=>i);
@@ -1552,18 +1606,54 @@ pp_def('polfit',
                 }
               }
 	      if (j <= $maxdeg()) {
+		/* Not enough good datapoints -- set this whole row to BAD. */
                 for (i=0;i<ns;i++) {
                   $SETBAD(r(n=>i));
                 }
                 $ierr() = 2;
               } else {
-                $TFD(polfit_,dpolft_)  (&j,$P(xtmp),$P(ytmp),$P(wtmp),$P(maxdeg),$P(ndeg),$P(eps),$P(rtmp),$P(ierr),$P(a));
+                  /* Found enough good datapoints for a fit -- do the fit */
+		  int k;
+		  int ord;
+		  int maxord;
+                  $GENERIC() zero = 0;
+
+                /* Do the fit */
+                $TFD(polfit'.$uscore.',dpolft'.$uscore.')  
+                    (&j,$P(xtmp),$P(ytmp),$P(wtmp),$P(maxdeg),$P(ndeg),$P(eps),$P(rtmp),$P(ierr),$P(a));
+
+		maxord = ($P(a))[0]+0.5;
+		ord = ($P(a))[maxord * 3  +  2];
+		if(ord >= $maxdeg()) {
+		  ord = $maxdeg();
+		}
+		/* Extract the polynomial coefficients into coeffs -- used for bad values */
+                $TFD(pcoef'.$uscore.',dpcoef'.$uscore.') ( &(ord), &(zero), $P(coeffs), $P(a));
+                for(k=ord+1; k<=$maxdeg(); k++)
+                   ($P(coeffs))[k] = 0;
                 j=0;
                 for (i=0;i<ns;i++) {  /* replace bad values */
                   if ($ISGOOD(y(n=>i))) {
                     $r(n=>i) = $rtmp(n=>j);
                     j++;
+                  } else if($ISGOOD(x(n=>i))) {
+		     /* Bad values are omitted from the call to polfit, so we must reconstitute them on return */
+	             /* (just because a value is bad in y, does not mean the fit itself is bad there) */
+                     /* */
+                     /* The number in ord is not the number of coefficients in the polynomial, it is the highest */
+                     /* order coefficient -- so 3 for a cubic, which has 4 coefficients. */
+	             /* --CED */
+		     int ii;
+                     $GENERIC() acc = 0;
+                     for( ii=ord; ii>0; ii-- ) {
+                        acc += $coeffs(bar=>ii);
+                        acc *= $x(n=>i);
+                     }
+
+                     acc += $coeffs(bar=>0);
+                     $r(n=>i) = acc;
                   } else {
+                    /* x and y are bad here... */
 		    $SETBAD(r(n=>i));
                   }
                 }
@@ -244,7 +244,8 @@ package PDL::Transform::Cartography;
 use PDL::Core ':Internal'; # Load 'topdl' (internal routine)
 
 @ISA = ( 'Exporter','PDL::Transform' );
-$VERSION = "0.6";
+our $VERSION = "0.6";
+$VERSION = eval $VERSION;
 
 BEGIN {
   use Exporter ();
@@ -284,6 +285,7 @@ sub _strval {
 =for usage
 
    $lonlatp     = graticule(<grid-spacing>,<line-segment-size>);   
+   $lonlatp     = graticule(<grid-spacing>,<line-segment-size>,1);
 
 =for ref
 
@@ -305,54 +307,78 @@ In array context you get back a 2-element list containing a piddle of
 the (theta,phi) pairs and a piddle of the pen values (1 or 0) suitable for
 calling
 L<PDL::Graphics::PGPLOT::Window::lines|PDL::Graphics::PGPLOT::Window/lines>.
-In scalar context
-the two elements are combined into a single piddle.
+In scalar context the two elements are combined into a single piddle.
 
-The pen values associated with the graticule are negative, which will
-cause
+The pen values associated with the graticule are negative, which will cause
 L<PDL::Graphics::PGPLOT::Window::lines|PDL::Graphics::PGPLOT::Window/lines>
 to plot them as hairlines.
 
+If a third argument is given, it is a hash of options, which can be:
+
+=over 3
+
+=item nan - if true, use two columns instead of three, and separate lines with a 'nan' break
+
+=item lonpos - if true, all reported longitudes are positive (0 to 360) instead of (-180 to 180).
+
+=item dup - if true, the meridian at the far boundary is duplicated.
+
+==back 
+
 =cut
 
 sub graticule {
     my $grid = shift;
     my $step = shift;
+    my $hash = shift; $hash = {} unless defined($hash); # avoid // for ancient compatibility
+    my $two_cols = $hash->{nan} || 0;
+    my $lonpos = $hash->{lonpos} || 0;
+    my $dup = $hash->{dup} || 0;
+
     $grid = 10 unless defined($grid);
-    $step = $grid/2 unless defined($step);
-    
-    my $par_siz = ((floor(180/$grid)) * (floor(360/$step) + 1))->at(0);
-    my $mer_siz = ((floor(360/$grid)+ 1) * floor(180/$step + 1))->at(0);
+    $grid = $grid->at(0) if(ref($grid) eq 'PDL');
     
-    my $out = zeroes(2,$par_siz + $mer_siz);
-    my $p = ones($par_siz + $mer_siz);
-    
-    # First do parallels
-    $out->((0),0:$par_siz - 1) .= 
-	(xvals($par_siz) * $step) % (360+$step);
-    $out->((1),0:$par_siz - 1) .=
-	$grid * (1+floor((xvals($par_siz) * $step) / (360+$step)));
-    $p->(  ( xvals((floor(180/$grid)-1)->at(0)) + 1) * (floor(360/$step)+1)-1)
-	.= 0;
-
-    # Next, meridians.  Duplicate the 180 degree meridian, for cleaner
-    # default plots.
-    $out->((0),$par_siz:-1) .=
-	$grid * floor(xvals($mer_siz) * $step / (180+$step));
-    $out->((0),-floor(180/$step + 1):-1) -= 1e-3;
-
-    $out->((1),$par_siz:-1) .=
-	(xvals($mer_siz)*$step) % (180+$step) ;
-      
-    $p->( $par_siz +
-	  ( xvals(floor(360/$grid + 1)->at(0))+1) * (floor(180/$step)+1)-1
-	  ) .=  0;
+    $step = $grid/2 unless defined($step);
+    $step = $step->at(0) if(ref($step) eq 'PDL');
 
+    # Figure number of parallels and meridians
+    my $np = 2 * int(90/$grid);
+    my $nm = 2 * int(180/$grid);
+    
+    # First do parallels.
+    my $xp = xvals(360/$step + 1 + !!$two_cols, $np + 1) * $step       - 180 * (!$lonpos);
+    my $yp = yvals(360/$step + 1 + !!$two_cols, $np + 1) * 180/$np     -  90;
+    $xp->(-1,:) .= $yp->(-1,:) .= asin(pdl(1.1)) if($two_cols);
 
-    $out->(0) -= 180;
-    $out->(1) -= 90;
+    # Next do meridians.
+    my $xm = yvals( 180/$step + 1 + !!$two_cols,  $nm + !!$dup  ) * 360/$nm   - 180 * (!$lonpos);
+    my $ym = xvals( 180/$step + 1 + !!$two_cols,  $nm + !!$dup  ) * $step     - 90;
+    $xm->(-1,:) .= $ym->(-1,:) .= asin(pdl(1.1)) if($two_cols);
 
-    $out->append(-$p->dummy(0,1));
+    
+    if($two_cols) {
+	return pdl( $xp->flat->append($xm->flat),
+		    $yp->flat->append($ym->flat)
+	    )->mv(1,0);
+    } else {
+	 our $pp = (zeroes($xp)-1); $pp->((-1)) .= 0;
+	 our $pm = (zeroes($xm)-1); $pm->((-1)) .= 0;
+
+	if(wantarray) {
+	    return (  pdl( $xp->flat->append($xm->flat),
+			   $yp->flat->append($ym->flat)
+		      )->mv(1,0),
+		      
+		      $pp->flat->append($pm->flat)
+		);
+	} else {
+	    return pdl( $xp->flat->append($xm->flat),
+			$yp->flat->append($ym->flat),
+			$pp->flat->append($pm->flat)
+		     )->mv(1,0);
+	}  
+	barf "This can't happen";
+    }
 }
 
 =head2 earth_coast
@@ -625,8 +651,8 @@ sub new {
     my($l) = _opt($o,['l','L']);
     my($b) = _opt($o,['b','B']);
 
-    $or->(0) .= topdl($l) if defined($l);
-    $or->(1) .= topdl($b) if defined($b);
+    $or->(0) .= $l if defined($l);
+    $or->(1) .= $b if defined($b);
 
     my $roll = topdl(_opt($o,['r','roll','Roll','P'],0));
     my $unit = _opt($o,['u','unit','Unit'],'degrees');
@@ -656,7 +682,7 @@ sub new {
     $me->{params}->{roll} = $roll * $conv;
 
     $me->{params}->{bad} = _opt($o,['b','bad','Bad','missing','Missing'],
-			      asin(topdl(1.2)));
+			      asin(pdl(1.1)));
 
     # Get the standard parallel (in general there's only one; the conics
     # have two but that's handled by _c_new)
@@ -1141,7 +1167,7 @@ sub t_mercator {
 	$p->{c} = topdl($p->{c});
 	$p->{c} *= $p->{conv};
     } else {
-	$p->{c} = topdl($DEG2RAD * 75);
+	$p->{c} = pdl($DEG2RAD * 75);
     }
     $p->{c} = abs($p->{c}) * pdl(-1,1) if($p->{c}->nelem == 1);
 
@@ -1766,7 +1792,7 @@ sub t_lambert {
     if(defined($p->{c})) {
 	$p->{c} = topdl($p->{c});
     } else {
-	$p->{c} = topdl(-75,75);
+	$p->{c} = topdl([-75,75]);
     }
     $p->{c} = abs($p->{c}) * topdl([-1,1]) if($p->{c}->nelem == 1);
     $p->{c} = [$p->{c}->list];
@@ -5,6 +5,7 @@ WriteMakefile(
         'NAME' => 'PDL::Transform::Cartography',
         VERSION_FROM => '../../../Basic/Core/Version.pm',
 	      PM => { (map {($_ => '$(INST_LIBDIR)/'.$_)}  <*.pm>), 
-		      (map {($_ => '$(INST_LIBDIR)/Cartography/'.$_)} <*.fits *.jpg>)}
+		      (map {($_ => '$(INST_LIBDIR)/Cartography/'.$_)} <*.fits *.jpg>)},
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
 
@@ -4,24 +4,49 @@
 # Judd Taylor, USF IMaRS
 # 18 March 2003
 #
+use strict;
+use warnings;
+
+use Config;
+
+BEGIN {
+   print STDERR join "\n", sort grep { m/Carp/ } keys %INC;
+   print STDERR "*****************************************\n";
+   use lib '../../../inc';
+   if (($^V eq v5.8.8 or $] >= 5.016 and $] < 5.017) and exists $INC{'Carp.pm'}) {
+      warn "Carp initially at: $INC{'Carp.pm'}\n";
+      delete $INC{'Carp.pm'};
+      eval "use Carp";
+   }
+   if (($^V eq 'v5.8.8' or $] >= 5.016 and $] < 5.017) and exists $INC{'Carp/Heavy.pm'}) {
+      warn "Carp initially at: $INC{'Carp/Heavy.pm'}\n";
+      delete $INC{'Carp/Heavy.pm'};
+      eval "use Carp::Heavy";
+   }
+   print STDERR "*****************************************\n";
+   print STDERR join "\n", sort grep { m/Carp/ } keys %INC;
+   use Devel::CheckLib;
+}
 
 use ExtUtils::MakeMaker;
 PDL::Core::Dev->import();
 
-use lib '../../../inc';
-use Devel::CheckLib;
+my $package_name;
+my $transform_proj4_lib_path;
+my $include_path;
+my $donot;
 
 BEGIN
 {
    # Generic descripton of how to optionally add this package to the PDL Tree:
    $package_name = "PDL::Transform::Proj4";
-   $lib_name = "Proj4";
-   $find_libs = [ 'libproj.so', 'libproj.a' ];
-   $find_incs = [ 'proj_api.h' ];
-   $config_flag = 'WITH_PROJ';
-   $config_libs = 'PROJ_LIBS';
-   $config_incs = 'PROJ_INC';
-   @lib_locations = (
+   my $lib_name = "Proj4";
+   my $find_libs = [ 'libproj.so', 'libproj.a' ];
+   my $find_incs = [ 'proj_api.h' ];
+   my $config_flag = 'WITH_PROJ';
+   my $config_libs = 'PROJ_LIBS';
+   my $config_incs = 'PROJ_INC';
+   my @lib_locations = (
       '/usr/lib64',
       '/usr/local/lib64',
       '/lib64',
@@ -30,7 +55,7 @@ BEGIN
       '/lib',
       split(/ /, $Config{libpth}),
    );
-   @inc_locations = (
+   my @inc_locations = (
       '/usr/include',
       '/usr/local/include',
       $Config{usrinc},
@@ -40,8 +65,8 @@ BEGIN
    # You probably won't need to edit anything below here (until the very end):
    #
 
-   $msg = "";
-   $forcebuild=0;  # Note: forcebuild not used
+   my $msg = "";
+   my $forcebuild=0;  # Note: forcebuild not used
 
    if (defined $PDL::Config{$config_flag} && $PDL::Config{$config_flag}==0)
    {
@@ -138,7 +163,7 @@ BEGIN
       my $header = 'proj_api.h';
       my $include = "#include <$header>";
       my $progbody = 'projUV puv = { 5.0, 10.0 };';
-      my $libs = "-L$gis_proj_lib_path -lproj -lm";
+      my $libs = "-L$transform_proj4_lib_path -lproj -lm";
       my $cflags = "-I$include_path";
 
       if (trylink($infomsg,$include,$progbody,$libs,$cflags) or $forcebuild) {
@@ -151,7 +176,7 @@ BEGIN
                header=>$header,
                incpath=>$include_path,
                lib=>'proj',
-               libpath=>$gis_proj_lib_path,
+               libpath=>$transform_proj4_lib_path,
             ) or $forcebuild) {
             print " Building $package_name. Turn off $config_flag if there are any problems\n\n";
             $PDL::Config{$config_flag}=1;
@@ -174,9 +199,9 @@ BEGIN
 
 return if $donot;  # yes, this must be return (exit will kill Makefile.PL process)
 
-$ppfile = "Proj4.pd";
-$package = [$ppfile, Proj4, $package_name];
-%hash = pdlpp_stdargs($package);
+my $ppfile = "Proj4.pd";
+my $package = [$ppfile, 'Proj4', $package_name];
+my %hash = pdlpp_stdargs($package);
 $hash{VERSION_FROM} = $ppfile;
 #$hash{TYPEMAPS} = [&PDL_TYPEMAP()];
 $hash{LIBS} = ["-L$transform_proj4_lib_path -lproj -lm"];
@@ -52,7 +52,7 @@ FROM the destination dataspace (or image plane) TO the source dataspace;
 hence PDL::Transform keeps track of both the forward and inverse transform.
 
 For terseness and convenience, most of the constructors are exported
-into the current package with the name C<t_\<transform\>>, so the following
+into the current package with the name C<< t_<transform> >>, so the following
 (for example) are synonyms:
 
   $t = new PDL::Transform::Radial();  # Long way
@@ -259,7 +259,6 @@ use overload '!'  => \&t_inverse;
 
 use PDL;
 use PDL::MatrixOps;
-use PDL::NiceSlice;
 
 our $PI = 3.1415926535897932384626;
 our $DEG2RAD = $PI / 180;
@@ -302,8 +301,8 @@ sub stringify {
   my($mestr) = (ref $me);
   $mestr =~ s/PDL::Transform:://;
   my $out = $mestr . " (" . $me->{name} . "): ";
-  $out .= "fwd ". ((defined ($me->{func})) ? "ok" : "missing")."; ";
-  $out .= "inv ". ((defined ($me->{inv})) ? "ok" : "missing").".\n";
+  $out .= "fwd ". ((defined ($me->{func})) ? ( (ref($me->{func}) eq 'CODE') ? "ok" : "non-CODE(!!)" ): "missing")."; ";
+  $out .= "inv ". ((defined ($me->{inv})) ?  ( (ref($me->{inv}) eq 'CODE') ? "ok" : "non-CODE(!!)" ):"missing").".\n";
 }
 
 +======EOD======
@@ -348,9 +347,10 @@ sub apply {
   }
 
   if(UNIVERSAL::isa($me,'PDL::Transform') && UNIVERSAL::isa($from,'PDL')){
-      return &{$me->{func}}($from,$me->{params})
-	  if defined($me->{func});
-      croak "PDL::Transform with no defined func -- this is a bug.\n";
+      croak "Applying a PDL::Transform with no func! Oops.\n" unless(defined($me->{func}) and ref($me->{func}) eq 'CODE');
+      my $result = &{$me->{func}}($from,$me->{params});		
+      $result->is_inplace(0); # clear inplace flag, just in case.	
+      return $result;
   } else {
       croak "apply requires both a PDL and a PDL::Transform.\n";
   }
@@ -397,8 +397,10 @@ sub invert {
   }
 
   if(UNIVERSAL::isa($me,'PDL::Transform') && UNIVERSAL::isa($data,'PDL')){
-      return undef unless defined($me->{inv});
-      return &{$me->{inv}}($data, $me->{params});
+      croak "Inverting a PDL::Transform with no inverse! Oops.\n" unless(defined($me->{inv}) and ref($me->{inv}) eq 'CODE');
+      my $result = &{$me->{inv}}($data, $me->{params});
+      $result->is_inplace(0);  # make sure inplace flag is clear.
+      return $result;
   } else {
       croak("invert requires a PDL and a PDL::Transform (did you want 'inverse' instead?)\n");
   }
@@ -609,7 +611,7 @@ pp_add_exported('map');
 pp_def('map',
 	Pars=>'k0()',  # Dummy to set type (should match the type of "in").
 	OtherPars=>'SV *in; SV *out; SV *map; SV *boundary; SV *method;
-	            SV *big; SV *blur; SV *sv_min; SV *flux',
+	            SV *big; SV *blur; SV *sv_min; SV *flux; SV *bv',
 	Code=><<'+==EOD_map_c_code==',
 /*
  * Pixel interpolation & averaging code
@@ -640,7 +642,7 @@ pp_def('map',
  char flux;             /* Flag to indicate flux conservation       */
  PDL_Double *map_ptr;
  PDL_Long i, j;
- $GENERIC() badval = sqrt(-1);
+ $GENERIC() badval = SvNV($COMP(bv));
 
  pdl *in  = PDL->SvPDLV($COMP(in));
  pdl *out = PDL->SvPDLV($COMP(out));
@@ -654,7 +656,7 @@ pp_def('map',
 
   /***************************************************************************/
   /**  Check that the dimensionalities are consistent.  This is             **/
-  /**  allegedly done already in the perl part, but shouldn't cost more     **/
+  /**  allegedly done already in the perl part, but should not cost more    **/
   /**  than a few hundred clock cycles -- cheap at twice the price.         **/
   /**                                                                       **/
   /**/ if(map->ndims != out->ndims)                                        /**/
@@ -675,7 +677,7 @@ pp_def('map',
 
  /*
   * Allocate all our dynamic workspaces at once...
- /* */
+  * */
  ovec = (PDL_Long *)(PDL->smalloc( (STRLEN)
 	          	      ( sizeof(PDL_Long)   * 3 * ndims
                               + sizeof(PDL_Double) * (3*ndims*ndims + 3*ndims)
@@ -811,7 +813,7 @@ pp_def('map',
        for(i=0; i < in->dims[ndims]; i++)
   	*(ac++) = 0.0;
      }
-     wgt = 1.0e-9;  /* negligible but nonzero */
+     wgt = 0;
 
      do {  /* Input accumulation loop */
        int bound_ok = 1;
@@ -921,8 +923,6 @@ pp_def('map',
   	}
 
 
-        /* We've got the weighting, now accumulate the values as needed... */
-         wgt += alpha;
 
        if(bound_ok)
          {
@@ -932,6 +932,8 @@ pp_def('map',
                *(ac++) += *dat * alpha;
                dat += in->dimincs[ndims];
           }
+         wgt += alpha;
+
          }/* end of bound_ok check */
 
        }  /* end of data collection convenience block */
@@ -952,17 +954,23 @@ pp_def('map',
        for(i=0;i<ndims;i++)
          dat += out->dimincs[i] * ovec[i];
 
-       if(flux) {
-	  PDL_Double det = tmp[ndims*ndims];
-          for(i=0; i < out->dims[ndims]; i++) {
-            *dat = *(ac++) / wgt * det;
-            dat += out->dimincs[ndims];
-	  }
-       } else {
-	  for(i=0; i < out->dims[ndims]; i++) {
-           *dat = *(ac++) / wgt;
-           dat += out->dimincs[ndims];
-          }
+       if(wgt) {
+	 if(flux) {
+	   PDL_Double det = tmp[ndims*ndims];
+	   for(i=0; i < out->dims[ndims]; i++) {
+	     *dat = *(ac++) / wgt * det;
+	     dat += out->dimincs[ndims];
+	   }
+	 } else {
+	   for(i=0; i < out->dims[ndims]; i++) {
+	     *dat = *(ac++) / wgt;
+	     dat += out->dimincs[ndims];
+	   }
+	 }
+       } else { /* wgt==0 */
+	 for(i=0;i<out->dims[ndims];i++){
+	   *dat = badval;
+	 }
        }
      }
 
@@ -1001,7 +1009,9 @@ pp_def('map',
 
 =for usage
 
-  $b = $a->match($c);
+  $b = $a->match($c);                  # Match $c's header and size
+  $b = $a->match([100,200]);           # Rescale to 100x200 pixels
+  $b = $a->match([100,200],{rect=>1}); # Rescale and remove rotation/skew.
 
 =for ref
 
@@ -1015,6 +1025,13 @@ it resamples the input PDL with the identity transformation in
 scientific coordinates, and matches the pixel coordinate system to
 $c's FITS header.
 
+There is one difference between match and map: match makes the
+C<rectify> option to C<map> default to 0, not 1.  This only affects
+matching where autoscaling is required (i.e. the array ref example
+above).  By default, that example simply scales $a to the new size and
+maintains any rotation or skew in its scientiic-to-pixel coordinate
+transform.
+
 =head2 map
 
 =for usage
@@ -1151,7 +1168,20 @@ output array.  It works exactly like C<irange>, except that it specifies
 a quadrilateral in output space.  Since the output pixel array is itself
 a quadrilateral, you get pretty much exactly what you asked for.
 
-This parameter overrides C<irange>, if both are specified.
+This parameter overrides C<irange>, if both are specified.  It forces
+rectification of the output (so that scientific axes align with the pixel
+grid).
+
+=item r, rect, rectify
+
+This option defaults TRUE and controls how autoscaling is performed.  If
+it is true or undefined, then autoscaling adjusts so that pixel coordinates
+in the output image are proportional to individual scientific coordinates.
+If it is false, then autoscaling automatically applies the inverse of any
+input FITS transformation *before* autoscaling the pixels.  In the special
+case of linear transformations, this preserves the rectangular shape of the
+original pixel grid and makes output pixel coordinate proportional to input
+coordinate.
 
 =item m, method, Method
 
@@ -1288,9 +1318,15 @@ Maybe that someone is you.
 +==EOD_map_doc==
 	PMCode => <<'+==EOD_map_perlcode=='
 
-use PDL::NiceSlice;
-
 sub PDL::match {
+  # Set default for rectification to 0 for simple matching...
+  if( ref($_[$#_]) ne 'HASH' ) {
+      push(@_,{})
+  }
+  my @k = grep(m/^r(e(c(t)?)?)?/,keys %{$_[$#_]});
+  unless(@k) {
+      $_[$#_]->{rectify} = 0;
+  }
   t_identity()->map(@_);
 }
 
@@ -1358,6 +1394,10 @@ sub map {
   $out = PDL::new_from_specification('PDL',$in->type,@odims);
   $out->sethdr($ohdr) if defined($ohdr);
 
+  if($PDL::Bad::Status and $in->badflag()) {
+    $out->badflag(1);
+  }
+
   ##############################
   ## Figure out the dimensionality of the
   ## transform itself (extra dimensions come along for the ride)
@@ -1378,15 +1418,24 @@ sub map {
 
   ##############################
   # If necessary, generate an appropriate FITS header for the output.
+
   my $nofits = _opt($opt, ['nf','nofits','NoFITS','pix','pixel','Pixel']);
-  my $f_tr = ($nofits || !defined($in->hdr->{NAXIS})) ?
-    $me :
-    $me x t_fits($in,{ignore_rgb=>1});
 
   ##############################
   # Autoscale by transforming a subset of the input points' coordinates
   # to the output range, and pick a FITS header that fits the output
   # coordinates into the given template.
+  #
+  # Autoscaling always produces a simple, linear mapping in the FITS header.
+  # We support more complex mappings (via t_fits) but only to match a pre-existing
+  # FITS header (which doesn't use autoscaling).
+  # 
+  # If the rectify option is set (the default) then the image is rectified 
+  # in scientific coordinates; if it is clear, then the existing matrix 
+  # is used, preserving any shear or rotation in the coordinate system. 
+  # Since we eschew CROTA whenever possible, the CDi_j formalism is used instead.
+  my $f_in = (defined($in->hdr->{NAXIS}) ? t_fits($in,{ignore_rgb=>1}) : t_identity());
+
   unless((defined $out->gethdr && $out->hdr->{NAXIS})  or  $nofits) {
       print "generating output FITS header..." if($PDL::Transform::debug);
 
@@ -1402,118 +1451,196 @@ sub map {
       my $omax;
       my $osize;
 
+
+      my $rectify = _opt($opt,['r','rect','rectify','Rectify'],1);
+
+
       if (defined $orange) {
+	  # orange always rectifies the coordinates -- the output scientific
+	  # coordinates *must* align with the axes, or orange wouldn't make
+	  # sense.
 	print "using user's orange..." if($PDL::Transform::debug);
 	$orange = pdl($orange) unless(UNIVERSAL::isa($orange,'PDL'));
 	barf "map: orange must be 2xN for an N-D transform"
 	  unless ( (($orange->dim(1)) == $nd )
 		   && $orange->ndims == 2);
 
-	$omin = $orange->((0));
-	$omax = $orange->((1));
+	$omin = $orange->slice("(0)");
+	$omax = $orange->slice("(1)");
 	$osize = $omax - $omin;
+	
+	$rectify = 1;
 
       } else {
 
-	my $samps = (pdl(($in->dims)[0..$nd-1]))->clip(0,$samp_ratio);
-
-	my $coords = ndcoords(($samps + 1)->list);
+	  ##############################
+	  # Real autoscaling happens here.
 
-	my $t;
-	my $irange = _opt($opt, ['ir','irange','input_range','Input_Range'],
-			  undef);
-
-	# If input range is defined, sample that quadrilateral -- else
-	# sample the quad defined by the boundaries of the input image.
-	if(defined $irange) {
-	  print "using user's irange..." if($PDL::Transform::debug);
-	  $irange = pdl($irange) unless(UNIVERSAL::isa($irange,'PDL'));
-	  barf "map: irange must be 2xN for an N-D transform"
-	    unless ( (($irange->dim(1)) == $nd )
-		     && $irange->ndims == 2);
-
-	  $coords *= ($irange->((1)) - $irange->((0))) / $samps;
-	  $coords += $irange->((0));
-	  $coords -= 0.5; # offset to pixel corners...
-	  $t = $me;
-	} else {
-	  $coords *= pdl(($in->dims)[0..$nd-1]) / $samps;
-  	  $coords -= 0.5; # offset to pixel corners...
-	  $t = $f_tr;
-	}
-
-	my $ocoords = $t->apply($coords)->mv(0,-1)->clump($nd);
-	# discard non-finite entries
-
-	my $oc2  = $ocoords->range(
-				   which(
-					 $ocoords->
-					 xchg(0,1)->
-					 sumover->
-					 isfinite
-					 )
-				   ->dummy(0,1)
-				   );
 
-	$omin = $oc2->minimum;
-	$omax = $oc2->maximum;
+	  if(!$rectify and ref( $f_in ) !~ /Linear/) {
+	      print STDERR "Warning: map can't preserve nonlinear FITS distortions while autoscaling.\n";
+	      $rectify=1;
+	  }
+	  if(!$rectify and $f_in->{name} eq 'identity') {
+	      $rectify = 1;
+	  }
 
-	$osize = $omax - $omin;
-	my $tosize;
-	($tosize = $osize->where($osize == 0)) .= 1.0;
+	  my $f_tr = ( $rectify ? 
+		       $me x $f_in :
+		       (  ($me->{name} eq 'identity') ?  # Simple optimization for match()
+			  $me :                        # identity -- just matching
+			  !$f_in x $me x $f_in         # common case
+		       )
+		       );
+
+	  my $samps = (pdl(($in->dims)[0..$nd-1]))->clip(0,$samp_ratio);
+	  
+	  my $coords = ndcoords(($samps + 1)->list);
+	  
+	  my $t;
+	  my $irange = _opt($opt, ['ir','irange','input_range','Input_Range'],
+			    undef);
+	  
+	  # If input range is defined, sample that quadrilateral -- else
+	  # sample the quad defined by the boundaries of the input image.
+	  if(defined $irange) {
+	      print "using user's irange..." if($PDL::Transform::debug);
+	      $irange = pdl($irange) unless(UNIVERSAL::isa($irange,'PDL'));
+	      barf "map: irange must be 2xN for an N-D transform"
+		  unless ( (($irange->dim(1)) == $nd )
+			   && $irange->ndims == 2);
+	      
+	      $coords *= ($irange->slice("(1)") - $irange->slice("(0)")) / $samps;
+	      $coords += $irange->slice("(0)");
+	      $coords -= 0.5; # offset to pixel corners...
+	      $t = $me;
+	  } else {
+	      $coords *= pdl(($in->dims)[0..$nd-1]) / $samps;
+	      $coords -= 0.5; # offset to pixel corners...
+	      $t = $f_tr;
+	  }
+	  my $ocoords = $t->apply($coords)->mv(0,-1)->clump($nd);
+	  
+	  # discard non-finite entries
+	  my $oc2  = $ocoords->range(
+	      which(
+		  $ocoords->
+		  xchg(0,1)->
+		  sumover->
+		  isfinite
+	      )
+	      ->dummy(0,1)
+	      );
+	  
+	  $omin = $oc2->minimum;
+	  $omax = $oc2->maximum;
+	  
+	  $osize = $omax - $omin;
+	  my $tosize;
+	  ($tosize = $osize->where($osize == 0)) .= 1.0;
       }
-
+      
       my ($scale) = $osize / pdl(($out->dims)[0..$nd-1]);
-
+      
       my $justify = _opt($opt,['j','J','just','justify','Justify'],0);
       if($justify) {
-        my $tmp; # work around perl -d "feature"
-	($tmp = $scale->(0)) *= $justify;
-	$scale .= $scale->max;
-	$scale->(0) /= $justify;
+	  my $tmp; # work around perl -d "feature"
+	  ($tmp = $scale->slice("0")) *= $justify;
+	  $scale .= $scale->max;
+	  $scale->slice("0") /= $justify;
       }
 
-      my $d;
-      for $d(1..$nd) {
-	  $out->hdr->{"CRPIX$d"} = 1 + ($out->dim($d-1)-1)/2 ;
-	  $out->hdr->{"CDELT$d"} = $scale->at($d-1);
-	  $out->hdr->{"CRVAL$d"} = ( $omin->at($d-1) + $omax->at($d-1) ) /2 ;
-	  $out->hdr->{"NAXIS$d"} = $out->dim($d-1);
-	  $out->hdr->{"CTYPE$d"} = ( (defined($me->{otype}) ?
-				      $me->{otype}->[$d-1] : "")
-				     || $in->hdr->{"CTYPE$d"}
-				     || "");
-	  $out->hdr->{"CUNIT$d"} = ( (defined($me->{ounit}) ?
-				      $me->{ounit}->[$d-1] : "")
-				     || $in->hdr->{"CUNIT$d"}
-				     || $in->hdr->{"CTYPE$d"}
-				     || "");
-      }
-      $out->hdr->{"NAXIS"} = $nd;
+      print "done with autoscale. Making fits header....\n" if($PDL::Transform::debug);
+      if( $rectify ) {
+	  # Rectified header generation -- make a simple coordinate header with no 
+	  # rotation or skew.
+	  print "rectify\n" if($PDL::Transform::debug);
+	  for my $d(1..$nd) {
+	      $out->hdr->{"CRPIX$d"} = 1 + ($out->dim($d-1)-1)/2 ;
+	      $out->hdr->{"CDELT$d"} = $scale->at($d-1);
+	      $out->hdr->{"CRVAL$d"} = ( $omin->at($d-1) + $omax->at($d-1) ) /2 ;
+	      $out->hdr->{"NAXIS$d"} = $out->dim($d-1);
+	      $out->hdr->{"CTYPE$d"} = ( (defined($me->{otype}) ?
+					  $me->{otype}->[$d-1] : "")
+					 || $in->hdr->{"CTYPE$d"}
+					 || "");
+	      $out->hdr->{"CUNIT$d"} = ( (defined($me->{ounit}) ?
+					  $me->{ounit}->[$d-1] : "")
+					 || $in->hdr->{"CUNIT$d"}
+					 || $in->hdr->{"CTYPE$d"}
+					 || "");
+	  }
+	  $out->hdr->{"NAXIS"} = $nd;
+	  
+	  $out->hdr->{"SIMPLE"} = 'T';
+	  $out->hdr->{"HISTORY"} .= "Header written by PDL::Transform::Cartography::map";
+	  
+	  ### Eliminate fancy newfangled output header pointing tags if they exist
+	  ### These are the CROTA<n>, PCi_j, and CDi_j.
+	  for $k(keys %{$out->hdr})	 {
+	      if( $k=~m/(^CROTA\d*$)|(^(CD|PC)\d+_\d+[A-Z]?$)/ ){
+		  delete $out->hdr->{$k};
+	      }
+	  }
+      } else {
+	  # Non-rectified output -- generate a CDi_j matrix instead of the simple formalism.
+	  # We have to deal with a linear transformation: we've got:  (scaling) x !input x (t x input),
+	  # where input is a linear transformation with offset and scaling is a simple scaling. We have
+	  # the scaling parameters and the matrix for !input -- we have only to merge them and then we 
+	  # can write out the FITS header in CDi_j form.
+	  print "non-rectify\n" if($PDL::Transform::debug);
+	  my $midpoint_val = (pdl(($out->dims)[0..$nd-1])/2 * $scale)->apply( $f_in );
+	  print "midpoint_val is $midpoint_val\n" if($PDL::Transform::debug);
+	  # linear transformation
+	  unless(ref($f_in) =~ m/Linear/) {
+	      croak("Whups -- got a nonlinear t_fits transformation.  Can't deal with it.");
+	  }
 
-      $out->hdr->{"SIMPLE"} = 'T';
-      $out->hdr->{"HISTORY"} .= "Header written by PDL::Transform::Cartography::map";
+	  my $inv_sc_mat = zeroes($nd,$nd);
+	  $inv_sc_mat->diagonal(0,1) .= $scale;
+	  my $mat = $f_in->{params}->{matrix} x $inv_sc_mat;
+	  print "scale is $scale; mat is $mat\n" if($PDL::Transform::debug);
+
+	  print "looping dims 1..$nd: " if($PDL::Transform::debug);
+	  for my $d(1..$nd) {
+	      print "$d..." if($PDL::Transform::debug);
+	      $out->hdr->{"CRPIX$d"} = 1 + ($out->dim($d-1)-1)/2;
+	      $out->hdr->{"CRVAL$d"} = $midpoint_val->at($d-1);
+	      $out->hdr->{"NAXIS$d"} = $out->dim($d-1);
+	      $out->hdr->{"CTYPE$d"} = ( (defined($me->{otype}) ?
+					  $me->{otype}->[$d-1] : "")
+					 || $in->hdr->{"CTYPE$d"}
+					 || "");
+	      $out->hdr->{"CUNIT$d"} = ( (defined($me->{ounit}) ?
+					  $me->{ounit}->[$d-1] : "")
+					 || $in->hdr->{"CUNIT$d"}
+					 || $in->hdr->{"CTYPE$d"}
+					 || "");
+	      for my $e(1..$nd) {
+		  $out->hdr->{"CD${d}_${e}"} = $mat->at($d-1,$e-1);
+		  print "setting CD${d}_${e} to ".$mat->at($d-1,$e-1)."\n" if($PDL::Transform::debug);
+	      }
+	  }
 
-      ### Eliminate fancy newfangled output header pointing tags if they exist
-      ### These are the CROTA<n>, PCi_j, and CDi_j.
-      for $k(keys %{$out->hdr})	 {
-	  if( $k=~m/(^CROTA\d*$)|(^(CD|PC)\d+_\d+$)/ ){
-	      delete $out->hdr->{$k}
+	  ## Eliminate competing header pointing tags if they exist
+	  for $k(keys %{$out->hdr}) {
+	      if( $k =~ m/(^CROTA\d*$)|(^(PC)\d+_\d+[A-Z]?$)|(CDELT\d*$)/ ) {
+		  delete $out->hdr->{$k};
+	      }
 	  }
       }
 
 
+
     }
 
   $out->hdrcpy(1);
 
   ##############################
   # Sandwich the transform between the input and output plane FITS headers.
-  $me = $f_tr; # Pre-composed input FITS from above.
-
-  $me = !(t_fits($out,{ignore_rgb=>1})) x $me
-    unless($nofits);
-
+  unless($nofits) {
+      $me = !(t_fits($out,{ignore_rgb=>1})) x $me x $f_in;
+  }
 
   ##############################
   ## Figure out the interpND options
@@ -1539,7 +1666,7 @@ sub map {
   if(!$integrate) {
     my $a = $in->interpND($idx,{method=>$method, bound=>$bound});
     my $tmp; # work around perl -d "feature"
-    ($tmp = $out->(:)) .= $a; # trivial slice prevents header overwrite...
+    ($tmp = $out->slice(":")) .= $a; # trivial slice prevents header overwrite...
     return $out;
   }
 
@@ -1602,20 +1729,25 @@ sub map {
   $blur = $blur->at(0) if(ref $blur);
   $svmin =  $svmin->at(0)  if(ref $svmin);
 
-
+  my $bv;
+  if($PDL::Bad::Status  and $in->badflag){
+      $bv = $in->badvalue;
+  } else {
+      $bv = 0;
+  }
 
   ### The first argument is a dummy to set $GENERIC.
   $idx = double($idx) unless($idx->type == double);
   &PDL::_map_int( $in2->flat->index(0),
 	$in2, $o2, $idx,
-	$bound, $method, $big, $blur, $svmin, $flux );
+	$bound, $method, $big, $blur, $svmin, $flux, $bv);
 
   my @rdims = (@iddims[1..$#iddims], @idims[$#iddims..$#idims]);
   {
      my $tmp; # work around perl -d "feature"
-     ($tmp = $out->(:)) .= $o2->reshape(@rdims);
+     ($tmp = $out->slice(":")) .= $o2->reshape(@rdims);
   }
-
+  return $out;
 }
 
 +==EOD_map_perlcode==
@@ -1822,10 +1954,11 @@ sub compose {
     my ($data,$p) = @_;
     my ($ip) = $data->is_inplace;
     for my $t ( reverse @{$p->{clist}} ) {
-      print "applying $t\n" if($PDL::Transform::debug);
+      croak("Error: tried to apply a PDL::Transform with no function inside a composition!\n  offending transform: $t\n")
+	  unless(defined($t->{func}) and ref($t->{func}) eq 'CODE');
       $data = $t->{func}($ip ? $data->inplace : $data, $t->{params});
-      print "... ok.\n" if($PDL::Transform::debug);
     }
+    $data->is_inplace(0); # clear inplace flag (avoid core bug with inplace)
     $data;
   };
 
@@ -1833,9 +1966,9 @@ sub compose {
     my($data,$p) = @_;
     my($ip) = $data->is_inplace;
     for my $t ( @{$p->{clist}} ) {
-      print "inverting $t..." if($PDL::Transform::debug);
+      croak("Error: tried to invert a non-invertible PDL::Transform inside a composition!\n  offending transform: $t\n") 
+	  unless(defined($t->{inv}) and ref($t->{inv}) eq 'CODE');
       $data = &{$t->{inv}}($ip ? $data->inplace : $data, $t->{params});
-      print "... ok.\n" if($PDL::Transform::debug);
     }
     $data;
   };
@@ -2142,7 +2275,7 @@ sub t_lookup {
 	my $maxvals = $p->{table}->clump($me->{idim})->maximum;
 
 	# Scale so that the range runs from 0 through the top pixel in the table
-	my $scale = (  pdl(  $itable->dims  )->(0:-2)-1  ) /
+	my $scale = (  pdl(  $itable->dims  )->slice("0:-2")-1  ) /
 	   	    (($maxvals - $minvals)+ (($maxvals-$minvals) == 0));
         my $offset = - ($minvals * $scale);
 
@@ -2154,7 +2287,7 @@ sub t_lookup {
 
 	# $oloop runs over (point, index) for all points in the output table, in
 	# $p->{table} output space
-	$oloop = ndcoords($itable->mv(-1,0)->((0)))->
+	$oloop = ndcoords($itable->mv(-1,0)->slice("(0)"))->
 	    double->
 	    mv(0,-1)->
 	    clump($itable->ndims-1);  # oloop: (pixel, index)
@@ -2175,24 +2308,24 @@ sub t_lookup {
 
 	for $i(0..$oloop->dim(0)-1) {
 
-	    my $olp = $oloop->(($i));                # olp runs (index)
+	    my $olp = $oloop->slice("($i)");                # olp runs (index)
 	    my $diff = ($pt - $olp);                 # diff runs (index, x, y, ...)
 	    my $r2 = ($diff * $diff)->sumover;       # r2 runs (x,y,...)
-	    my $c = whichND($r2==$r2->min)->(:,(0)); # c runs (index)
+	    my $c = whichND($r2==$r2->min)->slice(":,(0)"); # c runs (index)
 
 	    # Now zero in on the neighborhood around the point of closest approach.
 	    my $neighborhood = $p->{table}->interpND($c + $smallcoords,{method=>'linear',bound=>'t'})->
 	             mv(-1,0); # neighborhood runs (index, dx, dy,...)
 	    $diff = $neighborhood - $olp;        # diff runs (index, dx, dy, ...)
 	    $r2 = ($diff * $diff)->sumover;      # r2 runs (dx,dy,...)
-	    my $dc = $smallcoords->mv(0,-1)->indexND(0+whichND($r2==$r2->min)->(:,(0)));
+	    my $dc = $smallcoords->mv(0,-1)->indexND(0+whichND($r2==$r2->min)->slice(":,(0)"));
 
 
 	    my $coord = $c + $dc;
 	    # At last, we've found the best-fit to an enl_scale'th of an input-table pixel.
 	    # Back it out to input-science coordinates, and stuff it in the inverse table.
             my $tmp; # work around perl -d "feature"
-	    ($tmp = $itable_flattened->(($i))) .= $coord;
+	    ($tmp = $itable_flattened->slice("($i)")) .= $coord;
 
 	    print " $i..." if( ($i%1000==0) && ( $PDL::verbose || $PDL::debug || $PDL::Transform::debug));
         }
@@ -2369,7 +2502,7 @@ sub PDL::Transform::Linear::new {
   # if necessary, generate a new matrix.
 
   if(defined($me->{params}->{matrix})) {
-    my $mat = $me->{params}->{matrix} = $me->{params}->{matrix}->(:,:);
+    my $mat = $me->{params}->{matrix} = $me->{params}->{matrix}->slice(":,:");
     $me->{idim} = $mat->dim(0);
     $me->{odim} = $mat->dim(1);
 
@@ -2452,7 +2585,7 @@ sub PDL::Transform::Linear::new {
   #
   # Apply scaling
   #
-  $me->{params}->{matrix} = $me->{params}->{matrix}->(:,:);
+  $me->{params}->{matrix} = $me->{params}->{matrix}->slice(":,:");
   my $tmp; # work around perl -d "feature"
   ($tmp = $me->{params}->{matrix}->diagonal(0,1)) *= $scale
     if defined($scale);
@@ -2481,11 +2614,11 @@ sub PDL::Transform::Linear::new {
     barf("Linear transform: transform is $d-D; data only ".($in->dim(0))."\n")
 	if($in->dim(0) < $d);
 
-    my($a) = $in->(0:$d)->copy + $opt->{pre};
+    my($a) = $in->slice("0:$d")->copy + $opt->{pre};
     my($out) = $in->is_inplace ? $in : $in->copy;
 
     my $tmp; # work around perl -d "feature"
-    ($tmp = $out->(0:$d)) .= $a x $opt->{matrix} + $opt->{post};
+    ($tmp = $out->slice("0:$d")) .= $a x $opt->{matrix} + $opt->{post};
 
     return $out;
   };
@@ -2498,11 +2631,11 @@ sub PDL::Transform::Linear::new {
     barf("Linear transform: transform is $d-D; data only ".($in->dim(0))."\n")
 	if($in->dim(0) < $d);
 
-    my($a) = $in->(0:$d)->copy - $opt->{post};
+    my($a) = $in->slice("0:$d")->copy - $opt->{post};
     my($out) = $in->is_inplace ? $in : $in->copy;
 
     my $tmp; # work around perl -d "feature"
-    ($tmp = $out->(0:$d)) .= $a x $opt->{inverse} - $opt->{pre};
+    ($tmp = $out->slice("0:$d")) .= $a x $opt->{inverse} - $opt->{pre};
 
     $out;
   } : undef;
@@ -2699,20 +2832,19 @@ sub t_fits {
   my($post) = PDL->zeroes($n);
 
   ##############################
-  # Scaling: Use CDi_j formalism if present (mostly in Hubble
-  # datasets); otherwise use PCi_j + CDELTi formalism.
+  # Scaling: Use CDi_j formalism if present; otherwise use the 
+  # older PCi_j + CDELTi formalism.
 
   my(@hgrab);
 
   if(@hgrab = grep(m/^CD\d{1,3}_\d{1,3}$/,keys %$hdr)) {   # assignment
-
     #
     # CDi_j formalism
     #
     for my $h(@hgrab) {
       $h =~ m/CD(\d{1,3})_(\d{1,3})/;  # Should always match
       my $tmp; # work around perl -d "feature"
-      ($tmp = $matrix->(($1-1),($2-1))) .= $hdr->{h};
+      ($tmp = $matrix->slice("(".($1-1)."),(".($2-1).")")) .= $hdr->{$h};
     }
     print "PDL::Transform::FITS: Detected CDi_j matrix: \n",$matrix,"\n"
       if($PDL::Transform::debug);
@@ -2739,7 +2871,7 @@ sub t_fits {
       for my $h(@hgrab) {
 	$h =~ m/PC(\d{1,3})_(\d{1,3})$/ || die "t_fits - match failed! This should never happen!";
         my $tmp; # work around perl -d "feature"
-	($tmp = $cpm->(($1-1),($2-1))) .= $hdr->{$h};
+	($tmp = $cpm->slice("(".($1-1)."),(".($2-1).")")) .= $hdr->{$h};
       }
       print "PDL::Transform::FITS: Detected PCi_j matrix: \n",$cpm,"\n"
 	if($PDL::Transform::debug && @hgrab);
@@ -2762,7 +2894,7 @@ sub t_fits {
 
     for my $i(1..$n) {
       my $tmp; # work around perl -d "feature"
-      ($tmp = $cd->(($i-1))) .= $hdr->{"CDELT$i"};
+      ($tmp = $cd->slice("(".($i-1).")")) .= $hdr->{"CDELT$i"};
     }
 #If there are no CDELTs, then we assume they are all 1.0,
 #as in PDL::Graphics::PGPLOT::Window::_FITS_tr.
@@ -2774,8 +2906,8 @@ sub t_fits {
   my($i1) = 0;
   for my $i(1..$n) {
     my $tmp; # work around perl -d "feature"
-    ($tmp = $pre->(($i1)))  .= 1 - $hdr->{"CRPIX$i"};
-    ($tmp = $post->(($i1))) .= $hdr->{"CRVAL$i"};
+    ($tmp = $pre->slice("($i1)"))  .= 1 - $hdr->{"CRPIX$i"};
+    ($tmp = $post->slice("($i1)")) .= $hdr->{"CRVAL$i"};
     $i1++;
   }
 
@@ -2803,9 +2935,9 @@ sub t_fits {
   $me->{iunit} = \@iunit;
 
   # Check for nonlinear projection...
-  if($hdr->{CTYPE1} =~ m/(\w\w\w\w)\-(\w\w\w)/) {
-      print "Nonlinear transformation found... ignoring nonlinear part...\n";
-  }
+#  if($hdr->{CTYPE1} =~ m/(\w\w\w\w)\-(\w\w\w)/) {
+#      print "Nonlinear transformation found... ignoring nonlinear part...\n";
+#  }
 
   return $me;
 
@@ -3053,15 +3185,15 @@ sub t_radial {
 
       my($d) = $data->copy;
       my $tmp; # work around perl -d "feature"
-      ($tmp = $d->(0:1)) -= $o->{origin};
+      ($tmp = $d->slice("0:1")) -= $o->{origin};
 
-      my($d0) = $d->((0));
-      my($d1) = $d->((1));
+      my($d0) = $d->slice("(0)");
+      my($d1) = $d->slice("(1)");
 
       # (mod operator on atan2 puts everything in the interval [0,2*PI).)
-      ($tmp = $out->((0))) .= (atan2(-$d1,$d0) % (2*$PI)) * $me->{params}->{angunit};
+      ($tmp = $out->slice("(0)")) .= (atan2(-$d1,$d0) % (2*$PI)) * $me->{params}->{angunit};
 
-      ($tmp = $out->((1))) .= (defined $o->{r0}) ?
+      ($tmp = $out->slice("(1)")) .= (defined $o->{r0}) ?
 	      0.5 * log( ($d1*$d1 + $d0 * $d0) / ($o->{r0} * $o->{r0}) ) :
 	      sqrt($d1*$d1 + $d0*$d0);
 
@@ -3073,13 +3205,13 @@ sub t_radial {
     my($d,$o) = @_;
     my($d0,$d1,$out)=
 	( ($d->is_inplace) ?
-	  ($d->((0))->copy, $d->((1))->copy->dummy(0,2), $d) :
-	  ($d->((0)),       $d->((1))->dummy(0,2),       $d->copy)
+	  ($d->slice("(0)")->copy, $d->slice("(1)")->copy->dummy(0,2), $d) :
+	  ($d->slice("(0)"),       $d->slice("(1)")->dummy(0,2),       $d->copy)
 	  );
 
     $d0 /= $me->{params}->{angunit};
 
-    my($os) = $out->(0:1);
+    my($os) = $out->slice("0:1");
     $os .= append(cos($d0)->dummy(0,1),-sin($d0)->dummy(0,1));
     $os *= defined $o->{r0}  ?  ($o->{r0} * exp($d1))  :  $d1;
     $os += $o->{origin};
@@ -3179,7 +3311,7 @@ sub t_quadratic {
     $me->{func} = sub {
 	my($data,$o) = @_;
 	my($dd) = $data->copy - $o->{origin};
-	my($d) =  (defined $o->{dim}) ? $dd->(0:($o->{dim}-1)) : $dd;
+	my($d) =  (defined $o->{dim}) ? $dd->slice("0:".($o->{dim}-1)) : $dd;
 	$d += $o->{str} * ($d * abs($d)) / $o->{l0};
 	$d /= (abs($o->{str}) + 1);
 	$d += $o->{origin};
@@ -3193,7 +3325,7 @@ sub t_quadratic {
     $me->{inv} = sub {
 	my($data,$opt) = @_;
 	my($dd) = $data->copy ;
-	my($d) = (defined $opt->{dim}) ? $dd->(0:($opt->{dim}-1)) : $dd;
+	my($d) = (defined $opt->{dim}) ? $dd->slice("0:".($opt->{dim}-1)) : $dd;
 	my($o) = $opt->{origin};
 	my($s) = $opt->{str};
 	my($l) = $opt->{l0};
@@ -3287,7 +3419,7 @@ sub t_cubic {
     $me->{func} = sub {
 	my($data,$o) = @_;
 	my($dd) = $data->copy;
-	my($d) = (defined $o->{dim}) ? $dd->(0:($o->{dim}-1)) : $dd;
+	my($d) = (defined $o->{dim}) ? $dd->slice("0:".($o->{dim}-1)) : $dd;
 
 	$d -= $o->{origin};
 
@@ -3315,7 +3447,7 @@ sub t_cubic {
 	my($l) = $o->{l0};
 
 	my($dd) = $data->copy;
-	my($d) = (defined $o->{dim}) ? $dd->(0:($o->{dim}-1)) : $dd;
+	my($d) = (defined $o->{dim}) ? $dd->slice("0:".($o->{dim}-1)) : $dd;
 
 	$d -= $o->{origin};
 	$d *= ($o->{st}+1);
@@ -3448,7 +3580,7 @@ sub t_quartic {
     $me->{func} = sub {
 	my($data,$o) = @_;
 	my($dd) = $data->copy - $o->{origin};
-	my($d) =  (defined $o->{dim}) ? $dd->(0:($o->{dim}-1)) : $dd;
+	my($d) =  (defined $o->{dim}) ? $dd->slice("0:".($o->{dim}-1)) : $dd;
 	$d += $o->{str} * ($d * abs($d)) / $o->{l0};
 	$d /= (abs($o->{str}) + 1);
 	$d += $o->{origin};
@@ -3462,7 +3594,7 @@ sub t_quartic {
     $me->{inv} = sub {
 	my($data,$opt) = @_;
 	my($dd) = $data->copy ;
-	my($d) = (defined $opt->{dim}) ? $dd->(0:($opt->{dim}-1)) : $dd;
+	my($d) = (defined $opt->{dim}) ? $dd->slice("0:".($opt->{dim}-1)) : $dd;
 	my($o) = $opt->{origin};
 	my($s) = $opt->{str};
 	my($l) = $opt->{l0};
@@ -3569,15 +3701,15 @@ sub t_spherical {
 	my($data,$o) = @_;
 	my($d) = $data->copy - $o->{origin};
 
-	my($d0,$d1,$d2) = ($d->((0)),$d->((1)),$d->((2)));
+	my($d0,$d1,$d2) = ($d->slice("(0)"),$d->slice("(1)"),$d->slice("(2)"));
 	my($out) =   ($d->is_inplace) ? $data : $data->copy;
 
         my $tmp; # work around perl -d "feature"
-	($tmp = $out->((0))) .= atan2($d1, $d0);
-	($tmp = $out->((2))) .= sqrt($d0*$d0 + $d1*$d1 + $d2*$d2);
-	($tmp = $out->((1))) .= asin($d2 / $out->((2)));
+	($tmp = $out->slice("(0)")) .= atan2($d1, $d0);
+	($tmp = $out->slice("(2)")) .= sqrt($d0*$d0 + $d1*$d1 + $d2*$d2);
+	($tmp = $out->slice("(1)")) .= asin($d2 / $out->slice("(2)"));
 
-	($tmp = $out->(0:1)) /= $o->{angunit}
+	($tmp = $out->slice("0:1")) /= $o->{angunit}
 	  if(defined $o->{angunit});
 
 	$out;
@@ -3588,13 +3720,13 @@ sub t_spherical {
 
 	my($theta,$phi,$r,$out) =
     ( ($d->is_inplace) ?
-	      ($d->((0))->copy, $d->((1))->copy, $d->((2))->copy, $d) :
-	      ($d->((0)),       $d->((1)),       $d->((2)),       $d->copy)
+	      ($d->slice("(0)")->copy, $d->slice("(1)")->copy, $d->slice("(2)")->copy, $d) :
+	      ($d->slice("(0)"),       $d->slice("(1)"),       $d->slice("(2)"),       $d->copy)
 	      );
 
 
 	my($x,$y,$z) =
-	    ($out->((0)),$out->((1)),$out->((2)));
+	    ($out->slice("(0)"),$out->slice("(1)"),$out->slice("(2)"));
 
 	my($ph,$th);
 	if(defined $o->{angunit}){
@@ -3727,8 +3859,8 @@ sub t_projective {
       unless($p->dims==3 && all(pdl($p->dims)==pdl(2,2,4)));
 
     # Solve the system of N equations to find the projective transform
-    my ($p0,$p1,$p2,$p3) = ( $p(:,(0),(0)), $p(:,(0),(1)), $p(:,(0),(2)), $p(:,(0),(3)) );
-    my ($P0,$P1,$P2,$P3) = ( $p(:,(1),(0)), $p(:,(1),(1)), $p(:,(1),(2)), $p(:,(1),(3)) );
+    my ($p0,$p1,$p2,$p3) = ( $p->slice(":,(0),(0)"), $p->slice(":,(0),(1)"), $p->slice(":,(0),(2)"), $p->slice(":,(0),(3)") );
+    my ($P0,$P1,$P2,$P3) = ( $p->slice(":,(1),(0)"), $p->slice(":,(1),(1)"), $p->slice(":,(1),(2)"), $p->slice(":,(1),(3)") );
 #print "declaring PDL...\n"    ;
     my $M = pdl( [ [$p0->at(0), $p0->at(1), 1,        0,        0, 0,  -$P0->at(0)*$p0->at(0), -$P0->at(0)*$p0->at(1)],
 		   [       0,        0, 0, $p0->at(0), $p0->at(1), 1,  -$P0->at(1)*$p0->at(0), -$P0->at(1)*$p0->at(1)],
@@ -3740,11 +3872,11 @@ sub t_projective {
 		   [       0,        0, 0, $p3->at(0), $p3->at(1), 1,  -$P3->at(1)*$p3->at(0), -$P3->at(1)*$p3->at(1)]
 		   ] );
 #print "ok.  Finding inverse...\n";
-    my $h = ($M->inv x $p(:,(1),:)->flat->(*1))->((0));
+    my $h = ($M->inv x $p->slice(":,(1),:")->flat->slice("*1"))->slice("(0)");
 #    print "ok\n";
     my $matrix = ones(3,3);
     my $tmp; # work around perl -d "feature"
-    ($tmp = $matrix->flat->(0:7)) .= $h;
+    ($tmp = $matrix->flat->slice("0:7")) .= $h;
     $me->{params}->{matrix} = $matrix;
 
     $me->{params}->{matinv} = $matrix->inv;
@@ -3759,17 +3891,17 @@ sub t_projective {
   $me->{func} = sub {
     my($data,$o) = @_;
     my($id) = $data->dim(0);
-    my($d) = $data->glue(0,ones($data->(0)));
-    my($out) = ($o->{matrix} x $d->(*1))->((0));
-    return ($out->(0:$id-1)/$out->($id));
+    my($d) = $data->glue(0,ones($data->slice("0")));
+    my($out) = ($o->{matrix} x $d->slice("*1"))->slice("(0)");
+    return ($out->slice("0:".($id-1))/$out->slice("$id"));
   };
 
   $me->{inv} = sub {
     my($data,$o) = @_;
     my($id) = $data->dim(0);
-    my($d) = $data->glue(0,ones($data->(0)));
-    my($out) = ($o->{matinv} x $d->(*1))->((0));
-    return ($out->(0:$id-1)/$out->($id));
+    my($d) = $data->glue(0,ones($data->slice("0")));
+    my($out) = ($o->{matinv} x $d->slice("*1"))->slice("(0)");
+    return ($out->slice("0:".($id-1))/$out->slice("$id"));
   };
 
   $me;
@@ -1,4 +1,4 @@
-BUGS
+Bugs.pod
 Basic/AutoLoader.pm
 Basic/Bad/Makefile.PL
 Basic/Bad/bad.pd
@@ -101,6 +101,7 @@ Basic/Pod/Course.pod
 Basic/Pod/Dataflow.pod
 Basic/Pod/Delta.pod
 Basic/Pod/FAQ.pod
+Basic/Pod/Index.pod
 Basic/Pod/Indexing.pod
 Basic/Pod/Internals.pod
 Basic/Pod/MATLAB.pod
@@ -124,6 +125,7 @@ Basic/SourceFilter/Changes
 Basic/SourceFilter/FilterSimple.pm
 Basic/SourceFilter/FilterUtilCall.pm
 Basic/SourceFilter/Makefile.PL
+Basic/SourceFilter/ModuleCompile.pm
 Basic/SourceFilter/NiceSlice.pm
 Basic/SourceFilter/example
 Basic/SourceFilter/local.perldlrc
@@ -141,9 +143,11 @@ Demos/BAD2_demo.pm.PL
 Demos/BAD_demo.pm.PL
 Demos/Cartography_demo.pm
 Demos/General.pm
+Demos/Gnuplot_demo.pm
 Demos/Makefile.PL
 Demos/PGPLOT_OO_demo.pm
 Demos/PGPLOT_demo.pm
+Demos/Prima.pm
 Demos/Screen.pm
 Demos/Transform_demo.pm
 Demos/TriD/mandel.pl
@@ -167,11 +171,6 @@ Doc/Doc.pm
 Doc/Doc/Config.pm.PL
 Doc/Doc/Perldl.pm
 Doc/Makefile.PL
-Doc/Pod/Makefile.PL
-Doc/Pod/Parser.pm
-Doc/Pod/README
-Doc/Pod/Select.pm
-Doc/Pod/Usage.pm
 Doc/README
 Doc/TODO
 Doc/mkhtmldoc.pl
@@ -351,13 +350,13 @@ IO/HDF/VS/Makefile.PL
 IO/HDF/VS/VS.pd
 IO/HDF/buildfunc.pm
 IO/HDF/typemap
+IO/IDL/IDL.pm
+IO/IDL/Makefile.PL
 IO/IDL/README
 IO/IO.pod
 IO/Makefile.PL
 IO/Misc/Makefile.PL
 IO/Misc/misc.pd
-IO/NDF/Makefile.PL
-IO/NDF/NDF.pm.PL
 IO/Pnm/Makefile.PL
 IO/Pnm/Pic.pm
 IO/Pnm/pnm.pd
@@ -375,9 +374,6 @@ Lib/FFT/Makefile.PL
 Lib/FFT/fft.pd
 Lib/FFT/fftn.c
 Lib/FFT/fftn.h
-Lib/FFTW/Makefile.PL
-Lib/FFTW/Readme
-Lib/FFTW/fftw.pd
 Lib/Filter/LinPred.pm
 Lib/Filter/Linear.pm
 Lib/Filter/Makefile.PL
@@ -394,6 +390,7 @@ Lib/GIS/Proj/Makefile.PL
 Lib/GIS/Proj/Proj.pd
 Lib/GIS/Proj/README
 Lib/GIS/Proj/TODO
+Lib/GIS/Proj/include/projects.h
 Lib/GSL/DIFF/FUNC.c
 Lib/GSL/DIFF/Makefile.PL
 Lib/GSL/DIFF/gsl_diff.pd
@@ -647,21 +644,22 @@ cygwin/README
 cygwin/drivers.list
 cygwin/g77_gcc.conf
 debian/README.Debian
-debian/README.source
 debian/changelog
 debian/compat
 debian/control
 debian/copyright
+debian/dh_pdl
 debian/f77conf.pl
 debian/fix_man_encoding.sed
 debian/fix_man_name.sed
-debian/patches/00list
+debian/patches/series
 debian/pdl.dirs
 debian/pdl.doc-base
 debian/pdl.docs
 debian/pdl.install
 debian/pdl.links
 debian/pdl.lintian-overrides
+debian/pdl.manpages
 debian/pdl.menu
 debian/pdl.postinst
 debian/pdl.prerm
@@ -669,6 +667,10 @@ debian/pdl.remove
 debian/pdl.triggers
 debian/perldl.conf
 debian/rules
+debian/source/format
+debian/write_config_debian.pl
+inc/Carp.pm
+inc/Carp/Heavy.pm
 inc/Devel/CheckLib.pm
 m51.fits
 macosx/README
@@ -700,7 +702,6 @@ t/erfi.t
 t/familyfree.t
 t/fastraw.t
 t/fft.t
-t/fftw.t
 t/fits.t
 t/flexraw.t
 t/flexraw_fortran.t
@@ -728,12 +729,13 @@ t/ica.t
 t/image2d.t
 t/imagend.t
 t/imagergb.t
-# t/inline-comment-test.t
+t/inline-comment-test.t
 t/inlinepdlpp.t
 t/interp.t
 t/interp_slatec.t
 t/interpol.t
 t/iotypes.t
+t/lgamma.t
 t/limits_00.t
 t/limits_errb.t
 t/limits_keyspecs.t
@@ -752,7 +754,6 @@ t/matrix.t
 t/matrixops.t
 t/minuit.t
 t/misc.t
-t/ndf.t
 t/niceslice.t
 t/nsdatahandle.t
 t/ones.t
@@ -783,11 +784,13 @@ t/pthread_auto.t
 t/reduce.t
 t/refs.t
 t/requiredmods.t
+t/rim.t
 t/round.t
 t/scope.t
 t/segfault.t
 t/simplex.t
 t/slatec.t
+t/slice-exceptions.t
 t/slice.t
 t/storable.t
 t/subclass.t
@@ -799,6 +802,7 @@ t/thread_def.t
 t/transform.t
 t/trig.t
 t/ufunc.t
+t/unpdl.t
 t/vaffine.t
 t/xvals.t
 utils/perldlpp.pl
@@ -231,6 +231,7 @@ RCS
 ^debian/patched/
 ^gsl.pl
 ^inc/Alien/Proj4/Makefile.PL
+^inc/Devel
 ^inv-data.pl
 ^patch
 ^pdl$
@@ -264,3 +265,5 @@ pure_all
 so_locations
 subdirs
 ~$
+^work
+^pdl.*-log.txt$
@@ -4,7 +4,7 @@
       "PerlDL Developers (perldl@jach.hawaii.edu)"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150",
+   "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.132140",
    "license" : [
       "unknown"
    ],
@@ -16,35 +16,39 @@
    "no_index" : {
       "directory" : [
          "t",
-         "inc"
+         "inc",
+         "Lib/FFTW"
       ]
    },
    "prereqs" : {
       "build" : {
          "requires" : {
-            "ExtUtils::MakeMaker" : 0
+            "ExtUtils::MakeMaker" : "0"
          }
       },
       "configure" : {
          "requires" : {
-            "ExtUtils::MakeMaker" : 0
+            "Devel::CheckLib" : "1.01"
          }
       },
       "runtime" : {
          "requires" : {
-            "Astro::FITS::Header" : 0,
-            "Convert::UU" : 0,
+            "Astro::FITS::Header" : "0",
+            "Convert::UU" : "0",
             "Data::Dumper" : "2.121",
-            "ExtUtils::MakeMaker" : "6.31",
-            "File::Map" : "0.47",
+            "ExtUtils::MakeMaker" : "6.56",
+            "File::Map" : "0.57",
             "File::Spec" : "0.6",
-            "File::Temp" : 0,
-            "Filter::Util::Call" : 0,
+            "File::Temp" : "0",
+            "Filter::Simple" : "0.88",
+            "Filter::Util::Call" : "0",
             "Inline" : "0.43",
-            "OpenGL" : "0.65",
-            "Pod::Parser" : 0,
-            "Pod::Select" : 0,
+            "Module::Compile" : "0.23",
+            "OpenGL" : "0.6702",
+            "Pod::Parser" : "0",
+            "Pod::Select" : "0",
             "Storable" : "1.03",
+            "Test::Warn" : "0",
             "Text::Balanced" : "1.89"
          }
       }
@@ -52,12 +56,9 @@
    "release_status" : "stable",
    "resources" : {
       "bugtracker" : {
-         "web" : "http://sourceforge.net/tracker/?func=browse&group_id=612&atid=100612"
+         "web" : "http://sourceforge.net/p/pdl/bugs/"
       },
-      "homepage" : "http://pdl.perl.org/",
-      "repository" : {
-         "url" : "http://pdl.git.sourceforge.net/git/gitweb.cgi?p=pdl/pdl"
-      }
+      "homepage" : "http://pdl.perl.org/"
    },
-   "version" : "v2.4.11"
+   "version" : "2.007"
 }
@@ -5,9 +5,9 @@ author:
 build_requires:
   ExtUtils::MakeMaker: 0
 configure_requires:
-  ExtUtils::MakeMaker: 0
+  Devel::CheckLib: 1.01
 dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150'
+generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.132140'
 license: unknown
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -17,23 +17,26 @@ no_index:
   directory:
     - t
     - inc
+    - Lib/FFTW
 requires:
   Astro::FITS::Header: 0
   Convert::UU: 0
   Data::Dumper: 2.121
-  ExtUtils::MakeMaker: 6.31
-  File::Map: 0.47
+  ExtUtils::MakeMaker: 6.56
+  File::Map: 0.57
   File::Spec: 0.6
   File::Temp: 0
+  Filter::Simple: 0.88
   Filter::Util::Call: 0
   Inline: 0.43
-  OpenGL: 0.65
+  Module::Compile: 0.23
+  OpenGL: 0.6702
   Pod::Parser: 0
   Pod::Select: 0
   Storable: 1.03
+  Test::Warn: 0
   Text::Balanced: 1.89
 resources:
-  bugtracker: http://sourceforge.net/tracker/?func=browse&group_id=612&atid=100612
+  bugtracker: http://sourceforge.net/p/pdl/bugs/
   homepage: http://pdl.perl.org/
-  repository: http://pdl.git.sourceforge.net/git/gitweb.cgi?p=pdl/pdl
-version: v2.4.11
+version: 2.007
@@ -13,7 +13,7 @@ check_lib_or_exit(
 
 use 5.008_000;      # explicitly require 5.8.x or above
 
-use ExtUtils::MakeMaker 6.31;  # for INSTALL_BASE support
+use ExtUtils::MakeMaker 6.56;  # for CONFIGURE_REQUIRES support
 
 $::PP_VERBOSE = 0; # =1 makes PP waffle a lot
 
@@ -255,7 +255,8 @@ package PDL::Version;
 #  a single, consistent place to get the current PDL version.
 
 
-\$VERSION='$PDL::VERSION';
+our \$VERSION='$PDL::VERSION';
+\$VERSION = eval \$VERSION;
 
 1;
 
@@ -397,7 +398,10 @@ BEGIN{
   # test for critical modules
   @hasnt = ();
   my @test = ( ['Filter::Util::Call','Filter'],
+	       ['Filter::Simple','Filter::Simple'],
+	       ## ['Module::Compile','Module::Compile'], # don't do this, fails (why?)
 	       ['Text::Balanced','Text::Balanced'], );
+  ## $DB::single = 1; # uncomment to have debugger stop here
   for my $mod (@test) {
     eval "use $mod->[0]";
     push @hasnt, $mod->[1] if $@;
@@ -474,22 +478,25 @@ my %notestsifmodulesmissing = @hasnt ? # are any required modules missing ?
   (test => {TESTS => 't/requiredmods.t'}) : ();
 
 my @podpms = map { $_.".pod", '$(INST_LIBDIR)/PDL/' . $_ .".pod"}
-  qw/perldl pdldoc/;
+  qw/Bugs perldl pdldoc/;
 
 @prereq = (
 	   'Astro::FITS::Header' => 0,
            'Convert::UU'         => 0,         # for PDL::IO::Dumper
            'Data::Dumper'        => 2.121,     # for PDL::IO::Dumper
-           'ExtUtils::MakeMaker' => 6.31,      # for INSTALL_BASE support
-	   'File::Map'           => 0.47,      # test new mmap implementation
+           'ExtUtils::MakeMaker' => 6.56,      # for CONFIGURE_REQUIRES support
+	   'File::Map'           => 0.57,      # test new mmap implementation
 	   'File::Spec'          => 0.6,
 	   'File::Temp'          => 0,
 	   'Filter::Util::Call'  => 0,         # for PDL::NiceSlice
+	   'Filter::Simple'      => 0.88,      # for new PDL::NiceSlice
 	   'Inline'              => 0.43,
+	   'Module::Compile'     => 0.23,      # for new PDL::NiceSlice
 	   'Pod::Parser'         => 0,         # version TBD for PDL::Doc
 	   'Pod::Select'         => 0,         # version TBD for PDL::Doc
            'Storable'            => 1.03,      # for PDL::IO::Storable
 	   'Text::Balanced'      => 1.89,      # for PDL::NiceSlice
+           'Test::Warn'          => 0,         # for t/pptest.t
 	  );
 
 # add OpenGL version dependency for CPAN to follow
@@ -498,7 +505,7 @@ push @prereq, ('OpenGL' => $PDL::Config{POGL_VERSION}) if $PDL::Config{USE_POGL}
 # push @prereq, ('ExtUtils::F77' => 1.10) unless $seen_f77conf;
 
 my @exe_files = ('perldl', 'pdldoc');
-my $cleanup = 'perldl pdldoc pdldoc.db pdldoc.pod perldl.pod ';
+my $cleanup = 'pdl perldl pdldoc pdldoc.db pdldoc.pod perldl.pod ';
 
 if($^O !~ /mswin32/i) {
       $cleanup = 'pdl.c ' . $cleanup;
@@ -517,18 +524,25 @@ if($Config{archname}=~m/x86_64/) {
 
 %makefile_hash = (
 	      'PREREQ_PM' => { @prereq },
+              'CONFIGURE_REQUIRES' => { 'Devel::CheckLib' => 1.01, },
 	      'NAME' => 'PDL',
 	      'VERSION_FROM' => 'Basic/Core/Version.pm',
 	      'EXE_FILES' => \@exe_files,
 	      'PM' => { @podpms }, #so that the script docs are picked up
               'META_MERGE' => {
+                 no_index => { directory => [ 'Lib/FFTW' ], },
                  resources => {
                     homepage => 'http://pdl.perl.org/',
-                    bugtracker  => 'http://sourceforge.net/tracker/?func=browse&group_id=612&atid=100612',
-                    repository  => 'http://pdl.git.sourceforge.net/git/gitweb.cgi?p=pdl/pdl',
+                    bugtracker  => 'http://sourceforge.net/p/pdl/bugs/',
+                    repository  => {
+                       url => 'git://git.code.sf.net/p/pdl/code',
+                       type => 'git',
+                       web => 'http://sourceforge.net/p/pdl/code/ci/master/tree/',
+                    },
                  },
               },
-              'MAN1PODS' => { 'perldl' => '$(INST_MAN1DIR)/perldl.$(MAN1EXT)',
+              'MAN1PODS' => { 'Bugs.pod' => '$(INST_MAN1DIR)/PDL::Bugs.$(MAN1EXT)',
+                              'perldl' => '$(INST_MAN1DIR)/perldl.$(MAN1EXT)',
                               'pdldoc' => '$(INST_MAN1DIR)/pdldoc.$(MAN1EXT)' },
 	      'MAN3PODS' => {}, # don't pick up the script pods again
 	      'OPTIMIZE'  => $PDL::Config{OPTIMIZE} || $Config{optimize},
@@ -614,9 +628,9 @@ doc_perl_install ::
 	@$(PERL) -Mblib Doc/scantree.pl $(INSTALLARCHLIB)
 %HTML%	@echo "doc_perl_install: Building PDL documentation web pages ..."
 %HTML%	@$(PERL) Doc/mkhtmldoc.pl $(INSTALLARCHLIB)/PDL
-
 ';
 
+
   if(defined $PDL::Config{HTML_DOCS} && !$PDL::Config{HTML_DOCS}){
     $text=~ s/\%HTML\%[^\n]*\n//og; # Remove %HTML% lines
   } else {
@@ -676,12 +690,9 @@ return $text
 
 ##############################
 # processPL: generate Makefile lines for top-level components that are created by just perling a .PL file.
-# This currently (28-October) includes pdl, pdldoc, and perldl.
-#
-# Nomininally MakeMaker is supposed to just handle this, but seems to create circular dependencies when
-# left to its own devices. (CED 28-Oct-2008)
 
 #EU::MM's processPL() is continually broken on Win32 ... hence:
+
 sub MY::processPL {
     ### This fix seems necessary with current versions of MM - otherwise it creates circular
     ### dependencies to "pm_to_blib" for .PL files (!) -- CED 9-July-2008
@@ -694,6 +705,8 @@ sub MY::processPL {
                          ?  $self->{PL_FILES}->{$plfile}
 	                 : [$self->{PL_FILES}->{$plfile}];
 	    my $target;
+
+
 	    if($Config{make} =~ /\bdmake/i) {
 		foreach $target (@$list) {
 		    push @m, "
@@ -707,13 +720,25 @@ $target :
 	    }
 	    else {
 		foreach $target (@$list) {
+
+	    # Single out pdl.PL for special treatment since it needs compilation
+	    # after post-processing.  This used to happen automagically; it's not clear
+	    # why it still doesn't. (CED 2012-11-12)
+		    my $compilestr;
+		    if($plfile eq "pdl.PL" && $Config{make} !~ /\bnmake/i) {
+			$compilestr = "\n\t\$(CC) -o pdl pdl.c\n";
+		    } else {
+			$compilestr = "";
+		    }
+
 		    push @m, "
 all :: $target
 	\$(NOECHO) \$(NOOP)
 
 $target ::
-	\$(PERLRUNINST) $plfile $target
+	\$(PERLRUNINST) $plfile $target$compilestr
 ";
+
 		} # close foreach
 	    }
 	}
@@ -20,6 +20,7 @@ if (!defined $PDL::Config{WITH_DEVEL_REPL}) {
          'EXE_FILES' => [ 'pdl2' ],
          'DIR' => [ qw(Profile Plugin) ],
          'PM' => { 'Script.pm' => '$(INST_LIBDIR)/Perldl2/Script.pm', @podpms },
+	  (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
       );
    } else {
       # Devel::REPL was not found
@@ -37,6 +38,7 @@ elsif ($PDL::Config{WITH_DEVEL_REPL}) {
 	 'EXE_FILES' => [ 'pdl2' ],
 	 'DIR' => [ qw(Profile Plugin) ],
          'PM' => { 'Script.pm' => '$(INST_LIBDIR)/Perldl2/Script.pm', @podpms },
+         (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
   );
 }
 else {
@@ -18,7 +18,7 @@ sub clean_error_string {
    $bigerr =~ s/^\s+Class::MOP.*$//ms;
    $bigerr =~ s/^\s+Lexical::Persistence.*$//ms;
    $bigerr =~ s/^\s+main::.*$//ms;
-   $bigerr =~ s/^\s+eval {.*$//ms;
+   $bigerr =~ s/^\s+eval \{.*$//ms;
    $bigerr =~ s/^\s+PDL::Core::barf.*$//ms;
    return $bigerr;
 }
@@ -9,4 +9,5 @@ WriteMakefile(
       'PDLCommands.pm' => '$(INST_LIBDIR)/Plugin/PDLCommands.pm',
       'PrintControl.pm' => '$(INST_LIBDIR)/Plugin/PrintControl.pm',
    },
+    (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
@@ -24,9 +24,14 @@ around 'read' => sub {
    ##     warn $mess if $mess;
    ## }
 
-   # filter out default PDL shell prompt for easier
-   # cut-and-paste of demo code
-   $lines =~ s/\s*(?:pdl|perldl)>\s*//i if defined $lines;
+   # Filter out PDL shell prefixes from cut-n-pasted lines
+   if ( defined($lines) and $lines =~ s/$PERLDL::PREFIX_RE// ) {
+      if ($PERLDL::TERM->can('GetHistory') and $PERLDL::TERM->can('SetHistory')) {
+         my @hist = $PERLDL::TERM->GetHistory();
+         foreach my $entry (@hist) { $entry =~ s/$PERLDL::PREFIX_RE//; }
+         $PERLDL::TERM->SetHistory(@hist);
+      }
+   }
 
    return $lines unless defined $lines;
 
@@ -4,4 +4,5 @@ WriteMakefile(
    'NAME' => 'PDL::Perldl2::Profile',
    'VERSION' => '2.000',
    'PM' => { 'Perldl2.pm' => '$(INST_LIBDIR)/Profile/Perldl2.pm' },
+   (eval ($ExtUtils::MakeMaker::VERSION) >= 6.57_02 ? ('NO_MYMETA' => 1) : ()),
 );
@@ -7,7 +7,7 @@ package PDL::Perldl2::Profile::Perldl2;
 use Moose;
 use namespace::clean -except => [ 'meta' ];
 
-$PDL::Perldl2::Profile::Perldl2::VERSION = 0.007;
+$PDL::Perldl2::Profile::Perldl2::VERSION = 0.008;
 
 with 'Devel::REPL::Profile';
 
@@ -93,13 +93,14 @@ sub apply_profile {
       $PERLDL::PAGER  = ((exists $ENV{PAGER}) ? $ENV{PAGER} : 'more');
       $PERLDL::PAGING = 0;
       $PERLDL::PROMPT = "pdl> ";                          # string or code reference
+      $PERLDL::PREFIX_RE = qr(^\s*(?:pdl|perldl)>\s*);    # RE for shell prompts
       $PERLDL::TERM = $_REPL->term;
       ] );
 
    #autoflush STDOUT
    $repl->eval('$|=1;');
-   # print alias
-   $repl->eval('sub p { local $, = " "; print @_ };');
+   # p command (NOTE: this is not an alias for print)
+   $repl->eval('sub p { local $, = " "; print @_,"\n" };');
 
    # list history command
    $repl->eval('sub l {
@@ -126,12 +127,14 @@ sub apply_profile {
       demo pgplot      # PGPLOT graphics output (Req.: PGPLOT)
       demo OOplot      # PGPLOT OO interface    (Req.: PGPLOT)
 
+      demo gnuplot     # Gnuplot graphics (requires PDL::Graphics::Gnuplot)
+      demo prima       # Prima graphics (requires PDL::Graphics::Prima)
+
       demo transform   # Coordinate transformations (Req.: PGPLOT)
       demo cartography # Cartographic projections (Req.: PGPLOT)
 
       demo bad         # Bad-value demo (Req.: bad value support)
       demo bad2        # Bad-values, part 2 (Req.: bad value support and PGPLOT)
-
 EOD
       return;
       } # if: /^$/
@@ -146,7 +149,9 @@ EOD
          'bad' => 'PDL::Demos::BAD_demo',
          'bad2' => 'PDL::Demos::BAD2_demo',
          'transform' => 'PDL::Demos::Transform_demo',
-         'cartography' => 'PDL::Demos::Cartography_demo'
+         'cartography' => 'PDL::Demos::Cartography_demo',
+         'gnuplot' => 'PDL::Demos::Gnuplot_demo',
+         'prima' => 'PDL::Demos::Prima',
       );
 
       if ( exists $demos{$_} ) {
@@ -224,7 +229,7 @@ PDL::Perldl2::Profile::Perldl2 - profile for Perldl2 shell
     system> re.pl --profile=PDL::Perldl2::Profile::Perldl2  # unix-ish shell
     system> re    --profile=PDL::Perldl2::Profile::Perldl2  # win32 CMD shell
 
-    Perldl2 Shell v0.004
+    Perldl2 Shell v0.008
           PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
           'COPYING' in the PDL distribution. This is free software and you
           are welcome to redistribute it under certain conditions, see
@@ -255,7 +260,7 @@ PDL::Perldl2::Profile::Perldl2 - profile for Perldl2 shell
     
     Type Ctrl-D or quit to exit
     
-    Loaded PDL v2.4.9
+    Loaded PDL v2.006
     
     pdl> 
 
@@ -1,5 +1,5 @@
 Created on: Thu 10 Dec 2009 10:32:58 PM
-Last saved: Fri 18 Feb 2011 10:20:46 AM 
+Last saved: Tue 09 Jul 2013 08:51:39 AM 
 
 
 +-----------------------------------------------------------+
@@ -7,8 +7,7 @@ Last saved: Fri 18 Feb 2011 10:20:46 AM
 +-----------------------------------------------------------+
 
 This directory contains development efforts for a new and
-improved perldl shell (Perldl2) that can integrate with
-the Padre IDE to support PDL development.
+improved perldl shell (Perldl2).
 
 You need to install the version 1.003011 of Devel::REPL
 and have installed either Term::ReadLine::Perl or
@@ -36,9 +35,9 @@ capabilities.
 
  pdl2
    A perl script for starting the Perldl2 shell.
-   (Falls back to perldl if any of Devel::REPL or
-    Term::ReadLine::Gnu or Term::ReadLine::Perl are
-    not installed)
+   (Falls back to the original perldl if either Devel::REPL
+   or neither Term::ReadLine::Gnu nor Term::ReadLine::Perl
+   are installed.)
 
 
 +-----------------------------------------------------------+
@@ -72,7 +71,12 @@ capabilities.
   Ctrl-D or quit, (q, x, and exit shortcuts are also
   available).  If Devel::REPL is not installed (or you
   don't have either TR::Gnu or TR::Perl), pdl2 will use
-  perldl instead but any new features will not be available.
+  perldl instead but the new Perldl2 features will not
+  be available.
+
+  The idea is that one just uses pdl2 where you used to
+  use perldl.  At some point, the development will be
+  complete and there will be only one PDL shell.
 
 
 +-----------------------------------------------------------+
@@ -116,7 +120,7 @@ capabilities.
 
  l <num> prints the last <num> lines of history, default 20.
 
- p is an alias for print.
+ p prints the following args separated by space (i.e., $,=' ')
 
  demo as a command by itself lists the possible demos available.
  Otherwise it runs the specified demo.
@@ -1,5 +1,5 @@
 Created on: Thu 10 Dec 2009 10:32:58 PM
-Last saved: Mon 07 Nov 2011 03:33:22 PM 
+Last saved: Tue 09 Jul 2013 09:05:18 AM 
 
 
 +-------------------------------------------------------------------+
@@ -8,7 +8,7 @@ Last saved: Mon 07 Nov 2011 03:33:22 PM
 
   Set readline_name to 'PDL Shell' instead of the
   default 'Perl REPL' but need to figure how to do
-  so first.
+  so first (override default term?).
 
   Add syntax highlighting to help ensure correct
   entries (e.g., in matlab keywords are blue, strings
@@ -25,9 +25,6 @@ Last saved: Mon 07 Nov 2011 03:33:22 PM
   strings (or other text) from input lines.  Need to be
   able to toggle on/off and set the regexp used.
 
-  Fix history line saves so that only the prefix-stripped
-  text is entered rather than the original pasted text.
-
   Allow Ctrl-C to interrupt a line but keep the entry
   in history for edit...
 
@@ -69,11 +66,10 @@ Last saved: Mon 07 Nov 2011 03:33:22 PM
   loaded, and plugins for the REPL.  It should be possible
   to <TAB> complete for these.
 
-  Add tracking and expansion for PGPLOT or PLplot windows for
-  reference.  (In PGPLOT there is a Window Name property and
-  a corresponding $w->name to print it out but you cannot set
-  it).  It would be nice to have a list/table of currently
-  active figures.  (What about PLplot window names/IDs?)
+  Add tracking and expansion for all graphics windows that
+  are open/active (PGPLOT, PLplot, Prima, GLUT/FreeGLUT...)
+  windows for reference.  It would be nice to have a
+  list/table of currently active figures.
 
   IDEA: Associate metadata with image or figure windows
   (e.g., the commands that generated the figure).
@@ -101,6 +97,7 @@ Last saved: Mon 07 Nov 2011 03:33:22 PM
   work here (curses based or GUI based).  Maybe there could
   be a runtime list/variable in PDL::Config that is updated
   as each module is loaded.  Override '*CORE::GLOBAL::use'?
+  It would also be possible to use MOP features of Moose.
  
   Review and integrate $PERLDL::XX parameters.  Some are not
   needed or useful for Perldl2.  Others need code to tie in
@@ -143,7 +140,7 @@ Last saved: Mon 07 Nov 2011 03:33:22 PM
   Add MultiLine prompt with continuation character marking
   the open structures. (e.g. MultiLine::TextBalanced).
 
-  Add GLUT event loop support to Term::ReadLine::Perl and
+  Add generic event loop support to Term::ReadLine::Perl and
   Term::ReadLine::Gnu.  Need to figure out a clean way to
   map this into the original modules.
  
@@ -155,11 +152,14 @@ Last saved: Mon 07 Nov 2011 03:33:22 PM
 
   Be sure to add a line to history if it closes out a
   multi-line block.  This should not be an issue once we
-  have multi-line history entries supported.
+  have multi-line history entries supported.  It would
+  be nice if history entries were by blocks with the
+  ability to go by lines within if desired.
 
   Make !-syntax history more restrictive so that it does
   not conflict with perl usage for negation.  Maybe it
-  should only be good for completion?
+  should only be good for completion?  At least if it is
+  the first char and do_print(0).
  
   Add !<command>:p support to print history commands and
   fix the problem where the !<num> command is different
@@ -17,7 +17,7 @@ Release_Notes		A list of features or issues with regard to the
 
 Known_problems	 	Check before you report problems
 
-BUGS			How to make a bug report
+BUGS.pod		How to make a bug report, PDL::Bugs
 
 perldl.conf		PDL configuration options
 
@@ -84,7 +84,7 @@ Bug Reports
 -----------
 You can check the existing PDL bugs on sourceforge at
 
-	http://sourceforge.net/tracker/?group_id=612&atid=100612
+	http://sourceforge.net/p/pdl/bugs/
 
 The mailing list archives can be searched/read at
 
@@ -100,7 +100,7 @@ If you need to post a problem report, and after checking with
 the perldl list that it *is* a bug, please use the sourceforge.net
 tracker system following the guidance in the BUGS file:
 
-	http://sourceforge.net/tracker/?group_id=612&atid=100612
+	http://sourceforge.net/p/pdl/bugs/
 
 
 
@@ -1,271 +1,343 @@
-Release Notes for PDL 2.4.11  -----------------------------
-
-General Notes:
-
- * This is a point release of PDL to support the coming perl
-   5.16.0 release.
+Release Notes for PDL 2.007 --------------------------
 
  +---------------------------------------------------------------+
  | BE WARNED:  This release includes an update to the internal,  |
- | C-level PDL API and will require that you re-build any PP or  |
- | XS modules.  Do not upgrade or install over an existing PDL   |
- | installation unless you are prepared to do so!!!              |
+ | C-level PDL API for PDL versions 2.006 and earlier.  This     |
+ | will require that you re-build any PP or XS modules.  Do not  |
+ | upgrade or install over an existing PDL installation unless   |
+ | you are prepared to do so!!!                                  |
  +---------------------------------------------------------------+
 
+General Notes:
+
+ * PDL computations now use 64bit indexing/addressing if
+   your platform supports it (i.e., your perl configuration
+   has $Config{ivsize} == 8).
+   
+   - You can process with pdls with more then 2**32 elements.
+
+   - Memory mapped file IO supports up to 8TB files which
+     allows much simpler processing of large data files.
+     (See mapflex in PDL::IO::FlexRaw for details)
+
+ * PDL-2.007 has a new, unified slicing engine and syntax
+   that consolidates the multiple slicing variants into
+   a backward compatible but now 64bit aware slice.  See
+   the PDL::Slices for the new syntax that is enabled.
+
+ * PDL::FFTW has moved to its own distribution on CPAN
+   and is no longer in the PDL core distribution.  Look
+   for PDL::FFTW3 coming to CPAN soon.
+
+ * Some required dependencies have been update to more
+   recent versions:
+
+   - ExtUtils::MakeMaker now requires version 6.56 or
+     higher, the minimum version with CONFIGURE_REQUIRES
+     support.
+
+   - Perl OpenGL 0.6702 is now required for PDL::Graphics::TriD
+     to build.  This fixes a number of critical bugs and should
+     be a seamless upgrade.
+
+   - File::Map version 0.57 is required.  This fixes map_anonymous
+     support for the >2**32 sizes needed for 64bit support.
+     Legacy mmap support for unix platforms is no longer
+     supported.  The distribution requires File::Map so you
+     should not notice the change.
+
+ * Incompatible Changes:
+
+   - PDL::FFT now uses the same sign convention as FFTW and
+     the rest of the world, -1/+1 for forward and reverse
+     FFT respectively.
+
+   - C/XS API of PDL-2.007 is incompatible with previous
+     PDL releases.  If you upgrade to PDL-2.007, you *will*
+     need to re-install or upgrade *all* dependent XS or PP
+     based modules.
+
+   - PDL now auto-promotes array refs in many places that
+     previously required a piddle (so you can say, e.g.,
+     "$a->index([2,3])" instead of "$a->index(pdl(2,3))").
+
+   - String syntax for slice() specifications now ignore
+     white space.
+
+ * The clean up of the PDL core distribution continues and
+   PDL-2.007 is no exception.  Many bug fixes, documentation
+   updates, code and implementation improvements make this
+   the best testing PDL release to date.
+
 
 Highlights:
 
- * A new implementation mapflex and mapfraw routines provides
-   memory-mapped IO for all platforms including win32 systems.
+ * FITS IO improvements and fixes:
 
- * The new memory mapped IO support is implemented using
-   File::Map so version 0.47 has been added as a required
-   dependency to force automated testing so an automated build
-   will need this dependency installed.
-   
-    NOTE: For systems having POSIX mmap, a manual build of
-    PDL will automatically use the legacy implementation.
+   - Added 'afh" option to rfits to allow explicit use of
+     legacy hash parser for performance reasons.  
 
- * Various cleanup to existing code to fix warnings generated
-   by perl versions 5.15.x and higher.
- 
-   Remove deprecation warning in PGPLOT/Window/Window.pm
-   complex.pd - fix attempts to overload '<=>=' and '=>'
+   - New multiple extension writing support for wfits.
 
- * Sf.net bugs fixed:
+ * Added pp_deprecate_module() to PDL::PP
 
-    3518253  Make PDL::flat work under perl 5.16 (thanks sprout!)
-    3516600  pdl_from_string.t fails w/ BADVAL_USENAN=1
-    3487569  PDL::IO::Misc : rcols problem (thanks bperret!)
-    3476648  PDL build of HTML docs fails on recent bleed Perl
-    
- * Other bugs fixed:
+ * New mode/modeover functions in PDL::Ufunc
 
-    Fix check for glutRunning logic for imag2d
-    Fixed a bug in cat's error reporting.
-    Added lvalue awareness to whereND
+ * Made exception handling in slices more robust.
 
- * New and improved tests have been added to the test suite.
+ * PDL::CLONE_SKIP added for improved ithread support.
 
-    Tests t/gd_oo_tests.t and t/inline-comment-test.t are
-    skipped for BSD platforms (see sf.net bugs #3518190 and
-    #3524081 to track their issues).
+ * Updated graticule() in PDL::Transform::Cartography to
+   support NaN-delimited output.
 
- * New support for multi-line comments in PP code.  See docs for
-   PDL::PP for details (e.g., pdldoc PP).
-    
- * Various enhancements to barf/croak output and messages to make
-   error reports and stack traces more useful and readable.
+ * Bugs fixes:
 
- * There is a new changes (or Changes) target for the PDL Makefile
-   which is a convenience target that allows one to regenerate the
-   Changes file from git.
+   - Fix %hash randomization bugs in PDL tests
 
+   - Fix OpenBSD pthread build problem for non-threaded perls
 
+   - Fix PDL::shape to return vector for 1-D piddles
 
-Release Notes for PDL 2.4.10_005 --------------------------
+   - Fix badvalue-on-truncate support for map and for interpND
 
-General Notes:
+   - Fix for MSVC++ 6.0 to build on 32bit systems.
+     MSVC++ 6.0 cannot be used to build 64bit index support.
 
- +---------------------------------------------------------------+
- | BE WARNED:  This release includes an update to the internal,  |
- | C-level PDL API and will require that you re-build all the    |
- | PP modules.  Do not install over an existing PDL installation |
- | unless you are prepared to do so!!!                           |
- +---------------------------------------------------------------+
+   - Fix polyfit() handling of BAD values and various edge cases.
 
- * A.k.a. PDL-2.4.11 release candidate 2 with support for
-   perl 5.16.0.  Please test!
+   - Fix rare "Bizarre copy of HASH in scalar assignment"
 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
+   - Fix rcols with colsep and $PDL::undefval
 
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
+   - Fix sf.net bug #331 "uniq does not always return proper object"
 
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
+   - Fix sf.net bug #338 PDL::FFT uses backwards sign convention from FFTW
 
-       cpan> get  CHM/PDL-2.4.10_005.tar.gz
-       cpan> make CHM/PDL-2.4.10_005.tar.gz
-       cpan> test CHM/PDL-2.4.10_005.tar.gz
-       cpan> look CHM/PDL-2.4.10_005.tar.gz
+   - Make PDL::NiceSlice preserve line numbering (sf.net feature #75)
 
+   - PDL::IO::GD->new() is now less picky about it args, and no longer crashes
 
-Highlights:
+   - Two bug fixes to transform.pd, and an augmentation
 
- * See PDL-2.4.11 release notes above
 
 
+Release Notes for PDL 2.006 --------------------------
 
-Release Notes for PDL 2.4.10_004 --------------------------
+ +---------------------------------------------------------------+
+ | BE WARNED:  This release includes an update to the internal,  |
+ | C-level PDL API for PDL versions 2.4.10 and earlier.  This    |
+ | will require that you re-build any PP or XS modules.  Do not  |
+ | upgrade or install over an existing PDL installation unless   |
+ | you are prepared to do so!!!                                  |
+ +---------------------------------------------------------------+
 
 General Notes:
 
- * RC-1 for PDL fixes supporting the perl 5.16 release
-   coming next week.
+ * Change to the version number scheme used for PDL
+   from the dotted-integers format back to plain old
+   decimal numbers.
+
+   Unfortunately, PDL has used both alternatives before
+   and in an inconsistent, out-of-order way.  With this
+   release, the current version will also be the most
+   recent version with respect to both numbering schemes.
+   
+   For more details see David Goldens blob post on
+   the topic and the pdl-porters list discussion:
 
- * Another quick CPAN developers release
+     http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
+     http://mailman.jach.hawaii.edu/pipermail//pdl-porters/2013-February/005343.html
  
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
 
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
+ * PDL-2.006 also showcases the demos of two new PDL graphics
+   modules in the perldl/pdl2 shells:
+   
+    - PDL::Graphics::Gnuplot
+      http://search.cpan.org/~zowie/PDL-Graphics-Gnuplot-1.4/
+
+    - PDL::Graphics::Prima
+      http://search.cpan.org/~dcmertens/PDL-Graphics-Prima-0.13/
 
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
+   Both modules install on all supported PDL platforms.  A
+   recent addition is PDL::Graphics::Simple which provides
+   a uniform presentation to the variety off available PDL
+   plot/view/print options.
    
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
+    - PDL::Graphics::Simple
+      http://search.cpan.org/~zowie/PDL-Graphics-Simple-1.004/README.pod
+      
+   Let us know how they work for you.  As they are 
+   relatively "young" contributions your feedback and
+   questions are always welcome.
 
-       cpan> get  CHM/PDL-2.4.10_004.tar.gz
-       cpan> make CHM/PDL-2.4.10_004.tar.gz
-       cpan> test CHM/PDL-2.4.10_004.tar.gz
-       cpan> look CHM/PDL-2.4.10_004.tar.gz
 
+ * PDL Distribution related updates:
+
+    - Fixes a build issue for PDL at ASPerl
+    
+    - Many fixes for debian distributions.
+    
+    - PDL::IO::NDF has been moved to its own
+      distribution on CPAN.  This could affect
+      upgrades from older PDL installs.
+ 
 
 Highlights:
 
- * Please test with perl 5.16 release candidates and report
-   any issues to the PDL developers as soon as possible.
+ * New support for reading IDL format files via PDL::IO::IDL.
 
- * TBD
+ * Added an unpdl method which is (roughly) the inverse
+   operation of pdl (Joel Berger).
 
+ * Updated polyfill and polyfillv routines to the algorithm
+   from pnpoly: more accurate on edge pixels and faster due
+   to its PP implementation (Tim Haines).
 
+ * Added Boundary=>'Replicate' option to conv2d and med2d (chm).
 
-Release Notes for PDL 2.4.10_003 --------------------------
+ * Support for new additional random number generators to
+   PDL::GSL (John Lapeyre).
 
-General Notes:
+ * Add lgamma support for MinGW-built perls with tests
+   to match (sisyphus).
 
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
+ * Many improvments to docs and their generation from
+   PDL sources.  Specific new functionality support:
 
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
+    - Newly refactored docs engine using core perl
+      modules rather than PDL-only ones (Joel Berger)
 
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
+    - New FullDoc key added to PDL::PP makes writing CPAN
+      friendly .pd files much, much easier (David Mertens).
 
-       cpan> get  CHM/PDL-2.4.10_003.tar.gz
-       cpan> make CHM/PDL-2.4.10_003.tar.gz
-       cpan> test CHM/PDL-2.4.10_003.tar.gz
-       cpan> look CHM/PDL-2.4.10_003.tar.gz
+    - New PDL::Doc::add_module() routine to add an external
+      module's POD (with PDL::Doc conventions) to the PDL
+      docs on-line database (Craig DeForest).
 
+ * Many bugs fixed, some even before a ticket could be opened!
 
-Highlights:
+    - Sf.net bug #3607936: Fixed a bug causing crashes
+      due to using inplace with a duplicate argument.
 
- * Fix a missing declaration for add_deletedata_magic()
-   which is believed to be the cause of the warning messages
-   like:
-   
-     (in cleanup) Could not unmap: Invalid argument at t/fastraw.t line 63.
-     (in cleanup) Could not unmap: Invalid argument at t/fastraw.t line 80.
-     ...
+    - Sf.net bug #3603249: AutoLoader leaks $_ into local
+      context, reported and fixed by Craig.
 
+    - Sf.net bug #3588182: Fixed hist() handling of the case
+      of fractional steps in integral input data types.
 
+    - Sf.net bug #3563903: Fixed bug in PNG format detection
+      on win32 platforms.  
 
-Release Notes for PDL 2.4.10_002 --------------------------
+    - Sf.net bug #3544682: Fixed error report bug in perldl
+      that resulted from a change in the way perl handles
+      eval exception reporting.
 
-General Notes:
+    - Sf.net bug #3539760: qsort[vec] are now inplace aware.
 
- * Rerelease of PDL-2.4.10_001 with reverted PROJ commit
-   to enable build to complete for File::Map testing to
-   occur.
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
+    - Sf.net bug #3518190: Potential fix for t/gd_oo_tests.t
+      test crashes.
 
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
+    - Sf.net bug #3515759: Work around for PDL::GIS::Proj
+      build failures with proj-4.8.0.
 
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
+    - Sf.net bug #3479009: Fixed dummy() to generate a
+      valid syntax for the underlying call to slice().
 
-       cpan> get  CHM/PDL-2.4.10_002.tar.gz
-       cpan> make CHM/PDL-2.4.10_002.tar.gz
-       cpan> test CHM/PDL-2.4.10_002.tar.gz
-       cpan> look CHM/PDL-2.4.10_002.tar.gz
+    - Sf.net bug #3475075: Fixed 16-bit PNM raw format handling.
 
+    - Added warning if conv1d is used on a piddle with
+      the badflag set.
 
-Highlights:
+    - Fix NaN sign issues as reported (and fixed!) by
+      Matthew McGillis with contributions by Sisyphus.
+
+    - Fix rim() 3-arg form.  Added tests to support and
+      verify the development.
+
+    - Fixed a problem with multiple windows and imag2d
+      and imag2d_update.
+
+ * The PDL shells keep getting better:
 
- * See notes for PDL-2.4.10_001 below.
+    - New feature in perldl and pdl2 where a pattern matching
+      the PDL shell prompt (in $PERLDL::PREFIX_RE) will get
+      stripped off of input lines before eval.  This makes it
+      easier to cut-and-paste example text from PDL shell
+      sessions or from the PDL Book into an active session.
 
+    -  Added a demo for PDL::Graphics::Prima to the PDL shells.
 
+    -  Added a demo for gnuplot to the PDL shells.
 
-Release Notes for PDL 2.4.10_001 --------------------------
+    -  The p shortcut to display output in the PDL shells has
+       been reverted to its previous 2.4.10 behavior.  If you
+       wish it to be an exact alias for print just override
+       in your .perldlrc or local.perldlrc file.
+
+
+
+Release Notes for PDL 2.4.11  -----------------------------
 
 General Notes:
 
+ * This is a point release of PDL to support the coming perl
+   5.16.0 release.
+
  +---------------------------------------------------------------+
  | BE WARNED:  This release includes an update to the internal,  |
- | C-level PDL API and will require that you re-build all the    |
- | PP modules.  Do not install over an existing PDL installation |
- | unless you are prepared to do so!!!                           |
+ | C-level PDL API and will require that you re-build any PP or  |
+ | XS modules.  Do not upgrade or install over an existing PDL   |
+ | installation unless you are prepared to do so!!!              |
  +---------------------------------------------------------------+
 
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
 
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
+Highlights:
+
+ * A new implementation mapflex and mapfraw routines provides
+   memory-mapped IO for all platforms including win32 systems.
 
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.10_001.tar.gz
-       cpan> make CHM/PDL-2.4.10_001.tar.gz
-       cpan> test CHM/PDL-2.4.10_001.tar.gz
-       cpan> look CHM/PDL-2.4.10_001.tar.gz
-
- * File::Map 0.47 has been added as a dependency for
-   testing purposes so an automated build will need
-   this dependency installed.
+ * The new memory mapped IO support is implemented using
+   File::Map so version 0.47 has been added as a required
+   dependency to force automated testing so an automated build
+   will need this dependency installed.
    
-   For systems having POSIX mmap, the build should
-   still pass using the legacy implementation.
+    NOTE: For systems having POSIX mmap, a manual build of
+    PDL will automatically use the legacy implementation.
 
+ * Various cleanup to existing code to fix warnings generated
+   by perl versions 5.15.x and higher.
+ 
+   Remove deprecation warning in PGPLOT/Window/Window.pm
+   complex.pd - fix attempts to overload '<=>=' and '=>'
 
-Highlights:
+ * Sf.net bugs fixed:
 
- * mapflex and mapfraw routines for memory-mapped IO have been
-   refactored to use the File::Map module.  The new routines
-   should work for all platforms having File::Map version 0.47
-   or later installed.  This new implementation should work
-   for both 32-bit and 64-bit perls as well as with 64-bit file
-   offsets.  Please test and report.
+    3518253  Make PDL::flat work under perl 5.16 (thanks sprout!)
+    3516600  pdl_from_string.t fails w/ BADVAL_USENAN=1
+    3487569  PDL::IO::Misc : rcols problem (thanks bperret!)
+    3476648  PDL build of HTML docs fails on recent bleed Perl
+    
+ * Other bugs fixed:
 
- * Various cleanup to existing code to fix warnings generated
-   by perl-5.15.
- 
- * Other cleanup and bugs fixed (sf.net bug #3487569).
+    Fix check for glutRunning logic for imag2d
+    Fixed a bug in cat's error reporting.
+    Added lvalue awareness to whereND
+
+ * New and improved tests have been added to the test suite.
+
+    Tests t/gd_oo_tests.t and t/inline-comment-test.t are
+    skipped for BSD platforms (see sf.net bugs #3518190 and
+    #3524081 to track their issues).
+
+ * New support for multi-line comments in PP code.  See docs for
+   PDL::PP for details (e.g., pdldoc PP).
+    
+ * Various enhancements to barf/croak output and messages to make
+   error reports and stack traces more useful and readable.
+
+ * There is a new changes (or Changes) target for the PDL Makefile
+   which is a convenience target that allows one to regenerate the
+   Changes file from git.
 
 
 
@@ -529,2950 +601,473 @@ Highlights:
 
 
 
-Release Notes for PDL 2.4.9_995 --------------------------
+Release Notes for PDL 2.4.9 --------------------------
 
 General Notes:
 
- * A.k.a. PDL-2.4.10 release candidate 5
-
- * All focus now is on testing, documentation, web page
-   updates, and writing the PDL Book...
- 
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_995.tar.gz
-       cpan> make CHM/PDL-2.4.9_995.tar.gz
-       cpan> test CHM/PDL-2.4.9_995.tar.gz
-       cpan> look CHM/PDL-2.4.9_995.tar.gz
-
-
-Specific Updates:
+ * Fixes a couple of surprise bugs that were discovered
+   immediately with the PDL-2.4.8 release.
 
- * Add error reporting and diags to t/flexraw_fortran.t
-   to help track down remaining tester fails from the
-   PDL-2.4.10 pre-release candidates.
- 
- * Add values of $PDL::floatformat and $PDL::doubleformat
-   to PDL::Core docs.
- 
- * PDL::Graphics2D now exports imag2d_update in addition
-   to imag2d and twiddle.
- 
- * Clear and clean up POGL dependency information
-   and perl Makefile.PL configure error messages.
+ * See Also: the Release Notes for PDL-2.4.8 below
 
 
 Highlights:
 
- * See above.
-
-
-
-Release Notes for PDL 2.4.9_994 --------------------------
-
-General Notes:
-
- * A.k.a. PDL-2.4.10 release candidate 4
-
- * All focus now is on testing, documentation, web page
-   updates, and writing the PDL Book...
+ * Fix sf.net bug #3267408 "t/slice.t crashes in tests 68-70 for BSD"
  
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_994.tar.gz
-       cpan> make CHM/PDL-2.4.9_994.tar.gz
-       cpan> test CHM/PDL-2.4.9_994.tar.gz
-       cpan> look CHM/PDL-2.4.9_994.tar.gz
-
+ * Fix sf.net bug #3190227 "PDL build fails with parallel GNU make -j3 -j3"
 
-Highlights:
+ * Fixed various tempfile name generation problems by switching
+   to File::Temp instead of hand rolled solutions.  This is the
+   recommended approach going forward.
 
- * See above.
+ * Force Convert::UU usage for BSD to work around a t/dumper.t
+   failure on MirBSD.
 
 
 
-Release Notes for PDL 2.4.9_993 --------------------------
+Release Notes for PDL 2.4.8 --------------------------
 
 General Notes:
 
- * A.k.a. PDL-2.4.10 release candidate 3
-
- * All focus now is on testing, documentation, web page
-   updates, and writing the PDL Book...
+ * The deprecated Karma imaging library support code
+   has been removed from the PDL distribution.
  
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_993.tar.gz
-       cpan> make CHM/PDL-2.4.9_993.tar.gz
-       cpan> test CHM/PDL-2.4.9_993.tar.gz
-       cpan> look CHM/PDL-2.4.9_993.tar.gz
-
-
-Highlights:
-
- * See above.
-
-
-
-Release Notes for PDL 2.4.9_992 --------------------------
-
-General Notes:
-
- * A.k.a. PDL-2.4.10 release candidate 2
-
- * This release is to fix an issue with IO::Browser build
-   defaults that is causing a bunch of UNKNOWN reports
-   from CPAN Testers.
-
- * All focus now is on testing, documentation, web page
-   updates, and writing the PDL Book...
+ * Perl OpenGL (POGL) is now the only build option for
+   3-D graphics support in PDL.  The POGL build has
+   proven to be portable and reliable.  This prepares
+   TriD graphics development for the next stage of
+   re-factoring for support and new features.
  
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_992.tar.gz
-       cpan> make CHM/PDL-2.4.9_992.tar.gz
-       cpan> test CHM/PDL-2.4.9_992.tar.gz
-       cpan> look CHM/PDL-2.4.9_992.tar.gz
-
-
-Highlights:
-
- * Fix IO::Browser build default
-
- * Clean up of perldl.conf.
-
-
-
-Release Notes for PDL 2.4.9_991 --------------------------
-
-General Notes:
-
- * A.k.a. PDL-2.4.10 release candidate 1
-
- * All focus now is on testing, documentation, web page
-   updates, and writing the PDL Book...
+ * Many improvements to the PDL configuration, build
+   and test process make this the most robust PDL yet.
  
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_991.tar.gz
-       cpan> make CHM/PDL-2.4.9_991.tar.gz
-       cpan> test CHM/PDL-2.4.9_991.tar.gz
-       cpan> look CHM/PDL-2.4.9_991.tar.gz
-
-
-Highlights:
-
- * TBD
-
-
-
-Release Notes for PDL 2.4.9_016 --------------------------
-
-General Notes:
-
- * This is the final CPAN developers release for PDL
-   code changes.  The next release will be release
-   candidate 1 and all focus will be on documentation,
-   web page updates, and writing the PDL Book...
+ * PDL::IO::FlexRaw now supports automatic header file
+   creation when writeflex() is given a filename argument
+   for writing.  readflex/writeflex/mapflex now support
+   reading and writing piddles with bad values in them.
  
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
+ * New PDL::Constants module provides PI and E.
 
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
+ * PDL::Complex now supports in-place operations.
 
-       cpan> get  CHM/PDL-2.4.9_016.tar.gz
-       cpan> make CHM/PDL-2.4.9_016.tar.gz
-       cpan> test CHM/PDL-2.4.9_016.tar.gz
-       cpan> look CHM/PDL-2.4.9_016.tar.gz
+ * Added $PDL::toolongtoprint to set the maximum piddle
+   size allowed to print as a string.  This was added
+   to the default.perldlrc to make it easier to discover
+   by users.
 
+ * wmpeg() from PDL::IO::Pic uses the new ffmpeg back-end
+   and can create many additional file formats beyond MPEG
+   alone, including MP4 and animated GIF.  See the
+   documentation for details.
+ 
+ * Lots of improvements to the documentation, overall
+   usability and many bugs fixed!
 
 Highlights:
 
- * Updated win32/INSTALL instructions.
+ Build and Test Enhancements:
 
- * Added curses library detection for PDL::IO::Browser using
-   Devel::CheckLib.  This is untested and disabled by
-   default but if you set WITH_IO_BROWSER => 1 in the
-   perldl.conf, it should build if your platform supports
-   curses.
+ * Karma support code has been *removed* from the PDL
+   distribution The last stable PDL distribution with
+   Karma code was be PDL-2.4.7.
    
-   NOTE: PDL::IO:Browser is not available for win32 perls
-   since we still need to sort out an appropriate add-on
-   curses implementation and verify it works.
- 
- * Rework some tests to quiet warnings and to reduce
-   false fails (usually from floating point == tests).
-
- * Better corner-case handling when creating a pdl from a string.
-   For example, this doesn't make sense:
-     pdl q[1 +-2 3]
-   but it used to give a piddle with values [1, -2, 3], basically
-   ignoring the first plus sign. That now croaks.
+ * You must use the Perl OpenGL module to build the
+   PDL 3-D graphics module, PDL::Graphics::TriD.
+   OPENGL_LIBS, OPENGL_INC and OPENGL_DEFINE are no
+   longer used by perldl.conf for the configuration
+   process.
    
-   Additionally, this used to croak, but the error message was
-   useless:
-     pdl q[1 pie 3]
-   The new parsing will croak with a much more useful error:
-     found 'e' as part of a larger word in 1 pie 2
- 
- * Improved pthread detection for windows with Devel::CheckLib
-
-
-
-Release Notes for PDL 2.4.9_015 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_015.tar.gz
-       cpan> make CHM/PDL-2.4.9_015.tar.gz
-       cpan> test CHM/PDL-2.4.9_015.tar.gz
-       cpan> look CHM/PDL-2.4.9_015.tar.gz
-
-
-Highlights:
-
- * Cleaner error reporting from the pdl2 shell.  Stops
-   printing the callback trace once the PDL relevant
-   parts are done.
-
- * Candidate fix for sf.net bug #
-   3460886    t/flexraw_fortran.t test failures
- 
- * Added PDL_BUILD_VERSION to the perldl.conf keys.
-   This value is generated by the Makefile.PL config
-   process and provides a consistency check by ensuring
-   the Config.pm is from the correct version of PDL.
- 
- * Replace tempfile and tempdir based on hand-rolled
-   from TMPDIR in perldl.conf by calls to File::Temp
-   tempfile and/or tempdir.  Fixes to tests and trylink
-   command.
- 
- * Update minimum version of ExtUtils::MakeMaker to
-   6.31 which is the first version supporting the
-   INSTALL_BASE option for local module repo locations.
-   This is the same location as the Module::Build
-   --install-base option and is much easier to
-   understand where things go than the PREFIX + LIB.
-
-   NOTE: If you've been using PREFIX + LIB for your
-   standalone repository configuration, you'll need
-   to reinstall with the new option.  Mix and matching
-   the two is liable to cause problems.
-
-
-
-Release Notes for PDL 2.4.9_014 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_014.tar.gz
-       cpan> make CHM/PDL-2.4.9_014.tar.gz
-       cpan> test CHM/PDL-2.4.9_014.tar.gz
-       cpan> look CHM/PDL-2.4.9_014.tar.gz
-
-
-Highlights:
-
- * Add imaginary unit (either I and/or J) to PDL::Constants
-   and make all constants EXPORT_OK() rather than EXPORT().
-   Some documentation updates.
-
- * Minor cleanups to PDL::PP and related modules to get rid
-   of warnings under new Perls during testing.
- 
- * Added pp_line_numbers to PDL::PP to improve line number
-   reporting when the compiler runs into an error with
-   PDL::PP code.
- 
- * Add pnpoly implementation and fixes to PDL::Image2D
-
- * Candidate fix to PDL::Minuit Makefile.PL
-
-
-
-Release Notes for PDL 2.4.9_013 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
+ * Added a check for mis-installed PROJ4 libraries.  If
+   the library does not initialize (even if present) then
+   PDL will not build the PROJ4 modules.  This is sf.net
+   feature #3045456.
    
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_013.tar.gz
-       cpan> make CHM/PDL-2.4.9_013.tar.gz
-       cpan> test CHM/PDL-2.4.9_013.tar.gz
-       cpan> look CHM/PDL-2.4.9_013.tar.gz
-
-
-Highlights:
-
- * Add workaround for pthread detection on *BSD systems to
-   avoid CPAN Testers failures due to miss-detection and
-   auto-configuration.
-
- * Update t/proj_transform.t and t/proj_transform2.t test
-   data to be consistent with the new FITS coordinate
-   handling fix.
-
- * Add a new cc4compt routine in PDL::Image2D which provides
-   4-component labeling to go with the existing cc8compt which
-   provides 8-component labeling.
-
- * Added test time diagnostics to PDL::IO::Pic test that
-   print the converter hash values if any tests fail.
- 
- * Documentation additions.
-
-
-
-Release Notes for PDL 2.4.9_012 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
+ * GD, HDF, PROJ4, OpenGL, and GSL tests will not be run
+   unless the corresponding module was configured to be
+   built.  This addresses the possibly mysterious test
+   failures caused by previous PDL installations in the
+   perl path at build time.
    
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_012.tar.gz
-       cpan> make CHM/PDL-2.4.9_012.tar.gz
-       cpan> test CHM/PDL-2.4.9_012.tar.gz
-       cpan> look CHM/PDL-2.4.9_012.tar.gz
-
-
-Highlights:
-
- * Quick re-release to include Basic/Core/Makefile.PL fixes
-   from git
- 
- * Fixed new t/proj_transform2.t test failure that was a
-   side effect off the newly more correct FITS coordinate
-   handling.
-
-
-
-Release Notes for PDL 2.4.9_011 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
+ * Use of the Test::More TODO {} blocks allows tests for
+   known bugs to be added to the test suite without 
+   causing the suite to fail.  This replaces the previous
+   SKIP_KNOWN_PROBLEMS option and should better enable
+   test first development and debugging.
    
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_011.tar.gz
-       cpan> make CHM/PDL-2.4.9_011.tar.gz
-       cpan> test CHM/PDL-2.4.9_011.tar.gz
-       cpan> look CHM/PDL-2.4.9_011.tar.gz
-
-
-Highlights:
-
- * SF.net bugs fixed:
-
-   - 3410905  t/pgplot.t hangs test harness for PDL
-              Now use the PGPLOT /NULL device if running
-              under Test::Harness.
-
-   - 3428356  PDL::Transform::map output FITS header is slightly wrong 	
-
-   - 3080505  PLplot segfaults on plshades call on OS X
-
-   - 3059083  Problems with FITS header handling
-
- * The perl crash in t/pthreadBarf.t for win32 has been fixed.
-   The problem was that Perl's realloc was being used instead
-   of the system malloc/realloc.
-
- * Fix build for PROJ4 submodules so that setting WITH_PROJ to
-   1 with force a build whether or not the configure type checks
-   can verify the build options.  This allows the end user to
-   work around auto-detection issues when needed.
+ * utils/perldlpp.pl is a new script for off-line source
+   filtering to pre-filter PDL source files with NiceSlice
+   constructs.  This allows PDL to use NiceSlice constructs
+   in the core functionality while still allowing PDL to
+   work in environments where source filters are not supported.
    
-   NOTE: Even with the override, the check are still done---just
-   ignored in the decision process.
-
- * Various documentation and updates.
-
-
-
-Release Notes for PDL 2.4.9_010 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
+ * The 'perl Makefile.PL' response to detecting another PDL
+   in the build path has changed.  If such a pre-existing PDL
+   installation is detected, the user is warned *but*
+   configuration and build will proceed nonetheless.
    
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_010.tar.gz
-       cpan> make CHM/PDL-2.4.9_010.tar.gz
-       cpan> test CHM/PDL-2.4.9_010.tar.gz
-       cpan> look CHM/PDL-2.4.9_010.tar.gz
-
-
-Highlights:
-
- * Experimental PDL::NiceSlice support for perl debugger.
-   Just put the PDLdb.pl file in your perl @INC path and
-   do an
-
-     export PERL5DB='BEGIN { require "PDLdb.pl" }'
-     setenv PERL5DB 'BEGIN { require "PDLdb.pl" }'
-
-   You should be able to use niceslice syntax to view
-   or modify pdl values.  Feedback welcome!
-
- * New pdl from string functionality in pdl constructors
-   new and pdl now supports BAD, NAN, and INF values as
-   entries in the piddle being constructed.  E.g., this
-   now works:
+ * Clean-up and fixes to demos and tests for reliability and
+   portability.
 
-     pdl> p $a = pdl q[ inf bad 0 0 ];
-     [inf BAD 0 0]
+ Documentation:
 
- * Fixed security vulnerability in and added functionality
-   to PDL::Core::new_pdl_from_string.
+ * Added INTERNATIONALIZATION file with i18n notes.  PDL
+   does yet not have internationalization support beyond
+   that provided  by perl itself.
    
-   - replaced an eval with a Perl-level parse of the string
-
-   - added support for the strings 'inf', 'nan', and 'bad',
-     as well as the Windows printouts of those values
+ * Cleared up the documentation on when to use lu_decomp
+   and versus lu_decomp2.  Now that lu_decomp is threaded,
+   it is the preferred implementation.
    
-   In the past, using new_pdl_from_string with a stringified
-   piddle worked as long as the piddle didn't have infinity,
-   not-a-number, or BAD values. Now, that works. This is also
-   useful for generating data to test edge cases.
-
-
- * Fixed sf.net bugs:
-
-   - 3434842  Error in definition of gsl_sf_laguerre_n function
-   - 3391507  pdl2 docs not found by pdldoc
-   - 3391645  bad printf formats in pdlapi.c and others
-
- * Resolved sf.net feature requests with clarified documentation
-   and more diagnostic error messages:
-
-   - 3396738  PDL::Core::convert default return type
-   - 3396761  fix rvals arithmetic wrap-around for byte types
-
-
-
-Release Notes for PDL 2.4.9_009 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
+ * wmpeg() with the ffmpeg converter supports generation of
+   many different output video file formats including MPEG,
+   MP4, and animated GIF.  Documentation on these uses were
+   added.
 
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
+ * New example code refresh.pdl in Example/PLplot to
+   provide for PLplot, some of the same functionality
+   as in PDL::Graphics::PGPLOT.
    
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_009.tar.gz
-       cpan> make CHM/PDL-2.4.9_009.tar.gz
-       cpan> test CHM/PDL-2.4.9_009.tar.gz
-       cpan> look CHM/PDL-2.4.9_009.tar.gz
-
-
-Highlights:
-
- * Work underway to enable POSIX theads support for
-   win32 systems (native windows perls and cygwin).
-   Manual build is possible for cygwin and MSWin32.
-
- * PDL segfault on Empty pdl bugs fixed:
-
-   - 3307613   indexND of Empty pdls can segfault
-   - 3294808   sever on Empty piddle causes segfault
-
- * Other bugs fixed:
-
-   - 3415115   whereND fails to handle all zero mask case
-   - .......   rcols dies when you reading past the EOF
-   - .......   fixed readflex edge case with badvalues
-
- * wcols can now write 2D pdls directly with the
-   column data going to dim0 and dim1 corresponding
-   to the number of colums written to the file for
-   that pdl.  rcols now uses the same convention for
-   2D pdls which makes dim0 the data dimension for
-   both 1D and 2D pdls *and* make rcols and wcols
-   the reverse operations from each other.
-
- * Documentation and diagnostic improvements for PDL::PP
-   from investigation and study by David Mertens.
+ * Other documentation updates for clarity and correctness.
 
- * Various clean-up and tidying of PDL as a release.
+ New Features or Functionality:
 
- * New engine for PDL::NiceSlice offers improved
-   selectivity as a source filter regarding sf.net
-   bug #3018731 'NiceSlice affects code where it should not'.
-   The main improvement from the new code is it should
-   not filter in perl comments or quotelike constructs.
+ * New PDL::Constants module providing PI and E (so far)
    
-   To try the new sourcefilter "engine", set the environment
-   variable PDL_NICESLICE_ENGINE to either of:
-
-    Filter::Util::Call (for the original filter version)
-    Filter::Simple     (for the new and improved engine)
+ * Inplace support added for PDL::Complex operations
    
-   NOTE: the current default is Filter::Util::Call although
-   that may change for some CPAN developers release testing.
-   Also, if you enter an invalid option, PDL::NiceSlice will
-   die.
-
-   NOTE: Work is underway to finish the implementation
-   for the interactive PDL shells: perldl and pdl2.  You
-   get the Filter::Util::Call behavior for the shells
-   regardless of the choice of filter engine at this time.
-  
-
-
-Release Notes for PDL 2.4.9_008 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
+ * pdldoc and the pdl2/perldl help commands now print all
+   matches by default when multiple matches are found.
 
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
+ * A do_print command was added to the pdl2 shell which
+   toggles the input mode between printing and not
+   printing the return value of each command.
    
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_008.tar.gz
-       cpan> make CHM/PDL-2.4.9_008.tar.gz
-       cpan> test CHM/PDL-2.4.9_008.tar.gz
-       cpan> look CHM/PDL-2.4.9_008.tar.gz
-
-
-Highlights:
-
- * Enabled more pnmtoxxx converters for t/pnm.t and t/picrgb.t.
-   The idea is to revisit any issues with the NetPBM installs
-   as the previous problems might be better handled by better
-   configuration and tests.
-
- * Multiple sf.net bugs fixed:
-
-   - 3394327    PDL::IO::FITS::wfits corrupting FITS image
-   - 3392972    t/pthreadBarf.t test fails
-   - 3377113    failure to find PDL typemap
-   - 3303673    PLplot trouble with new PThreads
-
-
-
-Release Notes for PDL 2.4.9_007 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
+ * readflex/writeflex/mapflex now support reading and writing  
+   piddles with bad values in them. This was sf.net feature
+   request #3028127, "add badvalue support to FlexRaw".
    
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_007.tar.gz
-       cpan> make CHM/PDL-2.4.9_007.tar.gz
-       cpan> test CHM/PDL-2.4.9_007.tar.gz
-       cpan> look CHM/PDL-2.4.9_007.tar.gz
-
-
-Highlights:
-
- * Candidate fix for sf.net bug # 3394327  (thanks to
-   kxtor).  It would be great if we had a small test
-   to add to t/fits.t showing the problem with the
-   original code.
-
- * Candidate fix for sf.net bug # 3392972 (thanks to
-   John Cerney).  It appears that some of the cleanup
-   from the PDL_Long typemap problem had a side-effect
-   with the previous barf code.
-
- * Candidate fix for sf.net bug # 3377113 (thanks to
-   Rob/sisyphus for following up with this).  The latest
-   spin seems to fix the problem.
- 
- * Ported t/pthreadBarf.t to use Test::More.
-
-
-
-Release Notes for PDL 2.4.9_006 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
-
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_006.tar.gz
-       cpan> make CHM/PDL-2.4.9_006.tar.gz
-       cpan> test CHM/PDL-2.4.9_006.tar.gz
-       cpan> look CHM/PDL-2.4.9_006.tar.gz
-
-Highlights:
-
- * Outstanding segfault for t/pthreadBarf.t test.
- 
- * Fix for sf.net bug #3377113 "failure to find PDL typemap"
- 
- * Fix C declaration issue for MSVC 6.0 builds
- 
- * New addition to 'demo 3dgal' by Mark Baker
- 
- * pdldoc now checks $PDLLIB autoloader path for docs
- 
- * Documentation fixes...
-
-
-Release Notes for PDL 2.4.9_005 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
+ * writeflex now supports automatically calling the
+   writeflexhdr() routine if you have set the variable
+   $PDL::FlexRaw::writeflexhdr to a true value and are
+   writing to a file given by filename as argument.
    
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_005.tar.gz
-       cpan> make CHM/PDL-2.4.9_005.tar.gz
-       cpan> test CHM/PDL-2.4.9_005.tar.gz
-       cpan> look CHM/PDL-2.4.9_005.tar.gz
-
-
-Highlights:
-
- * Fix for missing PDL_Long * typemap in Core.xs bug
-
-
-
-Release Notes for PDL 2.4.9_004 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_004.tar.gz
-       cpan> make CHM/PDL-2.4.9_004.tar.gz
-       cpan> test CHM/PDL-2.4.9_004.tar.gz
-       cpan> look CHM/PDL-2.4.9_004.tar.gz
-
-
-Highlights:
-
- * Add 'use PDL::Constants' to default.perldl in preparation
-   for eventual inclusion for 'use PDL'.  The PDL::Constants
-   module only defines PI and E at the moment.  I would like
-   to see a few more standard ones added such as I or J for
-   the imaginary unit value.
-
- * Set $PDL::IO::FlexRaw::writeflexhdr=1 in PDL shell.  This
-   enables writeflex() to call writeflexhdr() automatically
-   when a filename is given as the output destination.  This
-   matches the behavior of writefraw() but is different than
-   the previous behavior so only enable the new default in
-   the interactive shells (for now).
-
-
- * Preliminary support for pdls larger than 2GiB (but still
-   with less than 2**31 *elements*) is in the PDL core.
-   It is believed that this modification should be
-   transparent.  Please test.
-
- * New whereND() routine added to PDL::Primitive.  Like
-   where but it properly threads the mask over higher
-   data dimensions.  This was sf.net feature #3390043.
- 
- * pdldoc now searches for *.pdl files in your @PDLLIB
-   path for docs on PDL::AutoLoader routines.  To disable
-   the new behavior, just set the new perldl.conf option
-   PDLDOC_IGNORE_AUTOLOADER to true.  This was sf.net
-   feature #3390042.
-
- * Documentation fixes
-
- * SF.net bugs fixed:
-   - 3388862  tiny bug in PDL-2.4.3. May apply to 2.4.9
-   - 3375837  _read_flexhdr state machine fails
-   - 3368883  t/opengl.t fails if display type not available
-
-
-Release Notes for PDL 2.4.9_003 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_003.tar.gz
-       cpan> make CHM/PDL-2.4.9_003.tar.gz
-       cpan> test CHM/PDL-2.4.9_003.tar.gz
-       cpan> look CHM/PDL-2.4.9_003.tar.gz
-
-
-Highlights:
-
- * PDL now requires Text::Balanced version 1.89 or higher.
-
-   NOTE: All perls with versions 5.8.0+ have at least this
-   version of Text::Balanced in the Core module set.
-
- * Fix wmpeg crash when ffmpeg generates an error with a
-   $SIG{PIPE}, sf.net #3307121.  Added $SIG{PIPE} fixes
-   for other PDL modules using pipes.
- 
- * PDL::NiceSlice being refactored to use Filter::Simple.
- 
- * pctover, oddpctover, pct, and oddpct now support badvalues
-   per sf.net feature request #3328001.
-
- * Fixed t/opengl.t problem to enable support for TriD to
-   work with POGL compiled under cygwin for the w32api
-   OpenGL graphics.
-
- * Improved diagnostic output on failure ("better barf").
-
-
-
-Release Notes for PDL 2.4.9_002 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_002.tar.gz
-       cpan> make CHM/PDL-2.4.9_002.tar.gz
-       cpan> test CHM/PDL-2.4.9_002.tar.gz
-       cpan> look CHM/PDL-2.4.9_002.tar.gz
-
-
-Highlights:
-
- * New multi-processor support for PDL computations using
-   pthreads.  This can improve performance up to 2X-4X for
-   some problems.  See pdldoc ParallelCPU for information.
-
- * Fix PDL::NiceSlice bugs sf.net #3295544 and #3300467
-
- * Fix wcols() regression where file handle arguments
-   were not being handled correctly.
- 
- * Various documentation and distributions fixes.
-
-
-
-Release Notes for PDL 2.4.9_001 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.9_001.tar.gz
-       cpan> make CHM/PDL-2.4.9_001.tar.gz
-       cpan> test CHM/PDL-2.4.9_001.tar.gz
-       cpan> look CHM/PDL-2.4.9_001.tar.gz
-
-
-Highlights:
-
- * Add support to PDL::IO::Misc for handles that are not files.
-
- * Update PDL::PP docs and other doc fixes.
-
- * Improved detection logic for a number of external
-   dependencies
- 
- * Fix double-bscale bug for rice-compressed images
-
- * Adapt t/bad.t to use File::Temp::tempfile() instead
-   of a hand-rolled version.  Eventually we would like
-   to standardize on File::Temp for our temp file work.
-
-
-
-Release Notes for PDL 2.4.9 --------------------------
-
-General Notes:
-
- * Fixes a couple of surprise bugs that were discovered
-   immediately with the PDL-2.4.8 release.
-
- * See Also: the Release Notes for PDL-2.4.8 below
-
-
-Highlights:
-
- * Fix sf.net bug #3267408 "t/slice.t crashes in tests 68-70 for BSD"
- 
- * Fix sf.net bug #3190227 "PDL build fails with parallel GNU make -j3 -j3"
-
- * Fixed various tempfile name generation problems by switching
-   to File::Temp instead of hand rolled solutions.  This is the
-   recommended approach going forward.
-
- * Force Convert::UU usage for BSD to work around a t/dumper.t
-   failure on MirBSD.
-
-
-
-Release Notes for PDL 2.4.8_004 --------------------------
-
-General Notes:
-
- * A.k.a. PDL-2.4.9 pre-release 2.
-
-
-Highlights:
-
- * See the PDL-2.4.9 release notes above.
-
-
-
-Release Notes for PDL 2.4.8_003 --------------------------
-
-General Notes:
-
- * A.k.a. PDL-2.4.9 pre-release 1.
-
-
-Highlights:
-
- * See the PDL-2.4.9 release notes above.
-
-
-
-Release Notes for PDL 2.4.8_002 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.8_002.tar.gz
-       cpan> make CHM/PDL-2.4.8_002.tar.gz
-       cpan> test CHM/PDL-2.4.8_002.tar.gz
-       cpan> look CHM/PDL-2.4.8_002.tar.gz
-
-
-Highlights:
-
- * Fix temporary file generation problems with IO/Dumper.pm,
-   t/iotypes.t, and add temp file cleanup code to Makefile.PL
- 
- * Add additional dependencies in the Makefile generation
-   for Basic/Core/Makefile.PL to address the parallel make
-   failures.
-
-
-
-Release Notes for PDL 2.4.8_001 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.8_001.tar.gz
-       cpan> make CHM/PDL-2.4.8_001.tar.gz
-       cpan> test CHM/PDL-2.4.8_001.tar.gz
-       cpan> look CHM/PDL-2.4.8_001.tar.gz
-
-
-Highlights:
-
- * Fixed sf.net bug #3267408 "t/slice.t crashes in tests 68-70 for BSD"
-
-
-
-Release Notes for PDL 2.4.8 --------------------------
-
-General Notes:
-
- * The deprecated Karma imaging library support code
-   has been removed from the PDL distribution.
- 
- * Perl OpenGL (POGL) is now the only build option for
-   3-D graphics support in PDL.  The POGL build has
-   proven to be portable and reliable.  This prepares
-   TriD graphics development for the next stage of
-   re-factoring for support and new features.
- 
- * Many improvements to the PDL configuration, build
-   and test process make this the most robust PDL yet.
- 
- * PDL::IO::FlexRaw now supports automatic header file
-   creation when writeflex() is given a filename argument
-   for writing.  readflex/writeflex/mapflex now support
-   reading and writing piddles with bad values in them.
- 
- * New PDL::Constants module provides PI and E.
-
- * PDL::Complex now supports in-place operations.
-
- * Added $PDL::toolongtoprint to set the maximum piddle
-   size allowed to print as a string.  This was added
-   to the default.perldlrc to make it easier to discover
-   by users.
-
- * wmpeg() from PDL::IO::Pic uses the new ffmpeg back-end
-   and can create many additional file formats beyond MPEG
-   alone, including MP4 and animated GIF.  See the
-   documentation for details.
- 
- * Lots of improvements to the documentation, overall
-   usability and many bugs fixed!
-
-Highlights:
-
- Build and Test Enhancements:
-
- * Karma support code has been *removed* from the PDL
-   distribution The last stable PDL distribution with
-   Karma code was be PDL-2.4.7.
-   
- * You must use the Perl OpenGL module to build the
-   PDL 3-D graphics module, PDL::Graphics::TriD.
-   OPENGL_LIBS, OPENGL_INC and OPENGL_DEFINE are no
-   longer used by perldl.conf for the configuration
-   process.
-   
- * Added a check for mis-installed PROJ4 libraries.  If
-   the library does not initialize (even if present) then
-   PDL will not build the PROJ4 modules.  This is sf.net
-   feature #3045456.
-   
- * GD, HDF, PROJ4, OpenGL, and GSL tests will not be run
-   unless the corresponding module was configured to be
-   built.  This addresses the possibly mysterious test
-   failures caused by previous PDL installations in the
-   perl path at build time.
-   
- * Use of the Test::More TODO {} blocks allows tests for
-   known bugs to be added to the test suite without 
-   causing the suite to fail.  This replaces the previous
-   SKIP_KNOWN_PROBLEMS option and should better enable
-   test first development and debugging.
-   
- * utils/perldlpp.pl is a new script for off-line source
-   filtering to pre-filter PDL source files with NiceSlice
-   constructs.  This allows PDL to use NiceSlice constructs
-   in the core functionality while still allowing PDL to
-   work in environments where source filters are not supported.
-   
- * The 'perl Makefile.PL' response to detecting another PDL
-   in the build path has changed.  If such a pre-existing PDL
-   installation is detected, the user is warned *but*
-   configuration and build will proceed nonetheless.
-   
- * Clean-up and fixes to demos and tests for reliability and
-   portability.
-
- Documentation:
-
- * Added INTERNATIONALIZATION file with i18n notes.  PDL
-   does yet not have internationalization support beyond
-   that provided  by perl itself.
-   
- * Cleared up the documentation on when to use lu_decomp
-   and versus lu_decomp2.  Now that lu_decomp is threaded,
-   it is the preferred implementation.
-   
- * wmpeg() with the ffmpeg converter supports generation of
-   many different output video file formats including MPEG,
-   MP4, and animated GIF.  Documentation on these uses were
-   added.
-
- * New example code refresh.pdl in Example/PLplot to
-   provide for PLplot, some of the same functionality
-   as in PDL::Graphics::PGPLOT.
-   
- * Other documentation updates for clarity and correctness.
-
- New Features or Functionality:
-
- * New PDL::Constants module providing PI and E (so far)
-   
- * Inplace support added for PDL::Complex operations
-   
- * pdldoc and the pdl2/perldl help commands now print all
-   matches by default when multiple matches are found.
-
- * A do_print command was added to the pdl2 shell which
-   toggles the input mode between printing and not
-   printing the return value of each command.
-   
- * readflex/writeflex/mapflex now support reading and writing  
-   piddles with bad values in them. This was sf.net feature
-   request #3028127, "add badvalue support to FlexRaw".
-   
- * writeflex now supports automatically calling the
-   writeflexhdr() routine if you have set the variable
-   $PDL::FlexRaw::writeflexhdr to a true value and are
-   writing to a file given by filename as argument.
-   
- * Updated the error handling for GSL::INTERP to match other
-   GSL module usages.
-   
- * Applied sf.net patch #3209075 IO::HDF square sds
-   
- * New binary blob support in PDL::IO::GD::OO
-
- Bugs Fixed:
-
- * Applied Christian Soeller's patch for FFTW on 64-bit
-   systems.  This resolves bug #3203480 "t/fftw.t fails
-   on 64-bit systems".
-   
- * Fixed sf.net bug #3172882 re broken threading in inv().
-   inv() and lu_backsub() now handle threading.  Updated
-   documentation for lu_decomp, lu_deomp2, and lu_backsub.
-   
- * Fixed sf.net bug #3171702 "missing podselect command
-   breaks PDL build"
-   
- * Fixed sf.net bug #3185864 (bad adev in statsover)
-   
- * Fixed sf.net bug #3139697: fixed imag2d() to work better
-   with Mac OS X GLUT and not just FreeGLUT.
-   
- * Fixed uniqind bug #3076570
-   
- * Fixed SF bug #3057542: wmpeg doesn't error on missing
-   ffmpeg program.  Now wmpeg returns 1 on success and
-   undef on error.  If ffmpeg is not in PATH, it just fails
-   immediately....
-   
- * Fixed SF bug #3056142: pdl2 fallback to perldl broken
-   on win32
-   
- * Fixed SF bug #3042201: t/dumper.t fails mysteriously
-   
- * Fixed SF bug #3031068: PDL::IO::FlexRaw mapflex memory
-   mapping fails
-   
- * Fixed SF bug #3011879, "pdl() constructor crashes perl for
-   mixed ref/piddle args" and #3080505, and #3139088.  This
-   fix also includes a larger and more complete set of tests.
-   
- * Fixed segfault in plplot.t with a work-around.
-   
- * Fixed bug in readenvi.pdl header list value processing
-   and added support for embedded file headers.
-   
- * Fixed bug in FlexRaw.pm support for headers with Type
-   passed  as string.
-   
- * Fixed imag2d() in PDL::Graphics2D.  It no longer calls
-   exit on ESC if run within the pdl2/perldl shell.  Also
-   did some clean up of key controls and module mechanics.
-   
- * Fixed upstream bug in Devel::REPL for MultiLine
-   continuation.  Now incomplete q[] and qq[] constructs
-   continue reading until properly closed.  See the
-   Known_problems file for details.
-
-
-    
-Release Notes for PDL 2.4.7_991 --------------------------
-
-General Notes:
-
- * A.k.a. PDL-2.4.8pre1 release
-
-Highlights:
-
- * See PDL-2.4.8 release notes above.
-
-
-    
-Release Notes for PDL 2.4.7_015 --------------------------
-
-General Notes:
-
- * Another quick CPAN developers release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_015.tar.gz
-       cpan> make CHM/PDL-2.4.7_015.tar.gz
-       cpan> test CHM/PDL-2.4.7_015.tar.gz
-       cpan> look CHM/PDL-2.4.7_015.tar.gz
-
-
-Highlights:
-
- * Fix another problem with the Lib/GIS/Proj and Lib/Transform/Proj4
-   Makefile.PL files.
-
-
-    
-Release Notes for PDL 2.4.7_014 --------------------------
-
-General Notes:
-
- * Last developers release before the PDL-2.4.8 pre-release
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_014.tar.gz
-       cpan> make CHM/PDL-2.4.7_014.tar.gz
-       cpan> test CHM/PDL-2.4.7_014.tar.gz
-       cpan> look CHM/PDL-2.4.7_014.tar.gz
-
-
-Highlights:
-
- * Added feature to check for a mis-installed PROJ4
-   library.  If such is detected, PDL will not build
-   the PROJ4 modules.  This sf.net feature #3045456.
-
- * Applied sf.net patch #3209075 IO::HDF square sds
- 
- * Applied Christian Soeller's patch for FFTW on 64-bit
-   systems.  This resolves bug #3203480 "t/fftw.t fails
-   on 64-bit systems".
- 
- * Various clean up to tests and build process.
-
-
-    
-Release Notes for PDL 2.4.7_013 --------------------------
-
-General Notes:
-
- * Last developers release before the 2.4.8 pre-release
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_013.tar.gz
-       cpan> make CHM/PDL-2.4.7_013.tar.gz
-       cpan> test CHM/PDL-2.4.7_013.tar.gz
-       cpan> look CHM/PDL-2.4.7_013.tar.gz
-
-
-Highlights:
-
- * readflex/writeflex/mapflex now support reading and writing
-   piddles with bad value support enabled.  This was sf.net
-   feature request #3028127, "add badvalue support to FlexRaw".
-   
-   On writeflex, a piddle with badflag==1 will have a keyword
-   badvalue added to the header file and an additional value
-   if badvalue is != orig_badvalue for that type.
-   
-   On readflex, a piddle with the badvalue header will
-   automatically have its badflag set and its badvalue as well
-   if it is not the default.
-
- * New PDL::Constants module providing PI and E
-
- * New refresh.pdl in Example/PLplot.  This provides
-   some of the same functionality as in the PDL
-   PGPLOT graphics.
-
- * Inplace support added for PDL::Complex operations
-
- * OPENGL_LIBS, OPENGL_INC and OPENGL_DEFINE
-   no longer used in perldl.conf as the Perl
-   OpenGL binding is now required for TriD graphics.
- 
- * Additional code clean up now that PDL::Karma
-   graphics are no longer provided.
- 
- * Various bug and documentation fixes.
-
-
-    
-Release Notes for PDL 2.4.7_012 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_012.tar.gz
-       cpan> make CHM/PDL-2.4.7_012.tar.gz
-       cpan> test CHM/PDL-2.4.7_012.tar.gz
-       cpan> look CHM/PDL-2.4.7_012.tar.gz
-
-
-Highlights:
-
- * Fixed pdl constructor bugs
-
-   - Include a larger and more-complete set of tests.
-
-   - Fixes SF.net bugs: #3011879, #3080505, and #3139088.
-
-   - Please test and verify.
-
- * Legacy (deprecated) X11+PP build of TriD OpenGL bindings
-   has been removed
-
-     You must use the new Perl OpenGL based build which has
-     proven to be more portable and reliable.  This prepares
-     TriD graphics development for the next stage of refactoring
-     for support and functionality.
-
- * More tests have been updated to not run unless the feature
-   they test was actually built.  This addresses the possible
-   mysterious test failures caused by previous PDL installs
-   in the perl path at build time.
-
-   - t/opengl.t will not run if TriD graphics have not been built
-
-   - t/gsl*.t tests will not run if WITH_GSL => 0
-
- * Remove Karma support code from PDL distribution
-    
-     The last stable CPAN distribution with Karma code
-     in it (though deprecated) will be PDL-2.4.7.
-
- * Added INTERNATIONALIZATION file with i18n notes
-
-     PDL does not have internationalization support beyond
-     that provided by perl itself.  In fact, some of the
-     code may be specific to English and ASCII for file names
-     and strings.  This file is a place holder and reminder
-     to address these issues.
-
- * Some documentation and FAQ updates.
-
-
-    
-Release Notes for PDL 2.4.7_011 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These release notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_011.tar.gz
-       cpan> make CHM/PDL-2.4.7_011.tar.gz
-       cpan> test CHM/PDL-2.4.7_011.tar.gz
-       cpan> look CHM/PDL-2.4.7_011.tar.gz
-
-
-Highlights:
-
- * Fixes to GD, HDF, and PROJ4 tests to not run if they
-   weren't built.
- 
- * New binary blob support in PDL::IO::GD::OO
-
- * Changed from interactive prompt when duplicate PDL is
-   found at PDL config time.  Now we just warn.
- 
- * Fixed sf.net bug #3185864 (bad adev in statsover)
-
- * Minor pod cleanup for lu_xxx routines in PDL::MatrixOps
-
- * Spot fixes to usual README, docs,..
-
-
-
-    
-Release notes for PDL 2.4.7_010 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These Release Notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_010.tar.gz
-       cpan> make CHM/PDL-2.4.7_010.tar.gz
-       cpan> test CHM/PDL-2.4.7_010.tar.gz
-       cpan> look CHM/PDL-2.4.7_010.tar.gz
-
-
-Highlights:
-
- * Test release to verify the fix for sf.net bug #3171702
-   "missing podselect command breaks PDL build"
-
-
-    
-Release notes for PDL 2.4.7_009 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These Release Notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_009.tar.gz
-       cpan> make CHM/PDL-2.4.7_009.tar.gz
-       cpan> test CHM/PDL-2.4.7_009.tar.gz
-       cpan> look CHM/PDL-2.4.7_009.tar.gz
-
-
-Highlights:
-
- * Update Known_problems, Perldl2/TODO, Release_Notes
-    
- * Fixed upstream bug in Devel::REPL for MultiLine continuation
-   so now incomplete q[] and qq[] constructs continue reading
-   until properly closed.  This was a problem for pdl2 and its
-   multiline support.
-
- *  Fix sf.net bug #3172882 re broken threading in inv
-    - inv() and lu_backsub() now handle threading
-    - documentation updates for lu_decomp, lu_deomp2, lu_backsub
-
- * Fix imag2d not to exit on ESC in pdl2/perldl
-   Clean up PAUSE/STEP key controls for imag2d()
-   Add imag2d_update to EXPORT_OK and fix bug
-    
-     There are preliminary key bindings for the default
-     imag2d() windows to support SPACE to toggle pause,
-     [ . or > ] to step/move forward, and [ , or < ] to
-     move backward through frame data.
-
- * clean up tests for PLplot functions
-   - common code in tests for PLplot functions has been abstracted
-   - plsfont & plgfont interfaces are now conditional on their existence
-   - OPTIONS! file is now Perl code.
-   - all conditional code API code is now based on
-      presence of a feature rather than version
-
- * readenvi doc/code cleanup, ignore case in hdr keys
-    
- * wmpeg() with the ffmpeg converter supports generation
-   of many different output video file formats including
-   MPEG, MP4, and animated GIF.  Documentation on these
-   uses were added.
-
-
-
-Release notes for PDL 2.4.7_008 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These Release Notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_008.tar.gz
-       cpan> make CHM/PDL-2.4.7_008.tar.gz
-       cpan> test CHM/PDL-2.4.7_008.tar.gz
-       cpan> look CHM/PDL-2.4.7_008.tar.gz
-
-
-Highlights:
-
- * Merged PDL version of Graphics/PLplot with the stand-alone
-   package from CPAN, version 0.53.
-
- * Fixed segfault in plplot.t by avoiding the problem:  pdl($pdl->sclr).
-   Calls to pdl() with arguments that are themselves PDLs still fails.
-
- * Fixed sf.net bug #3139697: The imag2d() routine was using
-   FreeGLUT-specific macros: GLUT_ACTION_ON_WINDOW_CLOSE and
-   GLUT_ACTION_CONTINUE_EXECUTION which was a problem on OS X
-   GLUT which does not support them.  Added check for FreeGLUT
-   to conditionalize their use.
- 
- * Update PDL::IO::FlexRaw POD for writeflex
-
- * Add open MODE support to writeflex "filename"
-     
-     writeflex is documented to take as argument either a "filename"
-     or a FILEHANDLE however if passed something like ">filename" as
-     the file argument, it would quietly (and unexpectedly) open the
-     file ">$name" which would then be ">>filename" and the data would
-     be appended to the file rather than overwriting it.
-
-     This modifies the "filename" option to be used explicitly if
-     passed a perl open type MODE+filename expression which might
-     avoid someone's utter confusion in the future...
-
-
-
-Release notes for PDL 2.4.7_007 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These Release Notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_007.tar.gz
-       cpan> make CHM/PDL-2.4.7_007.tar.gz
-       cpan> test CHM/PDL-2.4.7_007.tar.gz
-       cpan> look CHM/PDL-2.4.7_007.tar.gz
-
-
-Highlights:
-
- * Added do_print command to pdl2 shell which toggles the
-   input mode between printing and not printing the value
-   of each command.
-
- * Cleaned up documentation on when to use lu_decomp and
-   lu_decomp2.  Now that lu_decomp is threaded, it is the
-   preferred implementation.
- 
- * pdldoc and the pdl2/perldl help commands now print
-   all matches by default when multiple matches are
-   found.  It is easier to use the pager than to re-enter
-   the help command with a [$n] on it.
- 
- * Fixed SF bug #3056142: pdl2 fallback to perldl broken on win32
-
- * Fixed documentation for the PDL::hist routine where
-   use of the unix man convention of []'s around optional
-   arguements was confusing in PDL since [] are valid
-   perl delimiters/constructs.
- 
- * writeflex now supports automatically calling the
-   writeflexhdr routine if you have set the variable
-   $PDL::FlexRaw::writeflexhdr to a true value.
- 
- * Use standard abbreviations for piddle info output
-   for sizes (KB and MB rather than Kb and Mb).
-
-
-
-Release notes for PDL 2.4.7_006 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These Release Notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_006.tar.gz
-       cpan> make CHM/PDL-2.4.7_006.tar.gz
-       cpan> test CHM/PDL-2.4.7_006.tar.gz
-       cpan> look CHM/PDL-2.4.7_006.tar.gz
-
-
-Highlights:
-
- * Fixed SF bug #3031068: PDL::IO::FlexRaw mapflex memory mapping fails
-
- * Fixed SF bug #3042201: t/dumper.t fails mysteriously
-
- * Added detection and skips for bad PROJ4 installs to t/proj_transform.t
-   and t/proj_transform2.t
-
- * Added new global setting to control maximum PDL print size,
-   $PDL::longbigtoprint, and added POD to Core.pm.PL covering
-   these important PDL package variables.
-
- * Fixed SF bug #3057542: wmpeg doesn't error on missing ffmpeg.
-   Now wmpeg returns 1 on success and undef on error.  If ffmpeg
-   is not in PATH, just fail immediately....
- 
-
-
-
-Release notes for PDL 2.4.7_005 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These Release Notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_005.tar.gz
-       cpan> make CHM/PDL-2.4.7_005.tar.gz
-       cpan> test CHM/PDL-2.4.7_005.tar.gz
-       cpan> look CHM/PDL-2.4.7_005.tar.gz
-
-
-Highlights:
-
- * Testing possible fixes to sf.net #3031068 and #3042201
- 
-
-
-
-Release notes for PDL 2.4.7_004 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These Release Notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_004.tar.gz
-       cpan> make CHM/PDL-2.4.7_004.tar.gz
-       cpan> test CHM/PDL-2.4.7_004.tar.gz
-       cpan> look CHM/PDL-2.4.7_004.tar.gz
-
-
-
-Highlights:
-
- * Modify the XS_PDL_address routine in Core.xs to convert
-   the pdl pointer to an IV rather than an int.  Adjusted
-   PDL::address in Core.pm to format the resulting value
-   correctly.
-
- * Fix missing stdlib.h include for Lib/Image2D/resample.h
-
- * Fix bug in readenvi header list value processing and
-   add support for non-zero imbedded file header size.
- 
- * Refactored t/complex.t to use Test::More
-
- * Fix bug in FlexRaw.pm support for headers with
-   Type passed as string.  There was a case where
-   'double' was being pased to the PDL::howbig which
-   generated an error on some platforms.  It is not
-   clear why this did not fail on all platforms.
- 
-
-
-
-Release notes for PDL 2.4.7_003 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These Release Notes may not be fully complete.  Please
-     see Changes (from the git log) for full details.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_003.tar.gz
-       cpan> make CHM/PDL-2.4.7_003.tar.gz
-       cpan> test CHM/PDL-2.4.7_003.tar.gz
-       cpan> look CHM/PDL-2.4.7_003.tar.gz
-
-
-
-Highlights:
-
- * Sf.net bug #3011879, pdl() constructor crashes perl
-   for mixed ref/piddle args has been fixed and is
-   available for general use and testing this release.
-
- * utils/perldlpp.pl is a new PDL utility for off-line
-   source filtering to pre-filter perl source files for
-   NiceSlice constructs.  This allows the functionality
-   to be used in environments not supporting direct
-   use of source filters.
- 
- * Various fixes to transform.pd.
-
- * Various clean-ups of docs, POD, and tests.
-
- * Set the default GSL error handler for GSL/INTERP
-   to support perl exception handling rather than
-   having the interpreter exit.
- 
-
-
-
-Release notes for PDL 2.4.7_002 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These Release Notes may not be fully complete.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_002.tar.gz
-       cpan> make CHM/PDL-2.4.7_002.tar.gz
-       cpan> test CHM/PDL-2.4.7_002.tar.gz
-       cpan> look CHM/PDL-2.4.7_002.tar.gz
-
-
-
-Highlights:
-
- * Replace SKIP_KNOWN_PROBLEMS by Test::More's TODO
-   blocks.
-   
-   NOTE: To avoid FAILs for the Known_Problems
-   tests, just set the environment variable
-   SKIP_KNOWN_PROBLEMS or edit the perldl.conf file
-   and set the SKIP_KNOWN_PROBLEMS to 1.
-
-
-
-
-Release notes for PDL 2.4.7_001 --------------------------
-
-General Notes:
-
- * This is a developers release!
- 
-   - It is a snapshot of the current git development tree
-     and everything may not work correctly or have complete
-     documentation.
-
-   - These Release Notes may not be fully complete.
-
-   - All tests may not pass, especially ones corresponding
-     to issues in Known_problems.
-   
-   - Manual build/install is recommended although the
-     cpan shell may be used by specifying the distribution
-     path rather than just the module name, e.g.:
-
-       cpan> get  CHM/PDL-2.4.7_001.tar.gz
-       cpan> make CHM/PDL-2.4.7_001.tar.gz
-       cpan> test CHM/PDL-2.4.7_001.tar.gz
-       cpan> look CHM/PDL-2.4.7_001.tar.gz
-
-
-
-Highlights:
-
- * Updated TODO, Perldl2/TODO, Known_problems and other
-     README type files.
- 
- * Fixed pdldoc to use PERLDOC_PAGER if set.
- 
- * Various minor fixed to POD documentation
- 
- * Fixes to t/fastraw.t to clean up working files on exit
-     and to removed intermediate files at each stage.
-     Some tests were failing because of pre-existing files
-     left from other runs.
- 
- * Partial fix to #3079844 where very long tmpdir pathnames
-     created invalid fortran test code.  The final fix will
-     be to skip this test for such pathalogical pathname
-     lengths and add another test with modern fortran file
-     syntax rather than f77-era 80 character lines.
- 
- * Updated FITS.pm to handle BSCALE/BZERO correctly for
-     tile-compressed images
- 
- * Add win32 workaround for pdl2->perldl exec bug #3056142.
-     Now win32 just exits pdl2 with a warning to run perldl
-     rather than trying the broken exec.
- 
- * Fixed uniqind bug #3076570
- 
- * Fixed Demos/Cartography_demo.pm and Demos/Transform_demo.pm
-     to use the /GW driver on MSWin32 systems only.
- 
- * Various fixes for the PDL-2.4.7 debian package.
-
-
-
-
-Release notes for PDL 2.4.7 --------------------------
-
-General Notes:
-
- * New requirements:
-   - perl version 5.8.x and higher
-   - Convert::UU
- 
- * PDL::Graphics::TriD now requires OpenGL-0.63
- 
- * New 2-D image display routine: imag2d()
-
- * pdl() constructor, a.k.a. PDL->new(), now
-   takes string arguments with either MATLAB type
-   concatenation syntax or PDL print output (for
-   easier cut-and-paste from PDL shell sessions).
-
- * Improved text and comma separated value file
-   input via rcols(): faster and more flexible.
- 
- * A new PDL shell based on Devel::REPL (i.e.,
-   Moose technology).  The new shell supports
-   more perl syntax (lexical variables and
-   packages), is more extensible (via a system
-   of plugins), and supports many forms of file
-   and variable completion.
-   
-   Install Devel::REPL and give it a try!
-   User feedback welcome.
-
- * More portability (builds on more platforms
-   with more features than ever).
-
- * Many bugs fixed...
-
-
-Highlights:
-
- * General
-
-   OpenGL-0.63 is required for PDL::Graphics::TriD.
-
-   Convert::UU is required for PDL.
-
-   Karma is DEPRECATED and NOT SUPPORTED.  Set
-   USE_KARMA=>1 in perldl.conf to force a build.
-   
-   
- * New 2D Image Display Feature: imag2d()
-
-   See PDL::Graphics2D for documentation.
-
-   Add image pixel value display on mouse
-   click in imag2d window
-   
-   Add keyboard command shortcuts for imag2d
-   (with placeholders)
-
-   Fix a number of imag2d() usabiilty bugs
-   
-   
- * pdl() Constructor Can Take String Input
-
-   Allows use of MATLAB-style [ ; ] syntax
-
-   Allows cut-and-paste of printed pdl values
-   as input args for pdl()
-   
-   
- * rcols/wcols Improvements
-
-   Much faster read times
-
-   Multiple columns can read into a single
-   pdl varible
-
-   Symmetric handling of perl and pdl
-   column data
-
-   Improved format support for CSV file input
-   
-   
- * Enhanced PDL Shell (Version 2)
-
-   Based on Devel::REPL which must be installed
-   along with either Term::ReadLine::Perl or
-   Term::ReadLine::Gnu to use the pdl2 features.
-
-   Supports Term::ReadLine::Perl and Term::ReadLine::Gnu.
-
-   Upward compatable with the original PDL shell, perldl.
-
-   Adds completion and command line editing support
-   across all PDL platforms.
-
-   Adds support for current package and lexical variables.
-
-   Toggle default print output via the do_print attribute.
-
-   Default prompt for perldl and pdl2 is now 'pdl> '
-
-   help vars now shows results alphabetically
-
-   pdl2 now runs (falls back to) perldl if Devel::REPL
-   is not installed or if Term::ReadLine::(Perl|Gnu) is
-   not installed.
-   
-   
- * Other Features
-
-   Fix wmpeg() to use ffmpeg to generate the
-   video (sf.net feature request #3010984).
-
-   Added tiled compressed image handling to rfits
-
-   Faster matrix multiply
-
-   Preliminary support for ENVI file format data
-   in PDL/IO/ENVI/readenvi.pdl
-   
-   
- * Build Improvements:
-
-   PDL build process now detects multiple PDL installs
-   and warns of possible conflicts.
-
-   'use PDL' now loads PDL::Config by default.
-
-   PDL "as built" configuration is now saved to %PDL::Config
-
-   Changes file is automatically updated each release
-
-   Add SKIP_KNOWN_PROBLEMS support for build
-
-   Add checks to prevent warnings from access to $HOME
-   when it is not defined.
-   
-   
- * Portability Fixes
-
-   Multiple build improvements for debian platforms
-
-   Improved portability across perl and compiler versions
-
-   Reduced number of fortran dependencies
-
-   Improved support for win32 platforms
-   - PDL::GIS::Proj builds for win32
-   - PDL::Transform::Proj4 builds for win32
-   - PDL::Graphics::PLplot builds for win32
-   - PDL::IO::Dumper builds for win32
-   
-   
- * 3-D Graphics
-
-   Improved PDL::Graphics::TriD demos and examples
-
-   Fixed problems with VRML support for many platforms.
-
-   Better dependency searches for OpenGL during PDL build
-
-   Removed warnings "noise" when used with perl -w
-
-   New spheres3d routine added to PDL::Graphics::TriD
-   
-   
- * Bugs Fixed
-
-   Fix PDL::AutoLoader to handle win32 PDLLIB path
-   syntax with ; as separator. 
-
-   Fix PDL::Complex::string and sum and sumover
-   (sf.net bug #1176614)
-
-   Fix PDL::Config does not match actual build
-   configuration (sf.net bug #3030998).
-
-   Fix dimension numbering in PDL::Transform::t_fits
-
-   Fix jpegtopnm problem in proj_transform.t
-
-   Fix rt.cpan.org bug #53815 in IO/HDF/SD/SD.pd
-
-   Fix rt.cpan.org bug #59126 in isempty pod
-
-   Fix sf.net bug #2901170 re overly verbose warnings when
-   running TriD with perl -w
-
-   Fix sf.net bug #3011143 re whitespace in perl path
-
-   Fix sf.net bug #3021578 re missing xtra dummy dims
-
-   Fix threading with lu_decomp and lu_backsub
-   (sf.net bug #3021567)
-
-   Fix uniq and uniqind NaN and BAD value handling
-   (sf.net bug #3011659)
-
-   Fix uniqvec bug where it did not return a 2-D result
-   (sf.net bug #2978576)
-
-   Fix uuencode/uudecode detection logic in PDL::IO::Dumper
-   to include Convert::UU check
-
-   Make PDL prompt/warn if space in build path
-   (sf.net bug #2924854).
-
-   Fix up code to not crash on non-lazy linking systems.
-
-   Work arounds for perl-d lvalue temp bug introduced
-   in recent perls.
-
-   t/lvalue.t is skipped if run under the debugger. 
-
-   Fix format string attack errors in GSL, PGPLOT,
-   and Transform.
-   
-   
- * Many Documentation Improvements
-
-   Completely reworked PDL web site
-   - Clearer and more helpful to new PDL users.
-   - See http://pdl.perl.org for the latest!
-      
-   New documentation:
-   - Migration guide for MATLAB users.
-   - Migration guide for Scilab users.
-   - Threading tutorial.
-
-   Major reorganization of documentation to better
-   help new users
-   - A guide to PDL's tutorial documentation.
-   - A guide to PDL's module reference documentation.
-   - A study course through all of PDL's documentation.
-   - Removed PDL::Intro
-
-   POD cleanup across many PDL modules and functions.
-
-   Update to copyright statements throughout PDL
-   to clarify licenses.
-
-   Improved on-line help and apropos features in
-   the PDL shell
-
-   Updated FAQ
-
-   Improved POD to HTML translation
-
-   DEPENDENCIES for PDL updated and checked
-   for applicability.
-
-   INSTALL guides improved in the distribution
-   and on the web site.
-
-
-
-Release notes for PDL 2.4.6_993 --------------------------
-
-General Notes:
-
- * This is the PDL-2.4.7 pre-release 3 (final)
-
- * TBD
-
-Highlights:
-
- * See PDL-2.4.7 release notes above
- 
-
-
-
-Release notes for PDL 2.4.6_992 --------------------------
-
-General Notes:
-
- * This is PDL-2.4.7 pre-release 2
-
- * TBD
-
-Highlights:
-
- * See PDL-2.4.6_993 release notes above
-
-
-
-
-Release notes for PDL 2.4.6_991 --------------------------
-
-General Notes:
-
- * This is PDL-2.4.7 pre-release 1
-
- * TBD
-
-Highlights:
-
- * See PDL-2.4.6_992 release notes above
-
-
-
-Release notes for PDL 2.4.6_018 --------------------------
-
-General Notes:
-
- * This is a developers release! It is a snapshot of the
-   current git development tree and everything may not work
-   correctly or have complete documentation (as in these
-   Release notes).
-
-Highlights:
-
- * Candidate fix for the mysterious t/dumper.t failures
-   for some systems, take 2.  If you still see failures,
-   please let us know.  Thanks.
-
-
-
-Release notes for PDL 2.4.6_017 --------------------------
-
-General Notes:
-
- * This is a developers release! It is a snapshot of the
-   current git development tree and everything may not work
-   correctly or have complete documentation (as in these
-   Release notes).
-
-Highlights:
-
- * Candidate fix for the mysterious t/dumper.t failures
-   for some systems.  If you still see failures, please
-   let us know.  Thanks.
-
-
-
-Release notes for PDL 2.4.6_016 --------------------------
-
-General Notes:
-
- * This is a developers release! It is a snapshot of the
-   current git development tree and everything may not work
-   correctly or have complete documentation (as in these
-   Release notes).
-
-Highlights:
-
- * Add smooth shading for spheres3d()
-
- * Fix Perl OpenGL detection to remove the OpenGL
-   PREREQ_PM if an acceptable version of OpenGL is
-   not found.
-
- * PDL now checks for another pre-existing PDL in your
-   perl @INC path and asks you if you wish to continue
-   since mysterious failures have been observed during
-   tests in that case.
- 
- * PDL::AutoLoader now can handle win32 path separators
-  (semicolons) in addition to the usual colons.
-
- * PDL::Config is now loaded by default with use PDL.
-
- * Various documentation updates of TODO, Perldl2/TODO,
-   DEPENDENCIES, Release_Notes and more.
-
-
-
-Release notes for PDL 2.4.6_015 --------------------------
-
-General Notes:
-
- * This is a developers release! It is a snapshot of the
-   current git development tree and everything may not work
-   correctly or have complete documentation (as in these
-   Release notes).
-
- * Perl 5.6.x is no longer supported.
- 
-   Perl 5.8.x or higher is now required.  NOTE: PDL
-   should still build for 5.6.2 and higher if you edit
-   the line in the top level Makefile.PL from 5.008_000
-   back to 5.006_002.
-
-Highlights:
-
- * wmpeg in PDL::IO::Pic now uses ffmpeg to generate the
-   movie file instead of the outdated mpeg_encode.  This
-   is pretty much a straight translation of the original.
-   
-   NOTE: Example/IO has a program you can run to create
-   a quick check movie.  As there is no formal test for
-   this function, feedback on whether this works on your
-   platform is most welcome.  Thanks!
-
-   NOTE: For cygwin, ffmpeg requires version 1.7.x to build.
-
- * PDL::Fit::Polynomial has been modified to remove the
-   Slatec library dependency requesting in sf.net feature
-   request ticket #2891276.
-
- * Other sf.net bugs fixed:
-     3030998    PDL::Config does not match actual build configuration
-     2901170    many warnings w TriD and perl -w
-
- * sf.net bug #117661, PDL::Complex string routine, has
-   been fixed.  In addition, the sum and sumover methods
-   now support PDL::Complex piddles.
-
- * Problem with Ctrl-C killing perldl on win32 has been
-   resolved.  The 2nd Ctrl-C was resulting in an EOF from
-   the perl readline call which caused the shell to exit.
-   Now $PERLDL::NO_EOF=1 is the default for win32.
-
- * Set SKIP_KNOWN_PROBLEMS environment variable to skip
-   tests correspond to reported sf.net bugs.  This allows
-   the full test suite to pass which makes it easier to
-   check if a new bug has been introduced.  For releases,
-   there is a SKIP_KNOWN_PROBLEMS option in perldl.conf.
- 
- * Some minor doc changes.
-
-
-
-Release notes for PDL 2.4.6_014 --------------------------
-
-General Notes:
-
- * This is a developers release! It is a snapshot of the
-   current git development tree and everything may not work
-   correctly or have complete documentation (as in these
-   Release notes).
-
-
-Highlights:
-
- * pdl2 now runs perldl if Devel::REPL is not found so it
-   can be used instead of perldl to start the PDL shell.
- 
- * Fix the failure in t/opengl.t when the X display could
-   not be opened.  The tests are now skipped in that case.
-
- * Some minor doc changes.
-
-
-
-Release notes for PDL 2.4.6_013 --------------------------
-
-General Notes:
-
- * This is a developers release! It is a snapshot of the
-   current git development tree and everything may not work
-   correctly or have complete documentation (as in these
-   Release notes).
-
-
-Highlights:
-
- * 'make dist' now autogenerates the Changes file from the
-   output of git log --stat --since="29 Apr 2009" which
-   should avoid the missing Changes file error in future
-   distributions.  NOTE: This only works for non-win32
-   systems since it assumes the standard git command line
-   interface is present.
-
- *  Put fallback code to glutInitDisplay
-      
-    There have been CPAN test failures where the Perl OpenGL
-    module built and installed ok but then the t/opengl.t
-    fails for PDL.  A look at the two tests shows the main
-    difference is that POGL checks if the GLUT_ALPHA channel will
-    work and if not, tries again without GLUT_ALPHA set.
-
- * Some minor bug fixes
-
-
-
-Release notes for PDL 2.4.6_012 --------------------------
-
-General Notes:
-
- * This is a developers release! It is a snapshot of the
-   current git development tree and everything may not work
-   correctly or have complete documentation (as in these
-   Release notes).
-
-
-Highlights:
-
-* t/proj_transform.t has been fixed to skip the tests if
-  the input earth image is not correct.  t/proj_transform2.t
-  performs the same checks with a synthetic data set which
-  should be available on all platforms.  This should close
-  bug sf.net #3013751.
-
-* Incorrect threading in lu_backsub() and lu_decomp() has
-  been fixed.  This closes bug sf.net #3021567.
-
-
-
-Release notes for PDL 2.4.6_011 --------------------------
-
-General Notes:
-
- * This is a developers release! It is a snapshot of the
-   current git development tree and everything may not work
-   correctly or have complete documentation (as in these
-   Release notes).
-
- * The main purpose for this release is the additional
-   diagnostics in the t/proj_transform.t which may lead
-   to an understanding of what the problem is there.
-
-
-Highlights:
-
- * pdl2 (the new Perldl2 shell now supports all major
-   functions of perldl.  If you have installed the latest
-   Devel::REPL you should be able to use this shell as
-   an enhanced replacement for perldl.  Feedback welcome!
-
- * Fix sf.net bug #3021578 re missing xtra dummy dims
-
- * Add error diagnostics to dummy() in PDL::Core when the
-   required position argument is not present.  The new
-   message now mentions the dummy() method instead of just
-   a line number in Core.pm.
-
- * Update bess[jy][01n] docs in math.pd
-   Fix refs for floor/ceil/rint to use integer
-
- * Use is() instead of ok() in t/proj_transform.t
-
-   That should give more diagnostic output for failing tests
-   to help debug the recent test failures for cygwin 1.7 and
-   freebsd 8.0.
-
-
-
-Release notes for PDL 2.4.6_010 --------------------------
-
-General Notes:
-
- * This is a developers release! It is a snapshot of the
-   current git development tree and everything may not work
-   correctly or have complete documentation (as in these
-   Release notes).
-
-Highlights:
-
- * Experimental perldl version 2 shell available.  See the
-   README file in PDL/Perldl2 for details.
-
-   By default, the Perldl2 shell (i.e., pdl2) will be built
-   and installed if you have already installed Devel::REPL
-   version 1.003011 or higher.
-
-   TAB completion for filenames and history expansion
-   using '!' syntax works with either Term::ReadLine::Gnu
-   or Term::ReadLine::Perl.  If you use the ! operator in
-   your perl code, be sure to follow it by a space so that
-   it is not interpreted for history substitution.
-
-   pdl2 now loads your ~/.pdlrc (or ~/.perldlrc) startup
-   file and also local.pdlrc (or local.perldlrc) file if
-   there is one in the current directory.  Please report
-   any problems or missing functionality to the PDL
-   mailing list.
-
-   help|usage|apropos|sig|badinfo|demo now autoquote their args.
-
-   ? and ?? aliases for help and apropos work
-
-   Shell command escapes for lines beginning with $PERLDL::ESCAPE
-   (defaults to "#") work as well.
-
- * uniq/uniqind/uniqvec now handle BAD values or NaN
-   values consistent with Matlab and between themselves.
-   This fixes sf.net bug #3011659.
-
- * Many win32/win64 portability fixes for PLplot as well
-   as various other documentation and other fixes.
-   
-
-
-Release notes for PDL 2.4.6_009 --------------------------
-
-General Notes:
-
- * This is a developers release!  It is a snapshot of the current git
-   development tree and everything may not work correctly.  However,
-   it is the easiest way to get the latest and greatest from PDL
-   developers without going to the git repository at sourceforge.net.
-
-Highlights:
-
- * Experimental perldl version 2 shell available.
-   See the README file in PDL/Perldl2 for details.
+ * Updated the error handling for GSL::INTERP to match other
+   GSL module usages.
    
-   The list history 'l' command now works, as does the
-   demo command (partially).  You'll need to quote the
-   demo name.  If you get a hang at the end of the demo,
-   try typing Ctrl-D.  That appears to work on non-win32
-   platforms.
-
-   NOTE: History expansion via ! works but it is not
-   yet merged into the saved history.  !-Num will work
-   if the command was in the current Perldl2 session.
-
-
-
-Release notes for PDL 2.4.6_009 --------------------------
-
-General Notes:
-
- * This is a developers release!  It is a snapshot of the current git
-   development tree and everything may not work correctly.  However,
-   it is the easiest way to get the latest and greatest from PDL
-   developers without going to the git repository at sourceforge.net.
-
-Highlights:
-
- * Experimental perldl version 2 shell available.
-   See the README file in PDL/Perldl2 for details.
+ * Applied sf.net patch #3209075 IO::HDF square sds
    
-   The list history 'l' command now works, as does the
-   demo command (partially).  You'll need to quote the
-   demo name.  If you get a hang at the end of the demo,
-   try typing Ctrl-D.  That appears to work on non-win32
-   platforms.
+ * New binary blob support in PDL::IO::GD::OO
 
-   NOTE: History expansion via ! works but it is not
-   yet merged into the saved history.  !-Num will work
-   if the command was in the current Perldl2 session.
+ Bugs Fixed:
 
+ * Applied Christian Soeller's patch for FFTW on 64-bit
+   systems.  This resolves bug #3203480 "t/fftw.t fails
+   on 64-bit systems".
+   
+ * Fixed sf.net bug #3172882 re broken threading in inv().
+   inv() and lu_backsub() now handle threading.  Updated
+   documentation for lu_decomp, lu_deomp2, and lu_backsub.
+   
+ * Fixed sf.net bug #3171702 "missing podselect command
+   breaks PDL build"
+   
+ * Fixed sf.net bug #3185864 (bad adev in statsover)
+   
+ * Fixed sf.net bug #3139697: fixed imag2d() to work better
+   with Mac OS X GLUT and not just FreeGLUT.
+   
+ * Fixed uniqind bug #3076570
+   
+ * Fixed SF bug #3057542: wmpeg doesn't error on missing
+   ffmpeg program.  Now wmpeg returns 1 on success and
+   undef on error.  If ffmpeg is not in PATH, it just fails
+   immediately....
+   
+ * Fixed SF bug #3056142: pdl2 fallback to perldl broken
+   on win32
+   
+ * Fixed SF bug #3042201: t/dumper.t fails mysteriously
+   
+ * Fixed SF bug #3031068: PDL::IO::FlexRaw mapflex memory
+   mapping fails
+   
+ * Fixed SF bug #3011879, "pdl() constructor crashes perl for
+   mixed ref/piddle args" and #3080505, and #3139088.  This
+   fix also includes a larger and more complete set of tests.
+   
+ * Fixed segfault in plplot.t with a work-around.
+   
+ * Fixed bug in readenvi.pdl header list value processing
+   and added support for embedded file headers.
+   
+ * Fixed bug in FlexRaw.pm support for headers with Type
+   passed  as string.
+   
+ * Fixed imag2d() in PDL::Graphics2D.  It no longer calls
+   exit on ESC if run within the pdl2/perldl shell.  Also
+   did some clean up of key controls and module mechanics.
+   
+ * Fixed upstream bug in Devel::REPL for MultiLine
+   continuation.  Now incomplete q[] and qq[] constructs
+   continue reading until properly closed.  See the
+   Known_problems file for details.
 
 
-Release notes for PDL 2.4.6_009 --------------------------
+    
+Release notes for PDL 2.4.7 --------------------------
 
 General Notes:
 
- * This is a developers release!  It is a snapshot of the current git
-   development tree and everything may not work correctly.  However,
-   it is the easiest way to get the latest and greatest from PDL
-   developers without going to the git repository at sourceforge.net.
+ * New requirements:
+   - perl version 5.8.x and higher
+   - Convert::UU
+ 
+ * PDL::Graphics::TriD now requires OpenGL-0.63
+ 
+ * New 2-D image display routine: imag2d()
 
-Highlights:
+ * pdl() constructor, a.k.a. PDL->new(), now
+   takes string arguments with either MATLAB type
+   concatenation syntax or PDL print output (for
+   easier cut-and-paste from PDL shell sessions).
 
- * Experimental perldl version 2 shell available.
-   See the README file in PDL/Perldl2 for details.
+ * Improved text and comma separated value file
+   input via rcols(): faster and more flexible.
+ 
+ * A new PDL shell based on Devel::REPL (i.e.,
+   Moose technology).  The new shell supports
+   more perl syntax (lexical variables and
+   packages), is more extensible (via a system
+   of plugins), and supports many forms of file
+   and variable completion.
    
-   The list history 'l' command now works, as does the
-   demo command (partially).  You'll need to quote the
-   demo name.  If you get a hang at the end of the demo,
-   try typing Ctrl-D.  That appears to work on non-win32
-   platforms.
-
-   NOTE: History expansion via ! works but it is not
-   yet merged into the saved history.  !-Num will work
-   if the command was in the current Perldl2 session.
-
-
+   Install Devel::REPL and give it a try!
+   User feedback welcome.
 
-Release notes for PDL 2.4.6_009 --------------------------
+ * More portability (builds on more platforms
+   with more features than ever).
 
-General Notes:
+ * Many bugs fixed...
 
- * This is a developers release!  It is a snapshot of the current git
-   development tree and everything may not work correctly.  However,
-   it is the easiest way to get the latest and greatest from PDL
-   developers without going to the git repository at sourceforge.net.
 
 Highlights:
 
- * Experimental perldl version 2 shell available.
-   See the README file in PDL/Perldl2 for details.
-   
-   The list history 'l' command now works, as does the
-   demo command (partially).  You'll need to quote the
-   demo name.  If you get a hang at the end of the demo,
-   try typing Ctrl-D.  That appears to work on non-win32
-   platforms.
-
-   NOTE: History expansion via ! works but it is not
-   yet merged into the saved history.  !-Num will work
-   if the command was in the current Perldl2 session.
-
-
+ * General
 
-Release notes for PDL 2.4.6_009 --------------------------
+   OpenGL-0.63 is required for PDL::Graphics::TriD.
 
-General Notes:
+   Convert::UU is required for PDL.
 
- * This is a developers release!  It is a snapshot of the current git
-   development tree and everything may not work correctly.  However,
-   it is the easiest way to get the latest and greatest from PDL
-   developers without going to the git repository at sourceforge.net.
+   Karma is DEPRECATED and NOT SUPPORTED.  Set
+   USE_KARMA=>1 in perldl.conf to force a build.
+   
+   
+ * New 2D Image Display Feature: imag2d()
 
-Highlights:
+   See PDL::Graphics2D for documentation.
 
- * Experimental perldl version 2 shell available.
-   See the README file in PDL/Perldl2 for details.
+   Add image pixel value display on mouse
+   click in imag2d window
    
-   The list history 'l' command now works, as does the
-   demo command (partially).  You'll need to quote the
-   demo name.  If you get a hang at the end of the demo,
-   try typing Ctrl-D.  That appears to work on non-win32
-   platforms.
-
-   NOTE: History expansion via ! works but it is not
-   yet merged into the saved history.  !-Num will work
-   if the command was in the current Perldl2 session.
+   Add keyboard command shortcuts for imag2d
+   (with placeholders)
 
+   Fix a number of imag2d() usabiilty bugs
+   
+   
+ * pdl() Constructor Can Take String Input
 
+   Allows use of MATLAB-style [ ; ] syntax
 
-Release notes for PDL 2.4.6_009 --------------------------
+   Allows cut-and-paste of printed pdl values
+   as input args for pdl()
+   
+   
+ * rcols/wcols Improvements
 
-General Notes:
+   Much faster read times
 
- * This is a developers release!  It is a snapshot of the current git
-   development tree and everything may not work correctly.  However,
-   it is the easiest way to get the latest and greatest from PDL
-   developers without going to the git repository at sourceforge.net.
+   Multiple columns can read into a single
+   pdl varible
 
-Highlights:
+   Symmetric handling of perl and pdl
+   column data
 
- * Experimental perldl version 2 shell available.
-   See the README file in PDL/Perldl2 for details.
+   Improved format support for CSV file input
+   
    
-   The list history 'l' command now works, as does the
-   demo command (partially).  You'll need to quote the
-   demo name.  If you get a hang at the end of the demo,
-   try typing Ctrl-D.  That appears to work on non-win32
-   platforms.
+ * Enhanced PDL Shell (Version 2)
 
-   NOTE: History expansion via ! works but it is not
-   yet merged into the saved history.  !-Num will work
-   if the command was in the current Perldl2 session.
+   Based on Devel::REPL which must be installed
+   along with either Term::ReadLine::Perl or
+   Term::ReadLine::Gnu to use the pdl2 features.
 
+   Supports Term::ReadLine::Perl and Term::ReadLine::Gnu.
 
+   Upward compatable with the original PDL shell, perldl.
 
-Release notes for PDL 2.4.6_008 --------------------------
+   Adds completion and command line editing support
+   across all PDL platforms.
 
-General Notes:
+   Adds support for current package and lexical variables.
 
- * This is a developers release!  It is a snapshot of the current git
-   development tree and everything may not work correctly.  However,
-   it is the easiest way to get the latest and greatest from PDL
-   developers without going to the git repository at sourceforge.net.
+   Toggle default print output via the do_print attribute.
 
-Highlights:
+   Default prompt for perldl and pdl2 is now 'pdl> '
 
- * Experimental perldl version 2 shell available.
- 
-   See the README file in PDL/Perldl2 for details.  Full
-   completion support is now available for all platforms
-   via Term::ReadLine::Perl as well as Term::ReadLine::Gnu.
+   help vars now shows results alphabetically
 
-   The Perldl2 shell (pdl2) now loads and saves command line
-   history from the same file as perldl, ~/.perldl_hist.
+   pdl2 now runs (falls back to) perldl if Devel::REPL
+   is not installed or if Term::ReadLine::(Perl|Gnu) is
+   not installed.
    
-   Please Note: while all commands are saved and loaded between
-   the perldl and pdl2, the Perldl2 shell is missing some features
-   of perldl so not all commands retrieved from perldl history
-   will execute correctly in a subsequent pdl2 session.
-
- * Added Convert::UU as a required dependency for PDL to improve
-   portability (it provides backup uuencode and uudecode for
-   platforms without them).
-
- * Add work around for perl -d problem with lvalue subroutines
-   so that tests: imagend.t, lvalue.t, matrixops.t, misc.t, and
-   transform.t now run under the debuger (even for broken perls
-   versions 5.10.1 through 5.12)
-
- * Add fixes for printf and carp format string attacks
+   
+ * Other Features
 
- * Preliminary version of spheres3d for plotting 3D spheres
-   with TriD.  Support for varying radii and colors not yet
-   complete.
+   Fix wmpeg() to use ffmpeg to generate the
+   video (sf.net feature request #3010984).
 
+   Added tiled compressed image handling to rfits
 
+   Faster matrix multiply
 
-Release notes for PDL 2.4.6_007 --------------------------
+   Preliminary support for ENVI file format data
+   in PDL/IO/ENVI/readenvi.pdl
+   
+   
+ * Build Improvements:
 
-General Notes:
+   PDL build process now detects multiple PDL installs
+   and warns of possible conflicts.
 
- * This is a developers release!  It is a snapshot of the current git
-   development tree and everything may not work correctly.  However,
-   it is the easiest way to get the latest and greatest from PDL
-   developers without going to the git repository at sourceforge.net.
+   'use PDL' now loads PDL::Config by default.
 
-Highlights:
+   PDL "as built" configuration is now saved to %PDL::Config
 
- * Experimental perldl version 2 shell available.
- 
-   See the README file in PDL/Perldl2 for details on how to use.
-   Full completion support is now available for all platforms
-   via Term::ReadLine::Perl as well as Term::ReadLine::Gnu.
+   Changes file is automatically updated each release
 
-   Work continues to port existing perldl features to the new
-   Devel::REPL framework.
+   Add SKIP_KNOWN_PROBLEMS support for build
 
+   Add checks to prevent warnings from access to $HOME
+   when it is not defined.
+   
+   
+ * Portability Fixes
 
-Release notes for PDL 2.4.6_006 --------------------------
+   Multiple build improvements for debian platforms
 
-General Notes:
+   Improved portability across perl and compiler versions
 
- * This is a developers release!  It is a snapshot of the current git
-   development tree and everything may not work correctly.  However,
-   it is the easiest way to get the latest and greatest from PDL
-   developers without going to the git repository at sourceforge.net.
+   Reduced number of fortran dependencies
 
-Highlights:
+   Improved support for win32 platforms
+   - PDL::GIS::Proj builds for win32
+   - PDL::Transform::Proj4 builds for win32
+   - PDL::Graphics::PLplot builds for win32
+   - PDL::IO::Dumper builds for win32
+   
+   
+ * 3-D Graphics
 
- * Experimental perldl version 2 shell available.
- 
-   See the README file in PDL/Padre for details on how to use.
-   Full completion support is now available for all platforms
-   via Term::ReadLine::Perl as well as Term::ReadLine::Gnu.
+   Improved PDL::Graphics::TriD demos and examples
 
-   Work continues to port existing perldl features to the new
-   Devel::REPL framework.
+   Fixed problems with VRML support for many platforms.
 
- * Preliminary support for MATLAB/Octave array constructor
-   notation as allowed input to the pdl() constructor,
-   a.k.a. PDL::new.  The same implementation also supports
-   cutting and pasting from PDL print output for piddles
-   as valid input for pdl in scripts.  Just use the pasted
-   input as a string.  For example:
+   Better dependency searches for OpenGL during PDL build
 
-    a  =      [ 1 2 3 ; 4 5 6 ] # MATLAB/Octave
-    $a = pdl q[ 1 2 3 ; 4 5 6 ] # PDL/perldl
+   Removed warnings "noise" when used with perl -w
 
-    Printing $a gives:
+   New spheres3d routine added to PDL::Graphics::TriD
+   
+   
+ * Bugs Fixed
 
-    [
-     [1 2 3]
-     [4 5 6]
-    ]
+   Fix PDL::AutoLoader to handle win32 PDLLIB path
+   syntax with ; as separator. 
 
-    And we can cut and paste like this
+   Fix PDL::Complex::string and sum and sumover
+   (sf.net bug #1176614)
 
-    $a = pdl q[
-               [1 2 3]
-               [4 5 6]
-              ];
+   Fix PDL::Config does not match actual build
+   configuration (sf.net bug #3030998).
 
-    Problem reports and feature suggestions welcome at the
-    perldl mailing list.
+   Fix dimension numbering in PDL::Transform::t_fits
 
- * Added tiled compressed image handling to rfits in FITS.pm
-   including a new compression module in Lib/Compression.
+   Fix jpegtopnm problem in proj_transform.t
 
- * Partial fix for a problem with window shrink creep in imag2d()
+   Fix rt.cpan.org bug #53815 in IO/HDF/SD/SD.pd
 
- * Fix uniqvec bug from SF# 2978576
+   Fix rt.cpan.org bug #59126 in isempty pod
 
- * Fix rt.cpan.org #53815 in IO/HDF/SD/SD.pd
+   Fix sf.net bug #2901170 re overly verbose warnings when
+   running TriD with perl -w
 
- * Fixes SF bug 2949455 ("demo transform broken"): sign error in FITS
-   header CROTA2 interpretation by PGPLOT libraries.
+   Fix sf.net bug #3011143 re whitespace in perl path
 
- See the Changes file for the full log entries.
+   Fix sf.net bug #3021578 re missing xtra dummy dims
 
+   Fix threading with lu_decomp and lu_backsub
+   (sf.net bug #3021567)
 
+   Fix uniq and uniqind NaN and BAD value handling
+   (sf.net bug #3011659)
 
-Release notes for PDL 2.4.6_004 --------------------------
+   Fix uniqvec bug where it did not return a 2-D result
+   (sf.net bug #2978576)
 
-General Notes:
+   Fix uuencode/uudecode detection logic in PDL::IO::Dumper
+   to include Convert::UU check
 
- * This is a developers release!  It is a snapshot of the current git
-   development tree and everything may not work correctly.  However,
-   it is the easiest way to get the latest and greatest from PDL
-   developers without going to the git repository at sourceforge.net.
+   Make PDL prompt/warn if space in build path
+   (sf.net bug #2924854).
 
-Highlights:
+   Fix up code to not crash on non-lazy linking systems.
 
- * rcols() now has support for specifying multicolumn piddles for
-   input data and performance has been significantly improved for
-   common input data options.
+   Work arounds for perl-d lvalue temp bug introduced
+   in recent perls.
 
-   - Patterns for rcols() may now be specified using
-     the qr{} syntax instead of quoted strings.
+   t/lvalue.t is skipped if run under the debugger. 
 
-   - The COLIDS option allows one to return line 0 of
-     the data file containing field names/identifiers.
-     PERLCOLS may be used to return non-piddle ids from
-     the row data.
+   Fix format string attack errors in GSL, PGPLOT,
+   and Transform.
+   
+   
+ * Many Documentation Improvements
 
+   Completely reworked PDL web site
+   - Clearer and more helpful to new PDL users.
+   - See http://pdl.perl.org for the latest!
+      
+   New documentation:
+   - Migration guide for MATLAB users.
+   - Migration guide for Scilab users.
+   - Threading tutorial.
 
-Release notes for PDL 2.4.6_001 --------------------------
+   Major reorganization of documentation to better
+   help new users
+   - A guide to PDL's tutorial documentation.
+   - A guide to PDL's module reference documentation.
+   - A study course through all of PDL's documentation.
+   - Removed PDL::Intro
 
-General Notes:
+   POD cleanup across many PDL modules and functions.
 
- * This is a developers release!  It is a snapshot of the current git
-   development tree and everything may not work correctly.  However,
-   it is the easiest way to get the latest and greatest from PDL
-   developers without going to the git repository at sourceforge.net.
+   Update to copyright statements throughout PDL
+   to clarify licenses.
 
-Highlights:
+   Improved on-line help and apropos features in
+   the PDL shell
 
- * Improved support for user defined column separators for rcols and wcols.
-   This makes it possible for rcols and wcols to be (almost) inverses of
-   each other and allows better slurping of CSV formatted data files.  See
-   help PDL::IO::Misc or help rcols or help wcols for documentation.
+   Updated FAQ
 
-   NOTE: $PDL::IO::Misc::colsep is superseded by $PDL::IO::Misc::defcolsep
-   to set the default column separator and by the COLSEP option for setting
-   on a call by call basis.  The old colsep global is still supported but
-   the new usage is recommended.
+   Improved POD to HTML translation
 
- * imag2d() window clicks now output the pixel values along with the
-   display window pixel location and the input image pixel locations.
+   DEPENDENCIES for PDL updated and checked
+   for applicability.
 
- * Many little fixed and documentation improvements.  See git log for info
-   and also the Changes file.
+   INSTALL guides improved in the distribution
+   and on the web site.
 
 
 
@@ -3595,125 +1190,6 @@ Summary of Changes:
 
 
 
-Release notes for PDL 2.4.5_008 --------------------------
-
-Highlights:
-
-  * This is a DEVELOPER's release for testing
-
-  * Effectively PDL-2.4.6 release candidate 2
-
-  * OpenGL-0.62 is now the required version for TriD
-
-  * Removed unneeded platform special cases for USE_3D
-    in perldl.conf
-
-
-
-Release notes for PDL 2.4.5_007 --------------------------
-
-Highlights:
-
-  * This is a DEVELOPER's release
-
-  * Move TriD example/test progs to Example/TriD
-
-  * Add better example to imag2d() documentation
-  
-  * Add q or Q to Quit message to twiddle routine
-
-  * Minor code fixes.
-
-
-
-Release notes for PDL 2.4.5_006 --------------------------
-
-Highlights:
-
-  * This is a DEVELOPER's release
-
-  * imag2d() available for viewing images with square pixels.
-
-    REQUIRES: The Perl OpenGL TriD interface and FreeGLUT,
-              legacy X11 TriD is not supported.
-
-    It is implemented in the imag2d.pdl file for autoloading
-    via PDL::AutoLoader.  To use, copy the imag2d.pdl file
-    to somewhare in your PDLLIB path or add the location to
-    your PDLLIB environment variable.
-
-    It works with multiple, simultaneous, image windows
-    and appears to work side-by-side with TriD graphics
-    windows.
-
-
-
-Release notes for PDL 2.4.5_005 --------------------------
-
-Highlights:
-
-  * This is a DEVELOPER's release
-
-  * Fixed conv1d() bug where it was actually calculating the
-    correlation and not the convolution.  For symmetric kernels
-    they are the same.
-
-  * Fixed fftconvolve to give the same results as the other
-    convolution algorithms.  The new implementation is
-    probably slower than the previous and definitely uses
-    more temporary memory.  The old routine is preserved
-    as fftconvolve_inplace() if needed.  This was listed
-    as SF bug #2630369.
-
-  * Fixed SF bug #2524068 for PDL::Minuit.  Now use pp_addxs()
-    to define the binding to mnseti() to avoid bug in pp_def()
-    when there are no piddle arguments.
-
-  * TriD graphics windows now have their GLUT window ID in
-    the window title.  This allows for simpler identification
-    and use of multiple TriD graphics windows.
-
-  * Fixed the TriD display() routine to set the current GLUT
-    window before drawing takes place.   Now multiple TriD
-    windows can exist and be drawn to.
-
-
-
-Release notes for PDL 2.4.5_004 --------------------------
-
-Highlights:
-
-  * This is a DEVELOPER's release
-
-  * Fix OpenGLQ headers for AGL GLUT only build
-
-  * Make Perl OpenGL 0.61 the minimum version
-    OpenGL-0.61 has a needed fix to some FreeGLUT parameters that
-    are required for correct event loop exit handling.
-
-  * Fix bug with _have_freeglut check
-    The new() method was using $OpenGL::_have_freeglut to test
-    rather than the correct OpenGL::_have_freeglut().
-
-  * Multiple fixes supporting Debian package for PDL-2.4.5
-
-  * Fix OpenGLQ/Makefile.PL use/require problem
-    Had require but with use statement syntax.
-
-  * Fix some TriD OpenGL config and test bugs
-    This should help with CPAN automated testers.
-
-  * Removed automated testing USE_POGL=>1 setting
-    This and the hardwired 1 in the perldl.conf may have been
-    the origin of a lack of CPAN automated testers reports.
-
-  * Fix perldl.conf to set USE_POGL => undef
-
-  * Update Basic/Core/ppport.h to latest version, 3.14 from 3.09
-    This should not break anything.
-
-
-
 Release notes for PDL 2.4.5 ------------------------------
 
 Highlights:
@@ -3759,7 +1235,7 @@ General Notes:
   If you are new to PDL, we recommend joining the perldl
   mailing list for discussion and questions.  See
 
-    http://pdl.sourceforge.net/maillists/
+    http://pdl.perl.org/?page=mailing-lists
 
   for how to sign up and links and searches of the list
   archive discussions.
@@ -3833,501 +1309,6 @@ Summary of Changes:
   
 
 
-Release notes for PDL 2.4.4_136 --------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-  If you have OpenGL installed, PDL::Graphics::TriD should
-  build out of the box for MSWin32, Mac OS X, and traditional
-  unix platforms (linux, *bsd, solaris) using the new GLUT
-  framework for the OS window creation and manipulation.
-
-  IMPORTANT: Given the increased portability and generality of
-  the new TriD interface approach, it is expected that the legacy
-  TriD build interface (based on X11) will be deprecated soon
-  (almost immediately) and removed after that.  It has been
-  effectively unsupported for some time.
-
-
-Summary of Changes:
-
-  TriD now requires Perl OpenGL-0.59 or greater to build.
-
-  The new PDL::Graphics::TriD is available on all platforms
-  supporting Perl OpenGL (a.k.a. POGL).
-
-     NOTE: There are two example programs at the top PDL/
-     directory: 3dtest.pl and line3d.pl which you can use
-     to exercise the TriD module: e.g.
-
-       perl -Mblib 3dtest.pl OR perl -Mblib line3d.pl
-
-  New, more portable code for finding the system typemaps files
-  is implemented.
-
-  IO::Browser now builds on cygwin and may work for other
-  systems.  Set WITH_IO_BROWSER => 1, if you dare!
-
-  The perldl shell now changes it prompt to perl> from the
-  perldl> default if PDL was not able to be loaded.
-
-  Clean up of the IO/GD/Makefile.PL for win32 platforms.
-
-  See the Changes file or run 'git log --stat' for detailed
-  list of changes.
-
-  An example GLUT program using fonts, bitmap.c, is in the
-  PDL top level directory.  If you have problems with font
-  errors, try compiling this to see if the issue is a GLUT
-  or FreeGLUT installation problem or in the PDL/Perl bindings.
-  Contact the perldl mailing list for help.
-
-
-
-Release notes for PDL 2.4.4_13 --------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-
-Summary of Changes:
-
-   To support development testing and unique identification for
-   clearer communication, the pushes to git will have their
-   version incremented in the last place after the _ along
-   with updates to the prerequisite version in the use OpenGL
-   statements.  If you cannot build PDL+POGL because of a
-   missing OpenGL release version and you have not seen an
-   announcement on the perldl mailing list of that developers
-   release, you'll need to obtain it from the corresponding
-   git repostory on sourceforge.
-
-     There are two demo/test programs at the top PDL/ directory:
-     3dtest.pl and line3d.pl which you can use to exercise the
-     TriD module.  If those work ok for you, please feel free to
-     try a 'perl -Mblib perldl' followed by 'demo 3d'.
-
-   Now has Perl OpenGL-0.58_007 or greater as a CPAN prerequisite
-   for testing the new TriD code using the Perl OpenGL module
-   (a.k.a. POGL) to provide the bindings to OpenGL, GLU, and GLUT,
-   in git only so far.
-
-   The current release includes a patch to fix a reported problem
-   locating the Mac OS X typemaps file.  Mac users, please report
-   if you have failures due to this change.
-
-   The code is believed to work on win32 systems, cygwin, and
-   linux with the FreeGLUT interface and Mac OS X with the Apple
-   GLUT implementation.
-
-   By default, USE_POGL is set in the perldl.conf file to enable
-   the new implementation.  Setting it to zero will enable the
-   legacy implementation.  If you have to do this to get TriD
-   working on a platform that already had it working, please let
-   the developers know via the perldl mailing list!
-
-   Once the correct operation of the new TriD code base is confirmed,
-   the PDL developers snapshot is expected to be released as the
-   PDL-2.4.5 official release.
-
-
-
-Release notes for PDL 2.4.4_121 --------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-
-Summary of Changes:
-
-   To support development testing and unique identification for
-   clearer communication, the pushes to git will have their
-   version incremented in the last place after the _ along
-   with updates to the prerequisite version in the use OpenGL
-   statements.  If you cannot build PDL+POGL because of a
-   missing OpenGL release version and you have not seen an
-   announcement on the perldl mailing list of that developers
-   release, you'll need to obtain it from the corresponding
-   git repostory on sourceforge.
-
-   Now has Perl OpenGL-0.58_007 or greater as a CPAN prerequisite
-   for testing the new TriD code using the Perl OpenGL module
-   (a.k.a. POGL) to provide the bindings to OpenGL, GLU, and GLUT,
-   in git only so far.
-
-   The current release includes a patch to fix a reported problem
-   locating the Mac OS X typemaps file.  Mac users, please report
-   if you have failures due to this change.
-
-   The code is believed to work on win32 systems, cygwin, and
-   linux with the FreeGLUT interface but testing has not yet
-   confirmed win32 fully.  Mac OS X debugging is underway to
-   resolve a GUI hang.  We're getting close but more tester
-   feedback is always helpful.
-
-   By default, USE_POGL is set in the perldl.conf file to enable
-   the new implementation.  Setting it to zero will enable the
-   legacy implementation.  If you have to do this to get TriD
-   working on a platform that already had it working, please let
-   the developers know via the perldl mailing list!
-
-   Once the correct operation of this release is confirmed, it is
-   expected to be released as the PDL-2.4.5 official release.
-
-
-
-Release notes for PDL 2.4.4_09 ---------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-
-Summary of Changes:
-
-   Now has Perl OpenGL-0.58_004 or greater as a CPAN prerequisite for
-   testing the new TriD refactoring.  Due to to changes and testing
-   for TriD development, this release may be less stable than usual.
-
-   Use option USE_POGL in perldl.conf to toggle the legacy TriD
-   code versus the new OpenGL (POGL) based code.  Feedback from
-   different platforms encouraged!
-
-   NOTE: USE_POGL is enabled by default for testing purposes.
-
-
-
-Release notes for PDL 2.4.4_08 ---------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-
-Summary of Changes:
-
-   PDL::Graphics::TriD builds on current cygwin systems.
-   The locations of include files and the MESA functionality
-   work arounds changed since the PDL-2.4.3 release.
-
-
-
-Release notes for PDL 2.4.4_07 ---------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-   The original, pre-CVS to git migration changes are listed in
-   Changes_CVS and Changes contains the output from git log --stat
-   since April 2009.
-
-   Data::Dumper v2.121 and Storable v1.03 are now explicit
-   prerequisites to the PDL build.  This should give better
-   diagnostics and makes clear that these modules are essential
-   to PDL IO functionality.
-
-   Continue minor fixes and cleanup to main PDL file tree.
-
-
-Summary of Changes:
-
-    Make Data::Dumper v 2.121 the minimum required
-
-    Avoid lvalue sub syntax requirements
-    
-    Rework storable test to use Test::More
-    
-    Fix t/autoload.t test when echo ~ gives ~
-    
-
-
-Release notes for PDL 2.4.4_06 ---------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-     This is another developers release of the latest git PDL.
-     More code cleanup, added diagnostics, and updating the
-     various documentation.
-
-     The old (pre-git) Changes file has been renamed Changes_CVS
-     and the new Changes file is generated from the output of the
-     git log --stat command.  This should make it easier to keep
-     the changes file up to date.  Any developer or interested
-     user can download the full repository and run git log to see
-     all the history in its glory.
-
-
-Summary of Changes:
-
-   Move Changes to Changes_CVS to prep for git log
-
-     We plan to move from a manual Changes file to an automatically
-     generated one extracted from the git log messages.  The initial
-     command is "git log --stat" and will be added to the make dist
-     command eventually.  For now, just generate by hand before making
-     a CPAN distribution.
-
-   Added PERL5OPT unset for podselect command
-
-     Missed the podselect in Basic/Gen/Makefile.PL.
-     This unsets PERL5OPT before running podselect
-     in the generated Makefile.  That should prevent
-     false failures due to Devel::Autoflush not being
-     available...
-
-   Make tilde test check against `echo ~` result
-
-     Since the goal is to give the same result as the
-     shell (i.e. bash) expansion of ~, and since all the
-     false test failures had the PDL::AutoLoader giving
-     the same result as `echo ~`, I've just made that
-     the result to check against.
-
-   Win32 - MSVC-specific fix for setvaltobad() for PDL_Float
-   
-     In Basic/Bad/bad.pd:
-     Provide special handling for setvaltobad() wrt PDL_Float piddles.
-     Applies only to MSVC++ compilers prior to version 8.0.
-     Thanks to creamygoodness, BrowserUk, ig and ELISHEVA:
-     http://www.perlmonks.org/index.pl?node_id=781347
-
-   Win32 - Reduce scope of MSVC-specific bugfix
-
-     Some MS compiler bugs have been fixed in later
-     versions of the compiler.
-     This allows us to change each occurrence of:
-     #ifdef _MSC_VER
-       to:
-     #if defined _MSC_VER && _MSC_VER < 1400
-
-   Basic/Core/Dev.pm - tweak setting of WriteMakefile() LIBS
-
-     Instead of specifying LIBS=>[] (on those occasions when LIBS
-     should be empty) pdlpp_stdargs_int() and pdlpp_stdargs() would
-     have LIBS=>[''] and LIBS=>[' '] respectively.
-     Minor rewrite to pdlpp_stdargs_int() and pdlpp_stdargs() to fix this.
-
-   Added $! to another Basic/Core/Dev.pm die message
-   Added $! to Basic/Core/Dev.pm tempfile error
-
-     The die when trylink failed to open its temporary
-     output file did not include the system error reported.
-     That has been added to the output to improve debugging.
-
-   Added diag print for t/dumper.t small sdump()
-
-     There have been persistent t/dumper.t failures
-     on some BSD platforms.  Adding a diag() to print
-     the result of the first sdump() string to give
-     a clue as to what the problem is.
-
-   Fix readflex() to work with File::LinearRaid
-
-     readflex() in IO/FlexRaw/FlexRaw.pm use method syntax for
-     read with an input file handle.  This failed with a tied
-     file handle as is used by File::LinearRaid.  Replacing the
-     usage $d->read(...) by read($d, ...) fixed the incompatibility.
-     I don't know if it should have worked the other way or not.
-
-   Fold in [dn]make correction to PERL5OPT fix
-
-     The "fix" for the -MDevel::Autoflush did not
-     work with dmake or nmake (presumably because of
-     the non-sh command shell).
-
-
-
-Release notes for PDL 2.4.4_05 ---------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-
-Summary of Changes:
-
-     This is a quick release to fix a missing TAB
-     in the Makefile.PL generation for the podselect
-     problem.  All else is the same as PDL-2.4.4_04.
-
-
-
-Release notes for PDL 2.4.4_04 ---------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-     PDL now requires perl 5.6.2 or higher.
-
-     More incremental bug fixes along the way to a
-     PDL-2.4.5 release which is planned to have the
-     reworked 3D graphics support.
-
-
-Summary of Changes:
-
-        Updated the top level readme type files to correct
-        link information, remove cvs references, and to add
-        information on changes and outstanding issues.
-
-        Fixed a bug in the t/autoload.t tests that resulted in
-        false fails for the now fixed tilde expansion.
-
-        Add cast to $GENERIC(a) for setvaltonan() to improve support
-        for non-double piddles.
-
-        Continue to clean up the default release and development files
-        following the migration from cvs to git.
-
-        PDL now explicitly requires perl 5.6.2 or above.
-        
-          No PASSes have been reported to CPAN Testers
-          for PDL with perl 5.6.0 or 5.6.1, ever.  This
-          modification sets better expectations for PDL users.
-
-        Update FAQ for CVS->Git migration
-
-        Change $PDL::VERSION to 2.4.4_03git for devel
-
-        Fix t/proj_transform to skip when no earth_image()
-
-          Missing jpegtopnm functionality in NetPBM or other
-          causes earth_image() to fail on some platforms.
-          This modifies the test to skip the remaining tests
-          if earth_image() can not be loaded.
-
-
-
-Release notes for PDL 2.4.4_03 ---------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-     t/proj_transform fails due to problem
-     loading the input data via the
-     earth_image() routine. Debugging has
-     been added.
-
-     t/pic_16bit fails because of an old
-     netpbm version. Clean up by adding
-     a config variable whether 16bit raw
-     PNM are allowed and honor that in
-     the rpic/wpic code. Skip tests if
-     appropriate.  TODO
-
-     t/storable.t failure to load compiled
-     module waiting on detailed test run from
-     reporter.  TODO
-
-     CPAN sets PERL5OPT=-MDevel::Autoflush
-     but this is problematic with perl
-     scripts run under controlled
-     environments. Need to figure out a way
-     around this.  TODO
-
-     "No rule to make target pptemplate
-     needed by pptemplate.pod" which may be
-     a make specific problem, related to the
-     version of EU::MM or something else...
-     Need to request Basic/Gen Makefile
-     output and make program and EU::MM info
-     from reporter.  TODO
-
-
-Summary of Changes:
-
-     TBD
-
-
-
-Release notes for PDL 2.4.4_02 ---------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-
-Summary of Changes:
-
-     TBD
-
-
-
-Release notes for PDL 2.4.4_01 ---------------------------
-
-General Notes:
-
-     *************************************
-     *                                   *
-     *   This is a development release   *
-     *                                   *
-     *************************************
-
-
-Summary of Changes:
-
-     - Several SF.net bugs have been fixed
-
-     - pctover() and oddpctover() should generate more accurate
-       results with greater consistency to MS Excel calculations
-
-     - PDL should pass automated build tests on more platforms
-
-
-
 Release notes for PDL 2.4.4 ------------------------------
 
 General Notes:
@@ -1,5 +1,5 @@
 What follows is that task list and description of
-the work planned for the future  PDL-2.4.x releases.
+the work planned for the future  PDL-2.x releases.
 
 The main goal we are working towards is to have a
 baseline PDL working on *all* PDL OS platforms:
@@ -9,13 +9,13 @@ support for 2-D graphics (via PLplot) and 3-D graphics
 
 
 +-------------------------------------------------------+
-|      Candidate Tasks for PDL-2.4.x Development        |
+|       Candidate Tasks for PDL-2.x Development         |
 +-------------------------------------------------------+
 
    This section documents the top level tasks from
    the more detailed list below.  The first column
    of the line indicates the priority of that item
-   (and those below it) for the PDL-2.4.x release:
+   (and those below it) for the PDL-2.x release:
 
      T -- TBD
      R -- required for release to occur
@@ -26,13 +26,13 @@ support for 2-D graphics (via PLplot) and 3-D graphics
   Each item has some task description based on the
   current status.
 
-  Update task list after PDL-2.4.x release.
+  Update task list after PDL-2.x release.
 
   
 
 +-------------------------------------------------------+
 |                                                       |
-|             PDL-2.4.x BULLET TASK LISTING             |
+|              PDL-2.x BULLET TASK LISTING              |
 |                   ( BY CATEGORY )                     |
 |                                                       |
 +-------------------------------------------------------+
@@ -44,7 +44,7 @@ support for 2-D graphics (via PLplot) and 3-D graphics
 +-------------------------------------------------------+
 
 
-   Refactor these PDL tests to use Test::More:
+   Refactor to use Test::More
    * aaa_load.t
    * argtest.t
    * bool.t
@@ -66,9 +66,27 @@ support for 2-D graphics (via PLplot) and 3-D graphics
    * linfit.t
    * magic.t
    * matmult.t
-
-   Convert these PDL tests from Test to Test::More:
-   * basic.t
+   * ones.t
+   * ops.t
+   * pdlchar.t
+   * physical.t
+   * picnorgb.t
+   * picrgb.t
+   * pnm.t
+   * poly.t
+   * polyroots.t
+   * primitive2.t
+   * pthread.t
+   * pthread_auto.t
+   * reduce.t
+   * refs.t
+   * scope.t
+   * segfault.t
+   * thread.t
+   * thread_def.t
+   * vaffine.t
+
+   Convert from Test to Test::More
    * bess.t
    * callext.t
    * conv.t
@@ -79,15 +97,12 @@ support for 2-D graphics (via PLplot) and 3-D graphics
    * func.t
    * hist.t
    * image2d.t
-   * iotypes.t
    * lut.t
    * lvalue.t
    * matrix.t
    * matrixops.t
-   * misc.t
    * niceslice.t
    * nsdatahandle.t
-   * pptest.t
    * requiredmods.t
    * round.t
    * simplex.t
@@ -97,6 +112,7 @@ support for 2-D graphics (via PLplot) and 3-D graphics
 
 
    Need to test PDL build from scratch both WITH_BADVAL and without
+   * Find a way to automate this process for release testing
    * Unix/Linux/BSD
    * Windows
      - cygwin
@@ -115,19 +131,18 @@ support for 2-D graphics (via PLplot) and 3-D graphics
 
    These modules aren't tested by CPAN Testers because of dependencies:
    * PDL::FFTW
-     - FFTW2 is out-of-date and not typically installed
-     - need to migrate to FFTW3
-     - Alien::FFTW
+     - Deprecate PDL::FFTW since it is largely out-of-date and
+       has unresolved bugs with wisdom
+     - Alien::FFTW3 and add PDL::FFTW3
    * PDL::Slatec
    * PDL::Minuit
      - need Fortran compilter and ExtUtils::F77
-     - f2c conversion of code
    * PDL::IO::GD
      - needs libgd
      - Alien::GD
    * PDL::IO::HDF
      - based on HDF4
-     - need to migrate to allow HDF5
+     - Alien::HDF
      - Alien::HDF5
      - add binding to libhdf5
    * PDL::GSL::XXX
@@ -151,6 +166,8 @@ support for 2-D graphics (via PLplot) and 3-D graphics
      - need curses/ncurses
      - Alien::Curses
      - maybe OpenGL terminal or widget
+     - need something lightweight
+     - add support for pdls having >2 dims
 
 
    Add support for Known_problems to tests
@@ -173,15 +190,9 @@ support for 2-D graphics (via PLplot) and 3-D graphics
    * Alien::PLplot
    * Alien::PROJ4
 
-     This is the first step to get PDL::Graphics::PLplot
-     working cross-platform: be able to have the PLplot
-     lib checked for or even installed as a dependency.
-     Work based on the approach in Alien::SDL might be a
-     good starting point.
-
 
    Define standard paths for external dependency libraries for PDL
-   * Local to PDL (not system-wide)
+   * See File::ShareDir::Install and File::ShareDir
    * Can skip install if system-wide is available
    * Relocatable with package-config or Alien info
    * Document any PDL-specific install locations
@@ -202,8 +213,8 @@ support for 2-D graphics (via PLplot) and 3-D graphics
    * Convert PDL::Minuit to use C with f2c of source 
    
 
-   P Fix IO/Browser build to properly check for the curses
-       library and build if available.
+   Fix IO/Browser build to properly check for the curses
+     library and build if available.
 
 
 +-------------------------------------------------------+
@@ -214,7 +225,7 @@ support for 2-D graphics (via PLplot) and 3-D graphics
    
 
    Review current documentation (underway)
-   * Verify correctness and consistency with PDL-2.4.10
+   * Verify correctness and consistency with PDL-2.x
    * Update documentation where needed.
    * Add web searchable versions of the docs.
    * Maybe a wiki format could be used to improve docs 
@@ -236,16 +247,8 @@ support for 2-D graphics (via PLplot) and 3-D graphics
 
 
    Add CPAN shell start-up info to PDL wiki or web page
-   * Basic CPAN
-   * CPANminus
-   * Others
-
-     Recent list queries and new user discussions
-     suggest that we need to revisit the beginner
-     documentation for how to get started with PDL.
-     We definitely need clear instructions for how
-     to start from scratch with cpan to install
-     PDL (verify on all PDL platforms).
+   * CPANminus/perlbrew seems to be best approach
+   - Basic CPAN more complicated
 
 
    Add CPAN Testers start up info to PDL wiki
@@ -265,7 +268,8 @@ support for 2-D graphics (via PLplot) and 3-D graphics
 
    Document how to set up a local sandbox for PDL build
    * INSTALL_BASE for EU::MM > 6.31 and --install_base for M:B 
-   * Build with CPAN shell 
+   * Need to cover adding bin to paths and any library issues
+   * Build with CPAN shell or cpanm
    * Check out brewperl
 
      A number of PDL users are configuring their
@@ -281,12 +285,9 @@ support for 2-D graphics (via PLplot) and 3-D graphics
    
 
    Update PDL Book (in progress)
-   * Needs updating to match PDL-2.4.10 from PDL-2.4.3
+   * Needs updating to match PDL-2.x
    * make a web version available on-line if possible
    
-     Matt Kenworthy has been working on web-izing
-     the previous manuscript based on Tex/LaTeX.
-
 
    Better document the PDL help system
    * Requirements and usage
@@ -302,7 +303,7 @@ support for 2-D graphics (via PLplot) and 3-D graphics
 +-------------------------------------------------------+
    
    Improve PDL usability for first time users
-   * Work out-of-the-box via cpan shell
+   * Work out-of-the-box via cpan[m] shell
      * Fully automatic
      * Semi-manual
    * Easy install via 1-click or package managers 
@@ -321,17 +322,38 @@ support for 2-D graphics (via PLplot) and 3-D graphics
    * Unix OSes: Various package managers
    
 
+   Replace inconsistent minimum and maximum subs in Ufunc
+   by maxover and minover which is consistent with all the
+   other usages:
+
+       average       -> avgover
+       daverage      -> davgover
+       maximum       -> maxover
+       maximum_ind   -> maxover_ind
+       maximum_n_ind -> maxover_n_ind
+       minimum       -> minover
+       minimum_ind   -> minover_ind
+       minimum_n_ind -> minover_n_ind
+       minmaximum    -> minmaxover
+
    
 +-------------------------------------------------------+
 |                    INSTALLATION                       |
 +-------------------------------------------------------+
    
    Switch from ExtUtils::MakeMaker to Module::Build
+   * May be better to go with Module::Install
+     * More flexible
+     * More familiar
+     * Builds faster
    * Removes portability problems from shell and make
    * Easier to extend
 
 
    Fix the test problems with preexisting PDL installs
+   * Add warning if binary api has changed or if there
+       are other dependent PDL modules that would need
+       to be updated.
    * Develop test methodology
    * Add PDL::Core::Dev utility to perform check
    * Automate detection/test skip if not built logic
@@ -357,7 +379,7 @@ support for 2-D graphics (via PLplot) and 3-D graphics
 
    Need PLplot and PDL::Graphics::PLplot to build all platforms
    * MS Windows
-   * Cygwin/XP
+   * Cygwin
    * Linux/unix
    * Mac OS X 
 
@@ -367,12 +389,11 @@ support for 2-D graphics (via PLplot) and 3-D graphics
    * Fix Ctrl-C handling for win32 systems
    * Update documentation
    * See Perldl2/TODO for the pdl2-specific list.
-   * Strip PDL shell prompts from cut-n-pasted lines
 
 
    Add support for 64bit data:
    * Add safe pdl allocation option to prevent OOM death
-   * Update allocation and types to support 64bit data
+   D Update allocation and types to support 64bit data
    * Add info in PDL::Config for level of 64bit support
      (e.g. STRLEN size vs ptrsize...)
    
@@ -407,6 +428,7 @@ support for 2-D graphics (via PLplot) and 3-D graphics
 
   Refactor TriD/PDL for better animation
   * interoperate better with OpenGL display
+  * clean up OO structure and document (use Moo[se])
   * implement pipeline stream to wmpeg
   * stream PDL slice (with no make-physical)
   * add dataflow callback to support display updates
@@ -415,6 +437,9 @@ support for 2-D graphics (via PLplot) and 3-D graphics
   NiceSlice cleanup
   * refactor to use Module::Compile / Filter::Simple
   * implement string processing version for REPL use
+    - .pmc generation via Module::Compile
+    - Smarter parsing via Filter::Simple
+    - Optimize sourcecode filter for speed
   * document nslice
   * implement a niceslice method
   * enhance nslice() to handle CODE refs
@@ -449,21 +474,25 @@ support for 2-D graphics (via PLplot) and 3-D graphics
 
    
    Fix external dependency processing
-   * Use Devel::CheckLib to directly detect headers and libraries
+   * Implement Alien::Base::CheckLib
+     - provides detection part of Alien manifesto
+     - based on Devel::CheckLib to detect headers and libraries
+     - need to be fully cross-platform
    * Remove dependencies on external commands (e.g. clear in Demos)
-   * Make missing functionality detectable at run time (a la PGPLOT)
+   * Make missing functionality detectable at run time
    * Could use warning/error stubs if functionality not available
    * Alien modules for the external PDL dependencies
      * Alien::Curses
-     * Alien::FFTW2
+     * Alien::FFTW
      * Alien::FFTW3
      * Alien::GSL
      * Alien::GD
      * Alien::GLUI
      * Alien::HDF
+     * Alien::HDF5
      * Alien::JPEG
      * Alien::NetPBM
-     * Alien::OpenGL, Alien::GLUT, Alien::GLX
+     * Alien::OpenGL, Alien::GLUT, Alien::GLX, Alien::GLEW
      * Alien::PGPLOT
      * Alien::PNG
      * Alien::TIFF
@@ -485,7 +514,6 @@ support for 2-D graphics (via PLplot) and 3-D graphics
      * Add cleaner use of complex values to FFT routines
    * Make non-inplace versions of FFT
      * Make default FFT library match FFTW calling conventions
-     * But, use symmetric scaling (no factors of N) 
    * Document FFT/FFTW
      * The computational algorithms
      * The input/output locations 
@@ -8,7 +8,7 @@ Last saved: Tue 11 Oct 2011 12:53:55 PM
 =================================================================
 NOTE: These install notes have been partially reviewed
 for the PDL-2.4.9 release.  It is recommended that you
-build and install PDL based on a full cygwin 1.7.9 or
+build and install PDL based on a full cygwin 1.7.17 or
 later install.  Please post to the perldl mailing list
 for help or questions regarding a cygwin install.
 
@@ -81,6 +81,23 @@ and also
 
 
 =================================================================
+               GRAPHICS (non-CORE DISTRIBUTION)
+=================================================================
+These graphics modules are known to work but are not in the
+core PDL distribution.  You'll need to install from CPAN
+separately:
+
+ PDL::Graphics::Gnuplot  Needs the gnuplot executable
+  
+ PDL::Graphics::Prima    Install Prima and PDL::Graphics::Prima
+                         via the cpan shells cpan, cpanm...
+			 Give interactive plotting support and
+			 a full GUI toolkit that can be used to
+			 implement graphical perl/PDL/Prima apps.
+
+
+
+=================================================================
                            NOT WORKING
 =================================================================
 These modules with external dependencies are not yet available
@@ -1,14 +0,0 @@
-Repacked sources:
-Upstream sources contain a debian-directory, which is regularly updated
-from this package.
-In order to have a cleaner separation between upstream and debian package,
-upstreams released tarballs are repacked. the debian repack is marked by
-appending +dfsg to the version string.
-
-
-Patch system:
-This package uses dpatch to manage patches on top of the released
-tarballs, please check /usr/share/doc/dpatch/README.source.gz for details.
-The debian/patches directory within the upstream git repository is usually
-empty, as I commit most patches directly to upstream repositories head. and
-put backports to the released version into the debian/patches directory.
@@ -1,4 +1,76 @@
-pdl (1:2.4.7-1) unstable; urgency=low
+pdl (1:2.4.11-4) unstable; urgency=low
+
+  * fix pdl versioned dep in dh_pdl
+
+ -- Henning Glawe <glaweh@debian.org>  Wed, 30 May 2012 16:06:03 +0200
+
+pdl (1:2.4.11-3) unstable; urgency=low
+
+  * fix the building of pdl wrapper
+  * set -fPIC when compiling fortran extensions
+
+ -- Henning Glawe <glaweh@debian.org>  Mon, 28 May 2012 20:44:46 +0200
+
+pdl (1:2.4.11-2) unstable; urgency=low
+
+  * fix calls to croak in Lib/GIS/Proj/Proj.pd and IO/GD/GD.pd (croak was
+    not called with a format string literal, causing 
+    -Werror=format-security to abort the compilation)
+
+ -- Henning Glawe <glaweh@debian.org>  Sun, 27 May 2012 16:01:22 +0200
+
+pdl (1:2.4.11-1) unstable; urgency=low
+
+  * new upstream release
+  * acknowledge NMU (closes: #670693), thanks to Jari Aalto
+  * switch to 3.0 quilt packaging format, the +dfsg repackaging
+    of upstream source is not needed anymore
+  * provide pdlapi-$version virtual package to keep binary extension
+    modules from breaking silently
+  * introduce dh_pdl providing ${pdl:Depends} for extension packages
+  * use dpkg-buildflags in debian/rules to determine flags
+  * link with --as-needed to avoid spurious dependencies
+  * switch to dh_auto_configure to call EU::MM with the proper flags
+  * read LDFLAGS and FFLAGS in f77conf.pl from env
+  * depend on newer dpkg-dev due to buildflags options
+
+ -- Henning Glawe <glaweh@debian.org>  Sat, 26 May 2012 10:30:55 +0200
+
+pdl (1:2.4.10+dfsg-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Remove deprecated dpatch and upgrade to packaging format "3.0 quilt".
+  * Update to Standards-Version to 3.9.3 and debhelper to 9.
+  * Add build-arch and build-indep targets; use dh_prep in rules file.
+  * Fix copyright-refers-to-symlink-license (Lintian).
+  * Fix duplicate-in-relation-field libastro-fits-header-perl (Lintian).
+  * Fix unused-override (Lintian).
+
+ -- Jari Aalto <jari.aalto@cante.net>  Sat, 28 Apr 2012 08:44:59 +0300
+
+pdl (1:2.4.10+dfsg-1) unstable; urgency=low
+
+  * new upstream release
+  * sync debian/perldl.conf with perldl.conf
+
+ -- Henning Glawe <glaweh@debian.org>  Sun, 19 Feb 2012 10:42:56 +0100
+
+pdl (1:2.4.7+dfsg-2) unstable; urgency=low
+
+  * remove left-over file 'test.log', which slipped into the 1:2.4.7+dfsg-1
+    debian diff
+  * include upstream release notes in deb
+  * fix Pod of PDL::IO::FastRaw
+  * add lintian override: it is OK to have dpatch dependency with an empty
+    patch list. Usually I am adding fixes as dpatch patches, and it is useless
+    to add/remove the dpatch support in case there are no patches for one
+    particular revision.
+  * add a lintian override for a long code line in a manpage, which cannot be
+    easily broken
+
+ -- Henning Glawe <glaweh@debian.org>  Sun, 22 Aug 2010 21:19:32 +0200
+
+pdl (1:2.4.7+dfsg-1) unstable; urgency=low
 
   * new upstream version
     - much improved documentation (closes: #132900)
@@ -1 +1 @@
-7
+9
@@ -2,17 +2,59 @@ Source: pdl
 Section: math
 Priority: optional
 Maintainer: Henning Glawe <glaweh@debian.org>
-Standards-Version: 3.9.1
-Build-Depends: gfortran, x11proto-core-dev, libncurses-dev, perl (>= 5.8.0-3), debhelper (>= 7.0.0), libplplot-dev, libinline-perl (>= 0.43), libgsl0-dev, fftw-dev, dpatch, libxext-dev, libhdf4-alt-dev | libhdf4g-dev, libproj-dev | proj, proj-bin | proj, libgd2-xpm-dev, libastro-fits-header-perl, sharutils, libopengl-perl (>= 0.62), libxi-dev, libxmu-dev, freeglut3-dev, libextutils-f77-perl, netpbm, libdevel-repl-perl (>=1.003011)
+Standards-Version: 3.9.3
+Build-Depends:
+ gfortran,
+ dpkg-dev (>= 1.16.1~),
+ x11proto-core-dev,
+ libncurses-dev,
+ perl (>= 5.8.0-3),
+ debhelper (>= 9),
+ libplplot-dev,
+ libinline-perl (>= 0.43),
+ libgsl0-dev,
+ fftw-dev,
+ libxext-dev,
+ libhdf4-alt-dev | libhdf4g-dev,
+ libproj-dev | proj,
+ proj-bin | proj,
+ libgd2-xpm-dev,
+ libastro-fits-header-perl,
+ sharutils,
+ libopengl-perl (>= 0.65),
+ libxi-dev,
+ libxmu-dev,
+ freeglut3-dev,
+ libextutils-f77-perl,
+ netpbm,
+ libdevel-repl-perl (>=1.003011),
+ libtest-warn-perl
 Homepage: http://pdl.perl.org/
 
 Package: pdl
 Architecture: any
-Depends:  ${perl:Depends}, libterm-readkey-perl, ${shlibs:Depends}, libopengl-perl (>=0.62), ${misc:Depends}
-Recommends: libterm-readline-gnu-perl | libterm-readline-perl-perl
-Suggests: libpgplot-perl, netpbm | imagemagick, libastro-fits-header-perl, libinline-perl, libplplot-dev, doc-base, libextutils-f77-perl, libastro-fits-header-perl, proj-bin | proj, libdevel-repl-perl (>=1.003011)
+Depends:
+ ${perl:Depends},
+ libterm-readkey-perl,
+ ${shlibs:Depends},
+ libopengl-perl (>=0.62),
+ ${misc:Depends}
+Recommends:
+ libterm-readline-gnu-perl | libterm-readline-perl-perl
+Suggests:
+ libpgplot-perl,
+ netpbm | imagemagick,
+ libastro-fits-header-perl,
+ libinline-perl,
+ libplplot-dev,
+ doc-base,
+ libextutils-f77-perl,
+ proj-bin | proj,
+ libdevel-repl-perl (>=1.003011)
 Conflicts: r-pdl
 Replaces: r-pdl
+Provides:
+ ${pdlapi:Provides}
 Description: perl data language: Perl extensions for numerics
  PDL gives standard perl the ability to COMPACTLY
  store and SPEEDILY manipulate the large N-dimensional data arrays 
@@ -71,5 +71,5 @@ Following is the PDL copyright:
   OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 
   On Debian GNU/Linux systems, the complete text of the GNU General
-  Public License can be found in `/usr/share/common-licenses/GPL' and
+  Public License can be found in `/usr/share/common-licenses/GPL-2' and
   the Artistic Licence in `/usr/share/common-licenses/Artistic'.
@@ -0,0 +1,127 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_pdl - calculates pdl dependencies
+
+=cut
+
+use strict;
+use Config;
+use File::Find;
+use Debian::Debhelper::Dh_Lib;
+use PDL::Config::Debian;
+
+=head1 SYNOPSIS
+
+B<dh_pdl> [S<I<debhelper options>>] [B<-d>] [S<I<library dirs ...>>]
+
+=head1 DESCRIPTION
+
+dh_pdl is a debhelper program that is responsible for generating
+the ${pdl:Depends} substitutions and adding them to substvars files.
+
+The program will look at perl scripts and modules in your package,
+and will use this information to generate a dependency on pdl or
+pdlapi. The dependency will be substituted into your package's control
+file wherever you place the token "${pdl:Depends}".
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-V>
+
+By default, scripts and architecture independent modules don't depend
+on any specific version of pdl.  The -V option causes the current
+version of the pdl package to be specified.
+
+=item I<library dirs>
+
+If your package installs perl modules in non-standard
+directories, you can make dh_perl check those directories by passing their
+names on the command line. It will only check the vendorlib and vendorarch
+directories by default.
+
+=back
+
+=head1 CONFORMS TO
+
+Debian policy, version 3.8.3
+
+=cut
+
+init();
+
+my $vendorlib = substr $Config{vendorlib}, 1;
+my $vendorarch = substr $Config{vendorarch}, 1;
+
+# Cleaning the paths given on the command line
+foreach (@ARGV) {
+	s#/$##;
+	s#^/##;
+}
+
+my $pdl = 'pdl';
+my $version;
+
+# dependency types
+use constant PROGRAM   => 1;
+use constant PM_MODULE => 2;
+use constant XS_MODULE => 4;
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+	my $tmp=tmpdir($package);
+
+	# Check also for alternate locations given on the command line
+	my @dirs = grep -d, map "$tmp/$_", $vendorlib, $vendorarch, @ARGV;
+
+	# Look for perl modules and check where they are installed
+	my $deps = 0;
+	find sub {
+		return unless -f;
+		$deps |= PM_MODULE if /\.pm$/;
+		$deps |= XS_MODULE if /\.so$/;
+	}, @dirs if @dirs;
+
+	# find scripts
+	find sub {
+		return unless -f and (-x or /\.pl$/);
+		return if $File::Find::dir=~/\/usr\/share\/doc\//;
+		
+		local *F;
+		return unless open F, $_;
+		if (read F, local $_, 32 and m%^#!\s*(/usr/bin/perl|/usr/bin/env\s+perl)\s%) {
+			$deps |= PROGRAM;
+		}
+		close F;
+	}, $tmp;
+
+	if ($deps) {
+		my $version="";
+		if ($deps & XS_MODULE or $dh{V_FLAG_SET}) {
+			($version) = `dpkg -s $pdl` =~ /^Version:\s*(\S+)/m
+				unless $version;
+			$version = ">= $version";
+		}
+		
+		addsubstvar($package, "pdl:Depends", $pdl, $version);
+
+		# add pdlapi-<ver> for XS modules
+		addsubstvar($package, "pdl:Depends",
+			"pdlapi-$PDL::Config::Debian::pdl_core_version")
+			if $deps & XS_MODULE;
+	}
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+Henning Glawe <glaweh@debian.org>
+
+Based on dh_perl by Brendan O'Dea <bod@debian.org>
+
+=cut
@@ -17,7 +17,10 @@ sub runtime {
   my $libpath = `gfortran -print-libgcc-file-name`;
   $libpath =~ s/libgcc[.]a$//;
   chomp $libpath;
-  "-L$libpath -L/usr/lib -lgcc -lgfortran";
+  my $ldflags = '';
+  $ldflags .= $ENV{LDFLAGS} if (defined $ENV{LDFLAGS});
+  $ldflags .= " -L$libpath -lgcc -lgfortran";
+  return($ldflags);
 }
 
 sub trail_ {
@@ -29,7 +32,10 @@ sub compiler {
 }
 
 sub cflags {
-  return '-O -fPIC';
+  my $fflags = '';
+  $fflags = $ENV{FFLAGS} if (defined $ENV{FFLAGS});
+  $fflags.=' -fPIC';
+  return($fflags);
 }
 
 sub testcompiler {
diff --git a/var/tmp/source/CHM/PDL-2.4.11/PDL-2.4.11/debian/patches/00list b/var/tmp/source/CHM/PDL-2.4.11/PDL-2.4.11/debian/patches/00list
deleted file mode 100644
index e69de29b..00000000
@@ -0,0 +1 @@
+
@@ -2,4 +2,4 @@ BUGS
 Known_problems
 README
 TODO
-
+Release_Notes
@@ -1,2 +1,3 @@
 Doc/scantree.pl usr/lib/perl5/PDL/Doc/
 Doc/mkhtmldoc.pl usr/lib/perl5/PDL/Doc/
+debian/dh_pdl usr/bin
@@ -2,3 +2,8 @@
 #     just does not see it
 pdl: doc-base-file-references-missing-file pdl:12 /var/lib/pdl/html/Index.html
 pdl: doc-base-file-references-missing-file pdl:13 /var/lib/pdl/html/*.html
+# there is one long code line in the manpage, which cannot be broken
+pdl: manpage-has-errors-from-man usr/share/man/man3/PDL::FFT.3pm.gz 215: warning [p 2, 2.0i]: can't break line
+# these two images neeed to be in usr/lib
+pdl: image-file-in-usr-lib usr/lib/perl5/PDL/Transform/Cartography/earth_day.jpg
+pdl: image-file-in-usr-lib usr/lib/perl5/PDL/Transform/Cartography/earth_night.jpg
@@ -0,0 +1 @@
+debian/dh_pdl.1
@@ -1,3 +1,4 @@
+#!/usr/bin/perl
 # -*-perl-*-
  
 # PDL Configuration options
@@ -15,6 +16,16 @@
 
 %PDL_CONFIG = (
 #
+# Version of the perldl.conf file.  This should be incremented
+# in the units for any PDL visible changes to the file (i.e.,
+# the non-comment ones).  Other changes may be indicated by
+# the fractional part but are more for informational purposes.
+#
+        PDL_CONFIG_VERSION => 0.005,
+        PDL_BUILD_VERSION  => undef,    # filled in by Makefile.PL
+        PDL_BUILD_DIR      => undef,    # filled in by Makefile.PL
+
+#
 # Do we generate HTML documentation?  This is normally a good idea,
 # as it's nice to browse -- but many folks don't use it, preferring
 # the man page and/or help versions of the documentation.  Undef or 1
@@ -38,11 +49,13 @@
 
         HIDE_TRYLINK => 1,
 
-# you can set machine specific optimizations here
-# the settings will be passed to the toplevel Makefile.PL
-# which *should* pass it to any recursively invoked ones
+# you can set machine specific optimizations here the settings will be
+# passed to the toplevel Makefile.PL which *should* pass it to any
+# recursively invoked ones.  Add -O0 to turn off compiler
+# optimization, and -g to produce debugging information that GDB and
+# other debuggers can use.
 
-        OPTIMIZE => undef, # '-g',
+        OPTIMIZE => undef, # '-O0 -g',
 
 # Use posix threading to make use of multiprocessor machines
 # undef -> try if possible
@@ -51,6 +64,9 @@
 
         WITH_POSIX_THREADS => undef,    
 
+        POSIX_THREADS_INC  => undef,  # '-I/usr/pthread/include'
+        POSIX_THREADS_LIBS => undef,  # '-L/usr/pthread -lpthreadGC2'
+
         MALLOCDBG => undef,
 # {
 #                       include => '-I/home/csoelle/tmp',
@@ -102,59 +118,21 @@
         USE_POGL => undef,
 #       USE_POGL => 0,
 #
-        POGL_VERSION => 0.63,           # minimum compatible OpenGL version
+        POGL_VERSION => 0.65,           # minimum compatible OpenGL version
 
 #       POGL_WINDOW_TYPE => 'x11',      # use X11+GLX for windows
         POGL_WINDOW_TYPE => 'glut',     # use GLUT for windows
 
-#------------------------------------------------------------------------#
-#  --- NOT USED --- NOT USED --- NOT USED --- NOT USED --- NOT USED ---  #
-#                                                                        #
-# For Mesa 3.2                                                           #
-#       OPENGL_LIBS => '-L/usr/local/Mesa/lib -lGL -lGLU -lXext -lX11',  #
-#                                                                        #
-# Mesa needs -DGL_GLEXT_LEGACY for glPolygonOffsetEXT among others       #
-#       OPENGL_DEFINE => '-DGL_GLEXT_LEGACY',                            #
-#       OPENGL_INC => '-I/usr/include/GL/',                              #
-#                                                                        #
-# For SGI GL                                                             #
-#       OPENGL_LIBS => '-lGL -lGLU -lXext -lX11',                        #
-#       OPENGL_INC => '',                                                #
-#       OPENGL_DEFINE => '',                                             #
-#                                                                        #
-# Let perl try to figure it out                                          #
-#       OPENGL_LIBS => undef,                                            #
-#       OPENGL_INC => undef,                                             #
-#       OPENGL_DEFINE => undef,                                          #
-#                                                                        #
-#  --- NOT USED --- NOT USED --- NOT USED --- NOT USED --- NOT USED ---  #
-#------------------------------------------------------------------------#
-
-#------------------------------------------------------------------------#
-#  --- NOT USED --- NOT USED --- NOT USED --- NOT USED --- NOT USED ---  #
-#                                                                        #
-# The Karma interface has been REMOVED from PDL as of version 2.4.8.     #
-# This is left as a comment for another release or so in case someone    #
-# looks...                                                               #
-#                                                                        #
-# Whether or not to build the Karma interface module                     #
-#                                                                        #
-#       WITH_KARMA => 0,       # Karma interface has been REMOVED        #
-#       WHERE_KARMA => undef,                                            #
-#                                                                        #
-#  --- NOT USED --- NOT USED --- NOT USED --- NOT USED --- NOT USED ---  #
-#------------------------------------------------------------------------#
-
 ## Whether or not to build the PLplot interface module
 #
 # default settings (let PDL build decide whether to build PLPLOT)
 #
-        WITH_PLPLOT          => undef, # Leave it up to PDL to decide
+        WITH_PLPLOT          => 0, # Leave it up to PDL to decide
         WHERE_PLPLOT_LIBS    => undef, # let PDL search for plplot installation
         WHERE_PLPLOT_INCLUDE => undef, # let PDL search for plplot installation
         
 # Example manual settings:
-#    WITH_PLPLOT          => 1,                        # Build PLPLOT interface
+#    WITH_PLPLOT          => 1,                           # Build PLPLOT interface
 #    WHERE_PLPLOT_LIBS    => '/usr/local/plplot/lib',     # PLplot lib dir
 #    WHERE_PLPLOT_INCLUDE => '/usr/local/plplot/include', # PLplot include dir
 
@@ -237,7 +215,7 @@
 #       PROJ_INC => [ 'C:/_32/msys/1.0/local/include'], 
         
 # Do we build PDL::IO::Browser?
-# default -> do not build (module needs to be updated)
+# default -> do not build
 #
         WITH_IO_BROWSER => 0,
 
@@ -264,6 +242,14 @@
 # same name.
 #
         SKIP_KNOWN_PROBLEMS => 0,
+#
+# Set this to make the pdldoc command ignore PDL::AutoLoader
+# routines (*.pdl files in your @PDLLIB path).  While most
+# users will want the new behavior, the performance impact
+# could be noticable.  Setting this to 1 will turn off the
+# new feature.
+#
+        PDLDOC_IGNORE_AUTOLOADER => 0,
 );
 
 1; # Return OK status on 'require'
@@ -10,32 +10,44 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-include /usr/share/dpatch/dpatch.make
 unexport DISPLAY
 
-CFLAGS = -Wall -g
 
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
+	export DEB_CFLAGS_MAINT_APPEND:=-Wall
 else
-	CFLAGS += -O2 -ffunction-sections
+	export DEB_CFLAGS_MAINT_APPEND:=-Wall -ffunction-sections
 endif
 
+export DEB_LDFLAGS_MAINT_APPEND:=-Wl,--as-needed
+
+DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/buildflags.mk
+
+subst_pdlapi  = -Vpdlapi:Provides="`perl -Mblib -MPDL::Config::Debian -e 'print \"pdlapi-$$PDL::Config::Debian::pdl_core_version\n\"'`"
+
 configure: configure-stamp
-configure-stamp: patch-stamp
+configure-stamp:
 	dh_testdir
 	# Add here commands to configure the package
-	PERL_MM_USE_DEFAULT=1 perl Makefile.PL F77CONF=debian/f77conf.pl INSTALLDIRS=vendor PDLCONF=debian/perldl.conf
+	dh_auto_configure -- F77CONF=debian/f77conf.pl PDLCONF=debian/perldl.conf
 
 	touch configure-stamp
 
 
+
+build-arch: build
+build-indep: build
+
 build: build-stamp
 build-stamp: configure-stamp 
 	dh_testdir
 
 	# Add here commands to compile the package.
-	$(MAKE) LD_RUN_PATH="" OPTIMIZE="$(CFLAGS)"
+	$(MAKE) LD_RUN_PATH=""
+	mkdir -p blib/lib/PDL/Config
+	perl -Mblib debian/write_config_debian.pl > blib/lib/PDL/Config/Debian.pm
+	pod2man debian/dh_pdl > debian/dh_pdl.1
 
 	touch build-stamp
 
@@ -50,8 +62,7 @@ test-stamp: build-stamp
 	@echo "END test verbose"
 	touch test-stamp
 
-clean: clean-patched unpatch
-clean-patched:
+clean:
 	dh_testdir
 	dh_testroot
 	rm -f build-stamp configure-stamp test-stamp
@@ -60,10 +71,8 @@ clean-patched:
 
 	# Add here commands to clean up after the build process.
 	[ ! -f Makefile ] || $(MAKE) distclean
-	rm -f t/callext.o t/callext.so Graphics/TriD/OpenGL/tmp*.h-out
-	mkdir -p debian/patches
-	-chmod a-x debian/patches/*
-
+	rm -f t/callext.o t/callext.so Graphics/TriD/OpenGL/tmp*.h-out \
+	 	Perldl2/pdl2.pod debian/dh_pdl.1
 
 install: build test
 	dh_testdir
@@ -87,7 +96,7 @@ binary-indep: build install
 binary-arch: build install
 	dh_testdir
 	dh_testroot
-	[ -f Changes ] && dh_installchangelogs Changes || dh_installchangelogs
+	dh_installchangelogs
 	dh_installdocs
 	dh_installexamples
 	dh_install
@@ -111,7 +120,7 @@ binary-arch: build install
 #	dh_makeshlibs
 	dh_installdeb
 	dh_shlibdeps
-	dh_gencontrol
+	dh_gencontrol -- $(subst_pdlapi)
 	dh_md5sums
 	dh_builddeb
 
@@ -0,0 +1 @@
+3.0 (quilt)
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use PDL;
+use Inline qw{Pdlpp};
+
+my $v = pdl(1)->pdl_core_version()->at(0);
+
+print <<"EOPM";
+package PDL::Config::Debian;
+our \$pdl_core_version = $v;
+1;
+EOPM
+
+__DATA__
+
+__Pdlpp__
+
+pp_def('pdl_core_version',
+	Pars => 'dummy(); int [o] pcv();',
+	Code => '$pcv() = PDL_CORE_VERSION;');
+
+pp_done;
@@ -0,0 +1,10 @@
+package Carp;
+
+# On one line so MakeMaker will see it.
+use Carp;  our $VERSION = $Carp::VERSION;
+
+1;
+
+# Most of the machinery of Carp used to be there.
+# It has been moved in Carp.pm now, but this placeholder remains for
+# the benefit of modules that like to preload Carp::Heavy directly.
@@ -0,0 +1,581 @@
+package Carp;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.20';
+$VERSION = eval $VERSION;
+
+our $MaxEvalLen = 0;
+our $Verbose    = 0;
+our $CarpLevel  = 0;
+our $MaxArgLen  = 64;    # How much of each argument to print. 0 = all.
+our $MaxArgNums = 8;     # How many arguments to print. 0 = all.
+
+require Exporter;
+our @ISA       = ('Exporter');
+our @EXPORT    = qw(confess croak carp);
+our @EXPORT_OK = qw(cluck verbose longmess shortmess);
+our @EXPORT_FAIL = qw(verbose);    # hook to enable verbose mode
+
+# The members of %Internal are packages that are internal to perl.
+# Carp will not report errors from within these packages if it
+# can.  The members of %CarpInternal are internal to Perl's warning
+# system.  Carp will not report errors from within these packages
+# either, and will not report calls *to* these packages for carp and
+# croak.  They replace $CarpLevel, which is deprecated.    The
+# $Max(EvalLen|(Arg(Len|Nums)) variables are used to specify how the eval
+# text and function arguments should be formatted when printed.
+
+our %CarpInternal;
+our %Internal;
+
+# disable these by default, so they can live w/o require Carp
+$CarpInternal{Carp}++;
+$CarpInternal{warnings}++;
+$Internal{Exporter}++;
+$Internal{'Exporter::Heavy'}++;
+
+# if the caller specifies verbose usage ("perl -MCarp=verbose script.pl")
+# then the following method will be called by the Exporter which knows
+# to do this thanks to @EXPORT_FAIL, above.  $_[1] will contain the word
+# 'verbose'.
+
+sub export_fail { shift; $Verbose = shift if $_[0] eq 'verbose'; @_ }
+
+sub _cgc {
+    no strict 'refs';
+    return \&{"CORE::GLOBAL::caller"} if defined &{"CORE::GLOBAL::caller"};
+    return;
+}
+
+sub longmess {
+    # Icky backwards compatibility wrapper. :-(
+    #
+    # The story is that the original implementation hard-coded the
+    # number of call levels to go back, so calls to longmess were off
+    # by one.  Other code began calling longmess and expecting this
+    # behaviour, so the replacement has to emulate that behaviour.
+    my $cgc = _cgc();
+    my $call_pack = $cgc ? $cgc->() : caller();
+    if ( $Internal{$call_pack} or $CarpInternal{$call_pack} ) {
+        return longmess_heavy(@_);
+    }
+    else {
+        local $CarpLevel = $CarpLevel + 1;
+        return longmess_heavy(@_);
+    }
+}
+
+our @CARP_NOT;
+
+sub shortmess {
+    my $cgc = _cgc();
+
+    # Icky backwards compatibility wrapper. :-(
+    local @CARP_NOT = $cgc ? $cgc->() : caller();
+    shortmess_heavy(@_);
+}
+
+sub croak   { die shortmess @_ }
+sub confess { die longmess @_ }
+sub carp    { warn shortmess @_ }
+sub cluck   { warn longmess @_ }
+
+sub caller_info {
+    my $i = shift(@_) + 1;
+    my %call_info;
+    my $cgc = _cgc();
+    {
+        package DB;
+        @DB::args = \$i;    # A sentinel, which no-one else has the address of
+        @call_info{
+            qw(pack file line sub has_args wantarray evaltext is_require) }
+            = $cgc ? $cgc->($i) : caller($i);
+    }
+
+    unless ( defined $call_info{pack} ) {
+        return ();
+    }
+
+    my $sub_name = Carp::get_subname( \%call_info );
+    if ( $call_info{has_args} ) {
+        my @args;
+        if (   @DB::args == 1
+            && ref $DB::args[0] eq ref \$i
+            && $DB::args[0] == \$i ) {
+            @DB::args = ();    # Don't let anyone see the address of $i
+            local $@;
+            my $where = eval {
+                my $func    = $cgc or return '';
+                my $gv      = B::svref_2object($func)->GV;
+                my $package = $gv->STASH->NAME;
+                my $subname = $gv->NAME;
+                return unless defined $package && defined $subname;
+
+                # returning CORE::GLOBAL::caller isn't useful for tracing the cause:
+                return if $package eq 'CORE::GLOBAL' && $subname eq 'caller';
+                " in &${package}::$subname";
+            };
+            $where = defined($where) ? $where : '';
+            @args
+                = "** Incomplete caller override detected$where; \@DB::args were not set **";
+        }
+        else {
+            ## @args = map { Carp::format_arg($_) } @DB::args;
+            for my $db_arg (@DB::args) { push @args, Carp::format_arg($db_arg) };
+        }
+        if ( $MaxArgNums and @args > $MaxArgNums )
+        {    # More than we want to show?
+            $#args = $MaxArgNums;
+            push @args, '...';
+        }
+
+        # Push the args onto the subroutine
+        $sub_name .= '(' . join( ', ', @args ) . ')';
+    }
+    $call_info{sub_name} = $sub_name;
+    return wantarray() ? %call_info : \%call_info;
+}
+
+# Transform an argument to a function into a string.
+sub format_arg {
+    my $arg = shift;
+    if ( ref($arg) ) {
+        $arg = defined($overload::VERSION) ? overload::StrVal($arg) : "$arg";
+    }
+    if ( defined($arg) ) {
+        $arg =~ s/'/\\'/g;
+        $arg = str_len_trim( $arg, $MaxArgLen );
+
+        # Quote it?
+        $arg = "'$arg'" unless $arg =~ /^-?[0-9.]+\z/;
+    }                                    # 0-9, not \d, as \d will try to
+    else {                               # load Unicode tables
+        $arg = 'undef';
+    }
+
+    # The following handling of "control chars" is direct from
+    # the original code - it is broken on Unicode though.
+    # Suggestions?
+    utf8::is_utf8($arg)
+        or $arg =~ s/([[:cntrl:]]|[[:^ascii:]])/sprintf("\\x{%x}",ord($1))/eg;
+    return $arg;
+}
+
+# Takes an inheritance cache and a package and returns
+# an anon hash of known inheritances and anon array of
+# inheritances which consequences have not been figured
+# for.
+sub get_status {
+    my $cache = shift;
+    my $pkg   = shift;
+    $cache->{$pkg} ||= [ { $pkg => $pkg }, [ trusts_directly($pkg) ] ];
+    return @{ $cache->{$pkg} };
+}
+
+# Takes the info from caller() and figures out the name of
+# the sub/require/eval
+sub get_subname {
+    my $info = shift;
+    if ( defined( $info->{evaltext} ) ) {
+        my $eval = $info->{evaltext};
+        if ( $info->{is_require} ) {
+            return "require $eval";
+        }
+        else {
+            $eval =~ s/([\\\'])/\\$1/g;
+            return "eval '" . str_len_trim( $eval, $MaxEvalLen ) . "'";
+        }
+    }
+
+    return ( $info->{sub} eq '(eval)' ) ? 'eval {...}' : $info->{sub};
+}
+
+# Figures out what call (from the point of view of the caller)
+# the long error backtrace should start at.
+sub long_error_loc {
+    my $i;
+    my $lvl = $CarpLevel;
+    {
+        ++$i;
+        my $cgc = _cgc();
+        my $pkg = $cgc ? $cgc->($i) : caller($i);
+        unless ( defined($pkg) ) {
+
+            # This *shouldn't* happen.
+            if (%Internal) {
+                local %Internal;
+                $i = long_error_loc();
+                last;
+            }
+            else {
+
+                # OK, now I am irritated.
+                return 2;
+            }
+        }
+        redo if $CarpInternal{$pkg};
+        redo unless 0 > --$lvl;
+        redo if $Internal{$pkg};
+    }
+    return $i - 1;
+}
+
+sub longmess_heavy {
+    return @_ if ref( $_[0] );    # don't break references as exceptions
+    my $i = long_error_loc();
+    return ret_backtrace( $i, @_ );
+}
+
+# Returns a full stack backtrace starting from where it is
+# told.
+sub ret_backtrace {
+    my ( $i, @error ) = @_;
+    my $mess;
+    my $err = join '', @error;
+    $i++;
+
+    my $tid_msg = '';
+    if ( defined &threads::tid ) {
+        my $tid = threads->tid;
+        $tid_msg = " thread $tid" if $tid;
+    }
+
+    my %i = caller_info($i);
+    $mess = "$err at $i{file} line $i{line}$tid_msg\n";
+
+    while ( my %i = caller_info( ++$i ) ) {
+        $mess .= "\t$i{sub_name} called at $i{file} line $i{line}$tid_msg\n";
+    }
+
+    return $mess;
+}
+
+sub ret_summary {
+    my ( $i, @error ) = @_;
+    my $err = join '', @error;
+    $i++;
+
+    my $tid_msg = '';
+    if ( defined &threads::tid ) {
+        my $tid = threads->tid;
+        $tid_msg = " thread $tid" if $tid;
+    }
+
+    my %i = caller_info($i);
+    return "$err at $i{file} line $i{line}$tid_msg\n";
+}
+
+sub short_error_loc {
+    # You have to create your (hash)ref out here, rather than defaulting it
+    # inside trusts *on a lexical*, as you want it to persist across calls.
+    # (You can default it on $_[2], but that gets messy)
+    my $cache = {};
+    my $i     = 1;
+    my $lvl   = $CarpLevel;
+    {
+        my $cgc = _cgc();
+        my $called = $cgc ? $cgc->($i) : caller($i);
+        $i++;
+        my $caller = $cgc ? $cgc->($i) : caller($i);
+
+        return 0 unless defined($caller);    # What happened?
+        redo if $Internal{$caller};
+        redo if $CarpInternal{$caller};
+        redo if $CarpInternal{$called};
+        redo if trusts( $called, $caller, $cache );
+        redo if trusts( $caller, $called, $cache );
+        redo unless 0 > --$lvl;
+    }
+    return $i - 1;
+}
+
+sub shortmess_heavy {
+    return longmess_heavy(@_) if $Verbose;
+    return @_ if ref( $_[0] );    # don't break references as exceptions
+    my $i = short_error_loc();
+    if ($i) {
+        ret_summary( $i, @_ );
+    }
+    else {
+        longmess_heavy(@_);
+    }
+}
+
+# If a string is too long, trims it with ...
+sub str_len_trim {
+    my $str = shift;
+    my $max = shift || 0;
+    if ( 2 < $max and $max < length($str) ) {
+        substr( $str, $max - 3 ) = '...';
+    }
+    return $str;
+}
+
+# Takes two packages and an optional cache.  Says whether the
+# first inherits from the second.
+#
+# Recursive versions of this have to work to avoid certain
+# possible endless loops, and when following long chains of
+# inheritance are less efficient.
+sub trusts {
+    my $child  = shift;
+    my $parent = shift;
+    my $cache  = shift;
+    my ( $known, $partial ) = get_status( $cache, $child );
+
+    # Figure out consequences until we have an answer
+    while ( @$partial and not exists $known->{$parent} ) {
+        my $anc = shift @$partial;
+        next if exists $known->{$anc};
+        $known->{$anc}++;
+        my ( $anc_knows, $anc_partial ) = get_status( $cache, $anc );
+        my @found = keys %$anc_knows;
+        @$known{@found} = ();
+        push @$partial, @$anc_partial;
+    }
+    return exists $known->{$parent};
+}
+
+# Takes a package and gives a list of those trusted directly
+sub trusts_directly {
+    my $class = shift;
+    no strict 'refs';
+    no warnings 'once';
+    return @{"$class\::CARP_NOT"}
+        ? @{"$class\::CARP_NOT"}
+        : @{"$class\::ISA"};
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Carp - alternative warn and die for modules
+
+=head1 SYNOPSIS
+
+    use Carp;
+
+    # warn user (from perspective of caller)
+    carp "string trimmed to 80 chars";
+
+    # die of errors (from perspective of caller)
+    croak "We're outta here!";
+
+    # die of errors with stack backtrace
+    confess "not implemented";
+
+    # cluck not exported by default
+    use Carp qw(cluck);
+    cluck "This is how we got here!";
+
+=head1 DESCRIPTION
+
+The Carp routines are useful in your own modules because
+they act like die() or warn(), but with a message which is more
+likely to be useful to a user of your module.  In the case of
+cluck, confess, and longmess that context is a summary of every
+call in the call-stack.  For a shorter message you can use C<carp>
+or C<croak> which report the error as being from where your module
+was called.  There is no guarantee that that is where the error
+was, but it is a good educated guess.
+
+You can also alter the way the output and logic of C<Carp> works, by
+changing some global variables in the C<Carp> namespace. See the
+section on C<GLOBAL VARIABLES> below.
+
+Here is a more complete description of how C<carp> and C<croak> work.
+What they do is search the call-stack for a function call stack where
+they have not been told that there shouldn't be an error.  If every
+call is marked safe, they give up and give a full stack backtrace
+instead.  In other words they presume that the first likely looking
+potential suspect is guilty.  Their rules for telling whether
+a call shouldn't generate errors work as follows:
+
+=over 4
+
+=item 1.
+
+Any call from a package to itself is safe.
+
+=item 2.
+
+Packages claim that there won't be errors on calls to or from
+packages explicitly marked as safe by inclusion in C<@CARP_NOT>, or
+(if that array is empty) C<@ISA>.  The ability to override what
+@ISA says is new in 5.8.
+
+=item 3.
+
+The trust in item 2 is transitive.  If A trusts B, and B
+trusts C, then A trusts C.  So if you do not override C<@ISA>
+with C<@CARP_NOT>, then this trust relationship is identical to,
+"inherits from".
+
+=item 4.
+
+Any call from an internal Perl module is safe.  (Nothing keeps
+user modules from marking themselves as internal to Perl, but
+this practice is discouraged.)
+
+=item 5.
+
+Any call to Perl's warning system (eg Carp itself) is safe.
+(This rule is what keeps it from reporting the error at the
+point where you call C<carp> or C<croak>.)
+
+=item 6.
+
+C<$Carp::CarpLevel> can be set to skip a fixed number of additional
+call levels.  Using this is not recommended because it is very
+difficult to get it to behave correctly.
+
+=back
+
+=head2 Forcing a Stack Trace
+
+As a debugging aid, you can force Carp to treat a croak as a confess
+and a carp as a cluck across I<all> modules. In other words, force a
+detailed stack trace to be given.  This can be very helpful when trying
+to understand why, or from where, a warning or error is being generated.
+
+This feature is enabled by 'importing' the non-existent symbol
+'verbose'. You would typically enable it by saying
+
+    perl -MCarp=verbose script.pl
+
+or by including the string C<-MCarp=verbose> in the PERL5OPT
+environment variable.
+
+Alternately, you can set the global variable C<$Carp::Verbose> to true.
+See the C<GLOBAL VARIABLES> section below.
+
+=head1 GLOBAL VARIABLES
+
+=head2 $Carp::MaxEvalLen
+
+This variable determines how many characters of a string-eval are to
+be shown in the output. Use a value of C<0> to show all text.
+
+Defaults to C<0>.
+
+=head2 $Carp::MaxArgLen
+
+This variable determines how many characters of each argument to a
+function to print. Use a value of C<0> to show the full length of the
+argument.
+
+Defaults to C<64>.
+
+=head2 $Carp::MaxArgNums
+
+This variable determines how many arguments to each function to show.
+Use a value of C<0> to show all arguments to a function call.
+
+Defaults to C<8>.
+
+=head2 $Carp::Verbose
+
+This variable makes C<carp> and C<croak> generate stack backtraces
+just like C<cluck> and C<confess>.  This is how C<use Carp 'verbose'>
+is implemented internally.
+
+Defaults to C<0>.
+
+=head2 @CARP_NOT
+
+This variable, I<in your package>, says which packages are I<not> to be
+considered as the location of an error. The C<carp()> and C<cluck()>
+functions will skip over callers when reporting where an error occurred.
+
+NB: This variable must be in the package's symbol table, thus:
+
+    # These work
+    our @CARP_NOT; # file scope
+    use vars qw(@CARP_NOT); # package scope
+    @My::Package::CARP_NOT = ... ; # explicit package variable
+
+    # These don't work
+    sub xyz { ... @CARP_NOT = ... } # w/o declarations above
+    my @CARP_NOT; # even at top-level
+
+Example of use:
+
+    package My::Carping::Package;
+    use Carp;
+    our @CARP_NOT;
+    sub bar     { .... or _error('Wrong input') }
+    sub _error  {
+        # temporary control of where'ness, __PACKAGE__ is implicit
+        local @CARP_NOT = qw(My::Friendly::Caller);
+        carp(@_)
+    }
+
+This would make C<Carp> report the error as coming from a caller not
+in C<My::Carping::Package>, nor from C<My::Friendly::Caller>.
+
+Also read the L</DESCRIPTION> section above, about how C<Carp> decides
+where the error is reported from.
+
+Use C<@CARP_NOT>, instead of C<$Carp::CarpLevel>.
+
+Overrides C<Carp>'s use of C<@ISA>.
+
+=head2 %Carp::Internal
+
+This says what packages are internal to Perl.  C<Carp> will never
+report an error as being from a line in a package that is internal to
+Perl.  For example:
+
+    $Carp::Internal{ (__PACKAGE__) }++;
+    # time passes...
+    sub foo { ... or confess("whatever") };
+
+would give a full stack backtrace starting from the first caller
+outside of __PACKAGE__.  (Unless that package was also internal to
+Perl.)
+
+=head2 %Carp::CarpInternal
+
+This says which packages are internal to Perl's warning system.  For
+generating a full stack backtrace this is the same as being internal
+to Perl, the stack backtrace will not start inside packages that are
+listed in C<%Carp::CarpInternal>.  But it is slightly different for
+the summary message generated by C<carp> or C<croak>.  There errors
+will not be reported on any lines that are calling packages in
+C<%Carp::CarpInternal>.
+
+For example C<Carp> itself is listed in C<%Carp::CarpInternal>.
+Therefore the full stack backtrace from C<confess> will not start
+inside of C<Carp>, and the short message from calling C<croak> is
+not placed on the line where C<croak> was called.
+
+=head2 $Carp::CarpLevel
+
+This variable determines how many additional call frames are to be
+skipped that would not otherwise be when reporting where an error
+occurred on a call to one of C<Carp>'s functions.  It is fairly easy
+to count these call frames on calls that generate a full stack
+backtrace.  However it is much harder to do this accounting for calls
+that generate a short message.  Usually people skip too many call
+frames.  If they are lucky they skip enough that C<Carp> goes all of
+the way through the call stack, realizes that something is wrong, and
+then generates a full stack backtrace.  If they are unlucky then the
+error is reported from somewhere misleading very high in the call
+stack.
+
+Therefore it is best to avoid C<$Carp::CarpLevel>.  Instead use
+C<@CARP_NOT>, C<%Carp::Internal> and C<%Carp::CarpInternal>.
+
+Defaults to C<0>.
+
+=head1 BUGS
+
+The Carp routines don't handle exception objects currently.
+If called with a first argument that is a reference, they simply
+call die() or warn(), as appropriate.
+
@@ -6,7 +6,8 @@ Devel::CheckLib;
 use 5.00405; #postfix foreach
 use strict;
 use vars qw($VERSION @ISA @EXPORT);
-$VERSION = '0.95';
+$VERSION = '0.98';
+$VERSION = eval $VERSION;
 use Config qw(%Config);
 use Text::ParseWords 'quotewords';
 
@@ -214,7 +215,7 @@ sub assert_lib {
         }
     }
 
-    my @cc = _findcc();
+    my ($cc, $ld) = _findcc();
     my @missing;
     my @wrongresult;
     my @use_headers;
@@ -236,21 +237,25 @@ sub assert_lib {
         if ( $Config{cc} eq 'cl' ) {                 # Microsoft compiler
             require Win32;
             @sys_cmd = (
-                @cc,
+                @$cc,
                 $cfile,
                 "/Fe$exefile",
-                (map { '/I'.Win32::GetShortPathName($_) } @incpaths)
+                (map { '/I'.Win32::GetShortPathName($_) } @incpaths),
+		"/link",
+		@$ld
             );
         } elsif($Config{cc} =~ /bcc32(\.exe)?/) {    # Borland
             @sys_cmd = (
-                @cc,
+                @$cc,
+                @$ld,
                 (map { "-I$_" } @incpaths),
                 "-o$exefile",
                 $cfile
             );
         } else { # Unix-ish: gcc, Sun, AIX (gcc, cc), ...
             @sys_cmd = (
-                @cc,
+                @$cc,
+                @$ld,
                 $cfile,
                 (map { "-I$_" } @incpaths),
                 "-o", "$exefile"
@@ -283,32 +288,35 @@ sub assert_lib {
             } @libpaths; 
             # this is horribly sensitive to the order of arguments
             @sys_cmd = (
-                @cc,
+                @$cc,
                 $cfile,
                 "${lib}.lib",
                 "/Fe$exefile", 
                 (map { '/I'.Win32::GetShortPathName($_) } @incpaths),
                 "/link",
+                @$ld,
                 (map {'/libpath:'.Win32::GetShortPathName($_)} @libpaths),
             );
         } elsif($Config{cc} eq 'CC/DECC') {          # VMS
         } elsif($Config{cc} =~ /bcc32(\.exe)?/) {    # Borland
             @sys_cmd = (
-                @cc,
+                @$cc,
+                @$ld,
                 "-o$exefile",
-                "-l$lib",
                 (map { "-I$_" } @incpaths),
                 (map { "-L$_" } @libpaths),
+                "-l$lib",
                 $cfile);
         } else {                                     # Unix-ish
                                                      # gcc, Sun, AIX (gcc, cc)
             @sys_cmd = (
-                @cc,
+                @$cc,
+                @$ld,
                 $cfile,
                 "-o", "$exefile",
-                "-l$lib",
                 (map { "-I$_" } @incpaths),
-                (map { "-L$_" } @libpaths)
+                (map { "-L$_" } @libpaths),
+                "-l$lib",
             );
         }
         warn "# @sys_cmd\n" if $args{debug};
@@ -347,16 +355,25 @@ sub _cleanup_exe {
     return
 }
     
+# return ($cc, $ld)
+# where $cc is an array ref of compiler name, compiler flags
+# where $ld is an array ref of linker flags
 sub _findcc {
     # Need to use $keep=1 to work with MSWin32 backslashes and quotes
-    my @Config_ccflags_ldflags =  @Config{qw(ccflags ldflags)};  # use copy so ASPerl will compile
-    my @flags = grep { length } map { quotewords('\s+', 1, $_ || ()) } @Config_ccflags_ldflags;
+    my $Config_ccflags =  $Config{ccflags};  # use copy so ASPerl will compile
+    my @Config_ldflags = ();
+    for my $config_val ( @Config{qw(ldflags perllibs)} ){
+        push @Config_ldflags, $config_val if ( $config_val =~ /\S/ );
+    }
+    my @ccflags = grep { length } quotewords('\s+', 1, $Config_ccflags||'');
+    my @ldflags = grep { length } quotewords('\s+', 1, @Config_ldflags);
     my @paths = split(/$Config{path_sep}/, $ENV{PATH});
     my @cc = split(/\s+/, $Config{cc});
-    return (@cc, @flags) if -x $cc[0];
+    return ( [ @cc, @ccflags ], \@ldflags ) if -x $cc[0];
     foreach my $path (@paths) {
         my $compiler = File::Spec->catfile($path, $cc[0]) . $Config{_exe};
-        return ($compiler, @cc[1 .. $#cc], @flags) if -x $compiler;
+        return ([ $compiler, @cc[1 .. $#cc], @ccflags ], \@ldflags)
+            if -x $compiler;
     }
     die("Couldn't find your C compiler\n");
 }
@@ -25,17 +25,17 @@ print FOO <<'nosubs';
 #include <sys/types.h>
 #include <sys/wait.h>
 
-main(int argc, char **argv) {
+int main(int argc, char **argv) {
   char perldl[BUFSIZ];
   int pipes[2];
   int pid,i;
   int status;
 
-  if(pipe(pipes)) {perror; exit(1);}
+  if(pipe(pipes)) {perror("pdl (perldl spawn wrapper)"); exit(1);}
   pid = fork();
   if(pid==0) {
     dup2(pipes[1],1);
-    dup2(pipes[2],2);
+    dup2(pipes[1],2);
     system("which perldl");
     exit(0);
   }
@@ -56,7 +56,7 @@ $|++;
 use PDL::Config;
 
 BEGIN {
-   if ( not defined $PDL::Config{PDLDOC_IGNORE_AUTOLOADER} ) {
+   if ( not $PDL::Config{PDLDOC_IGNORE_AUTOLOADER} ) {
       require PDL::AutoLoader;
    }
 }
@@ -40,7 +40,7 @@ print OUT <<'!NO!SUBS!';
 
 use vars qw($VERSION $HOME $Modules);
 
-$VERSION = '1.354_001';
+$VERSION = '1.357';
 
 print "perlDL shell v$VERSION
  PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
@@ -56,6 +56,7 @@ $PERLDL::MULTI = 1;             # Enable multi-lines by default
 $PERLDL::NO_EOF = 0;            # Disable EOF protection by default
 $PERLDL::NO_EOF = 1 if $^O =~ 'MSWin';  # ...but enable for windows 
 $PERLDL::PROMPT = "pdl> ";
+$PERLDL::PREFIX_RE = qr(^\s*(?:pdl|perldl)>\s*); # RE for shell prompts
 $PERLDL::PAGER  = (exists $ENV{PAGER} ? $ENV{PAGER} : 'more');
 				# Default output paging program
 $PERLDL::PAGE   = 0;
@@ -125,6 +126,10 @@ my $read_from_file;
 
 while(defined($_ = shift @ARGV)) {
 	if($_ eq "-tk") {
+                if ($^O eq 'MSWin32') {
+                   print "-tk option not supported for windows\n";
+                   next;
+                }
 		print "Using Tk";
 		eval "use Tk;";
                 if ($@ eq "") {
@@ -135,6 +140,10 @@ while(defined($_ = shift @ARGV)) {
                 }
 		next;
         } elsif($_ eq "-glut") {
+                if ($^O eq 'MSWin32') {
+                   print "-glut option not supported for windows\n";
+                   next;
+                }
 		print "Using OpenGL for GLUT support";
 		eval "use OpenGL;";
                 if ($@ eq "") {
@@ -192,9 +201,9 @@ while(defined($_ = shift @ARGV)) {
             print << 'EOP';
 Usage: perldl [options]
   -glut       try to load OpenGL module (Enables
-              readline event-loop processing).
+                readline event-loop processing).
   -tk         try to load Tk module (Enables
-              readline event-loop processing).
+                readline event-loop processing).
   -f <file>   execute file <file> before starting perldl
   -w          run with warning messages turned-on 
   -m <module> unload module <module>
@@ -252,17 +261,49 @@ push @enabled,"MultiLines" if $multi_ok;
 print join(', ',@enabled)," enabled\n" if @enabled > 0;
 
 if ( $readlines ){
-    $PERLDL::TERM = new Term::ReadLine 'perlDL', \*STDIN, \*STDOUT ;
-    if(defined &OpenGL::done_glutInit ) {
-    	# Attempt to use with FreeGLUT
-        if(${$PERLDL::TERM->Features}{glutRunning}) {
-		print "Using FreeGLUT event loop\n";
-		$PERLDL::TERM->glutRunning(1);
-	} else {
-		warn("Sorry, cannot use FreeGLUT with this version of ReadLine\n");
-	}
+
+   $PERLDL::TERM = Term::ReadLine->new('perlDL', \*STDIN, \*STDOUT);
+
+    if (defined &OpenGL::done_glutInit ) {
+       # Attempt to use with FreeGLUT
+       if ($PERLDL::TERM->can('event_loop')) {
+          print "Using FreeGLUT event loop\n";
+          # Presumably, if you're using this loop, you're also selecting on other
+          # fileno's.  It is up to you to add that in to the wait callback (first
+          # one passed to event_loop) and deal with those file handles.
+    
+          $PERLDL::TERM->event_loop(
+             sub {
+                # This callback is called every time T::RL wants to
+                # read something from its input.  The parameter is
+                # the return from the other callback.
+                my $fileno = shift;
+                my $rvec = '';
+                vec($rvec, $fileno, 1) = 1;
+                while(1) {
+                   select my $rout = $rvec, undef, undef, 0;
+                   last if vec($rout, $fileno, 1);
+                   OpenGL::glutMainLoopEvent();
+                }
+             },
+             sub {
+                # This callback is called as the T::RL is starting up
+                # readline the first time.  The parameter is the file
+                # handle that we need to monitor.  The return value
+                # is used as input to the previous callback.
+    
+                # We return the fileno that we will use later.
+    
+                # cygwin/TRL::Gnu seems to use some other object here
+                # that doesn't respond to a fileno method call (rt#81344)
+                fileno($_[0]);
+             }
+          ) unless $Term::ReadLine::toloop;
+       } else {
+          warn("Sorry, cannot use FreeGLUT with this version of ReadLine\n");
+       }
     }
-    if(defined &Tk::DoOneEvent) {
+    if(defined &Tk::DoOneEvent and not ref $Term::ReadLine::toloop) {
     	# Attempt to use with Tk
         if(${$PERLDL::TERM->Features}{tkRunning}) {
 		print "Using Tk event loop\n";
@@ -288,7 +329,7 @@ sub END {
     my @a= $PERLDL::TERM->GetHistory() if $PERLDL::TERM->can('GetHistory');
 
     $#a-- if $a[-1] =~ /^(q$|x$|\s*exit\b|\s*quit\b)/; # chop off the exit command
-    @a= @a[($#a-$PERLDL::HISTFILESIZE)..($#a)] if $#a > $PERLDL::HISTFILESIZE ;
+    @a= @a[($#a-$PERLDL::HISTFILESIZE+1)..($#a)] if $#a > $PERLDL::HISTFILESIZE-1 ;
     if( open HIST, ">$HOME/.perldl_hist" ) {
 	print HIST join("\n",@a);
 	close HIST;
@@ -405,7 +446,9 @@ my %demos =
      'bad' => 'PDL::Demos::BAD_demo',
      'bad2' => 'PDL::Demos::BAD2_demo',
      'transform' => 'PDL::Demos::Transform_demo',
-     'cartography' => 'PDL::Demos::Cartography_demo'
+     'cartography' => 'PDL::Demos::Cartography_demo',
+     'gnuplot' => 'PDL::Demos::Gnuplot_demo',
+     'prima' => 'PDL::Demos::Prima',
      );
 
 sub demo {
@@ -422,6 +465,9 @@ Use:
    demo pgplot      # PGPLOT graphics output (Req.: PGPLOT)
    demo OOplot      # PGPLOT OO interface    (Req.: PGPLOT)
 
+   demo gnuplot     # Gnuplot graphics (requires PDL::Graphics::Gnuplot)
+   demo prima       # Prima graphics (requires PDL::Graphics::Prima)
+
    demo transform   # Coordinate transformations (Req.: PGPLOT)
    demo cartography # Cartographic projections (Req.: PGPLOT)
 
@@ -597,6 +643,13 @@ sub process_input {
       my $mess = eval_and_report($c);
       warn $mess if $mess;
   }
+
+  # Filter out PDL shell prefixes from cut-n-pasted lines
+  if ( $lines =~ s/$PERLDL::PREFIX_RE// and $readlines ) {
+     my @hist = $PERLDL::TERM->GetHistory();
+     foreach my $entry (@hist) { $entry =~ s/$PERLDL::PREFIX_RE//; }
+     $PERLDL::TERM->SetHistory(@hist);
+  }
   
   if(!defined $lines || lc $lines eq 'q' || lc $lines eq 'x' || lc $lines eq 'quit') {exit};
   next if $lines =~/^\s*$/; # Blank line - do nothing
@@ -693,9 +746,11 @@ sub eval_and_report {
 EOD
 ;
 
-  %@ = (); # Workaround to prevent spurious loss of $@
-  PDL::Core::myeval( $__coderef )  # Do command with $@ keeping
-    unless($@);  # Check that sub compiled (avoids null coderef bug in myeval).
+  %@ = (); # Workaround to prevent spurious loss of $@ in early (pre-5.14 anyway) versions of perl
+
+  if( (!$@) and (ref $__coderef eq 'CODE')) { 
+      eval { &$__coderef(); die $@ if($@); };
+  }
 
   if ($@) {
       my $mess = $@;
@@ -957,11 +1012,17 @@ prompt.  They are:
 
 =over 4
 
+=item -glut
+
+Load OpenGL when starting the shell (the perl OpenGL module,
+which is available from CPAN must be installed).  This enables
+readline event loop processing.  Don't use with -tk.
+
 =item -tk
 
 Load Tk when starting the shell (the perl Tk module, which is
-available from CPAN must be installed). This enables readline
-event loop processing.
+available from CPAN must be installed).  This enables readline
+event loop processing.  Don't use with -glut.
 
 =item -f file
 
@@ -49,11 +49,13 @@
 
         HIDE_TRYLINK => 1,
 
-# you can set machine specific optimizations here
-# the settings will be passed to the toplevel Makefile.PL
-# which *should* pass it to any recursively invoked ones
+# you can set machine specific optimizations here the settings will be
+# passed to the toplevel Makefile.PL which *should* pass it to any
+# recursively invoked ones.  Add -O0 to turn off compiler
+# optimization, and -g to produce debugging information that GDB and
+# other debuggers can use.
 
-        OPTIMIZE => undef, # '-g',
+        OPTIMIZE => undef, # '-O0 -g',
 
 # Use posix threading to make use of multiprocessor machines
 # undef -> try if possible
@@ -116,7 +118,7 @@
         USE_POGL => undef,
 #       USE_POGL => 0,
 #
-        POGL_VERSION => 0.65,           # minimum compatible OpenGL version
+        POGL_VERSION => 0.6702,           # minimum compatible OpenGL version
 
 #       POGL_WINDOW_TYPE => 'x11',      # use X11+GLX for windows
         POGL_WINDOW_TYPE => 'glut',     # use GLUT for windows
@@ -125,7 +127,7 @@
 #
 # default settings (let PDL build decide whether to build PLPLOT)
 #
-        WITH_PLPLOT          => undef, # Leave it up to PDL to decide
+        WITH_PLPLOT          => 0, # Leave it up to PDL to decide
         WHERE_PLPLOT_LIBS    => undef, # let PDL search for plplot installation
         WHERE_PLPLOT_INCLUDE => undef, # let PDL search for plplot installation
         
@@ -169,18 +171,13 @@
         GSL_INC => undef, # use gsl-config
 
 # Whether or not to build the PDL::FFTW module
-# false -> don't use
-# true -> force use
+# NOTE:  PDL::FFTW has been moved to its own CPAN
+#        distribution and has been deprecated.
+#        Please install from CPAN.
 
-        WITH_FFTW => undef,    # Leave it up to PDL to decide
-        
-# Location to search for the FFTW libs
+        WITH_FFTW => 0,        # Don't build PDL::FFTW
         FFTW_LIBS => undef,    # [ '/lib','/usr/lib','/usr/local/lib'],
-
-# Location to find FFTW includes:
         FFTW_INC => undef,     # ['/usr/include/','/usr/local/include'],
-
-# FFTW Numeric Precision Type to link in: (double or single precision)
         FFTW_TYPE => 'double',
 
 # Whether or not to build the PDL::IO::HDF module
@@ -18,32 +18,37 @@ sub ok {
 #         return $d < 0.01;
 # }
 
+
 sub eprint {
 	print "EXPECT ERROR NEXT:\n-----\n";
 	print $_[0];
 	print "-----\n";
 }
 
-print "1..3\n";
+print "1..4\n";
 
 $b=pdl([1,2,3])->long;
 $a=[1,2,3];
 eval 'PDL::Ufunc::sumover($a,$b)';
 
-eprint $@;
+ok(1,!$@);
 
-ok(1,$@ =~ /Error - tried to use an unknown/);
+$aa=3;
+$a=\$aa;
+eval 'PDL::Ufunc::sumover($a,$b)';
+eprint $@;
+ok(2,$@ =~ /Error - tried to use an unknown/);
 
 eval { PDL::Ufunc::sumover({}) };
 eprint $@;
 
-ok 2, $@ =~ /Hash given as a pdl - but not {PDL} key/;
+ok 3, $@ =~ /Hash given as a pdl - but not \{PDL} key/;
 
 
 $c = 0;
 eval { PDL::Ufunc::sumover(\$c) };
 eprint $@;
 
-ok 3, $@ =~ /Error - tried to use an unknown/;
+ok 4, $@ =~ /Error - tried to use an unknown/;
 
 
@@ -1,10 +1,10 @@
 # -*-perl-*-
 
 use strict;
-use Test;
+use Test::More;
 
 BEGIN {
-    plan tests => 6;
+    plan tests => 19;
 }
 
 use PDL::LiteF;
@@ -18,29 +18,55 @@ sub tapprox {
 # test rvals
 #  synonym for centre/center
 #  squared option
-#
+#  (x|y|z)(lin|log)vals, axisvals
 
 my $x0 = pdl( [ 2, 1, 2 ], [ 1, 0, 1 ], [ 2, 1, 2 ] );
 
 my $a1 = rvals(3,3);
-print "\na1: $a1\n";
-ok( tapprox( $x0->sqrt, $a1 ), 1 ); # 1
+#print "\na1: $a1\n";
+ok( tapprox( $x0->sqrt, $a1 ), "centered rvals" ); # 1
 
 my $a2 = rvals(3,3,{squared=>1});
-print "\na2: $a2\n";
-ok( tapprox( $x0, $a2 ), 1 ); # 2
+#print "\na2: $a2\n";
+ok( tapprox( $x0, $a2 ), "centered rvals squared" ); # 2
 
 my $x1 = pdl( [ 8, 5, 4 ], [ 5, 2, 1 ], [ 4, 1, 0 ] );
 
 my $a3 = rvals(3,3,{centre=>[2,2]});
-print "\na3: $a3\n";
-ok( tapprox( $x1->sqrt, $a3 ), 1 ); # 3
+#print "\na3: $a3\n";
+ok( tapprox( $x1->sqrt, $a3 ), "non-centered rvals" ); # 3
 
 my $a4 = rvals(3,3,{center=>[2,2]});
-print "\na4: $a4\n";
-ok( tapprox( $x1->sqrt, $a4 ), 1 ); # 4
+#print "\na4: $a4\n";
+ok( tapprox( $x1->sqrt, $a4 ), "centre/center synonyms" ); # 4
 
-ok( tapprox( $x1->sqrt, rvals(3,3,{ceNteR=>[2,2]}) ), 1 ); # 5
+ok( tapprox( $x1->sqrt, rvals(3,3,{ceNteR=>[2,2]}) ), "ceNteR option capitalization" ); # 5
 
-ok( tapprox( $x1, rvals(3,3,{center=>[2,2],squared=>1}) ), 1 ); # 6
+ok( tapprox( $x1, rvals(3,3,{center=>[2,2],squared=>1}) ), "both center and squared options" ); # 6
 
+# test (x|y|z)(lin|log)vals: shape and values
+my $a=zeroes(101,51,26);
+my $x = $a->xlinvals(0.5,1.5);
+my $y = $a->ylinvals(-2,-1);
+my $z = $a->zlinvals(-3,2);
+ok(all($a->shape==$x->shape), "xlinvals shape"); #7
+ok(all($a->shape==$y->shape), "ylinvals shape"); #8
+ok(all($a->shape==$z->shape), "zlinvals shape"); #9
+ok(tapprox($x->uniqvec->flat,pdl(50..150)/100),"xlinvals values"); #10
+ok(tapprox($y->mv(1,0)->uniqvec->flat,pdl(-100..-50)/50),"ylinvals values"); #11
+ok(tapprox($z->mv(2,0)->uniqvec->flat,pdl(0..25)/5-3),"zlinvals values"); #12
+
+my $a = zeroes(11,6,8);
+my $xl = $a->xlogvals(1e2,1e12);
+my $yl = $a->ylogvals(1e-3,1e2);
+my $zl = $a->zlogvals(1e-10,1e-3);
+ok(all($a->shape==$xl->shape),"xlogvals shape"); #13
+ok(all($a->shape==$yl->shape),"ylogvals shape"); #14
+ok(all($a->shape==$zl->shape),"zlogvals shape"); #15
+ok(tapprox($xl->uniqvec->flat->log10,pdl(2..12)),"xlogvals values"); #16
+ok(tapprox($yl->mv(1,0)->uniqvec->flat->log10,pdl(-3..2)),"ylogvals values"); #17
+ok(tapprox($zl->mv(2,0)->uniqvec->flat->log10,pdl(-10..-3)),"zlogvals values");#18
+
+#test axisvals
+my $z = axisvals(zeroes(3,4,5,6),3);
+ok(all($z==pdl(0..5)->dummy(0,5)->dummy(0,4)->dummy(0,3)),"4-dimensional axisvals");#19
@@ -74,7 +74,7 @@ DLLEXPORT int loglog_ext(int nargs, pdlsimple **args) {
 
    /* Now do the buisness! */
 
-   loglog_doit( (float*) x->data, (float*) y->data, x->nvals);
+   loglog_doit( (float*) x->data, (float*) y->data, (int) x->nvals);
 
    return(1);  /* Success! */
 }
@@ -1,5 +1,8 @@
 #!/usr/local/bin/perl
 
+END { unlink 't/callext.pdb';}; # In case we build a 2nd time,
+                                # but using a different Microsoft compiler
+
 # Example of how to use callext() - also see callext.c
 
 use strict;
@@ -26,7 +29,8 @@ sub tapprox {
 
 # Create the filenames
 my $cfile = File::Spec->catfile('t', 'callext.c');
-my $inc   = File::Spec->catdir('Basic', 'Core');
+# include the pdlsimple.h that's in blib.
+my $inc = File::Spec->catdir('blib', 'lib', 'PDL', 'Core');
 my $out   = File::Spec->catfile('t', 'callext.'.$Config{dlext});
 
 # Compile the code
@@ -66,7 +70,7 @@ sub loglog {
    print "X = $x\n";
    print "Y = $y\n";
 
-   my $ldfile = 
+   my $ldfile =
    callext($out, "loglog_ext", $ret, $y);
 
    return $ret;
@@ -3,7 +3,7 @@ use PDL::Complex;
 use PDL::Config;
 
 BEGIN {
-   use Test::More tests => 13;
+   use Test::More tests => 17;
 }
 
 sub tapprox {
@@ -15,8 +15,9 @@ sub tapprox {
 
 $ref = pdl([[-2,1],[-3,1]]);
 $a = i - pdl(2,3);
+
 ok(ref $a eq PDL::Complex, 'type promotion i - piddle');
-ok(tapprox($a->real,$ref), 'value from i - piddile');
+ok(tapprox($a->real,$ref), 'value from i - piddle');
 
 $a = pdl(2,3) - i;
 ok(ref $a eq PDL::Complex, 'type promption piddle - i');
@@ -49,6 +50,25 @@ $b = $a->copy + 1;
 my $bigArray = $a->cat($b);
 ok(abs($bigArray->sum() +  8 - 4*i) < .0001, 'check cat for PDL::Complex');
 
+my $z = pdl(0) + i*pdl(0);
+$z **= 2;
+
+ok($z->at(0) == 0 && $z->at(1) == 0, 'check that 0 +0i exponentiates correctly'); # Wasn't always so.
+
+my $zz = $z ** 0;
+
+ok($zz->at(0) == 1 && $zz->at(1) == 0, 'check that 0+0i ** 0 is 1+0i');
+
+$z **= $z;
+
+ok($z->at(0) == 1 && $z->at(1) == 0, 'check that 0+0i ** 0+0i is 1+0i');
+
+my $r = pdl(-10) + i*pdl(0);
+$r **= 2;
+
+ok($r->at(0) < 100.000000001 && $r->at(0) > 99.999999999 && $r->at(1) == 0,
+  'check that imaginary part is exactly zero'); # Wasn't always so
+
 TODO: {
    local $TODO = "Known_problems sf.net bug #1176614" if ($PDL::Config{SKIP_KNOWN_PROBLEMS} or exists $ENV{SKIP_KNOWN_PROBLEMS} );
 
@@ -4,7 +4,7 @@
 #
 
 use strict;
-use Test::More tests => 51;
+use Test::More tests => 56;
 
 BEGIN {
     # if we've got this far in the tests then 
@@ -77,6 +77,10 @@ ok all( $a == 2 ), "dataflow";
 
 isa_ok( PDL->topdl(1),       "PDL", "topdl(1) returns a piddle" );
 isa_ok( PDL->topdl([1,2,3]), "PDL", "topdl([1,2,3]) returns a piddle" );
+isa_ok( PDL->topdl(1,2,3),   "PDL", "topdl(1,2,3) returns a piddle" );
+$a=PDL->topdl(1,2,3);
+ok (($a->nelem == 3  and  all($a == pdl(1,2,3))), "topdl(1,2,3) returns a 3-piddle containing (1,2,3)");
+
 
 # test $PDL::undefval support in pdl (bug #886263)
 #
@@ -184,6 +188,12 @@ like($@, qr/\(argument 1\)/,
 	'cat properly identifies the first actual piddle in combined screw-ups');
 $@ = '';
 
+eval {$a = cat(pdl(1),pdl(2,3));};
+ok(!$@, 'cat(pdl(1),pdl(2,3)) succeeds');
+ok( ($a->ndims==2 and $a->dim(0)==2 and $a->dim(1)==2), 'weird cat case has the right shape');
+ok( all( $a == pdl([1,1],[2,3]) ), "cat does the right thing with catting a 0-pdl and 2-pdl together");
+$@='';
+
 # new_or_inplace
 $a = sequence(byte,5);
 
@@ -31,7 +31,7 @@ $b = pdl [[1,1,1],[2,2,2]];
 $i = 1;
 eval {$c = $b->slice(':,:,:,(1)'); $c->make_physical();};
 print "ERROR WAS: '$@'\n";
-ok(1,$@ =~ /error/i);
+ok(1,$@ =~ /too many dims/i);
 
 $i++;
 # now see if we survive the destruction of this invalid trans
@@ -44,8 +44,6 @@ ok(tapprox($a,$b), "A piddle and it's saved copy should be about equal");
 # some mapfraw tests
 SKIP:
 {
-   # $PDL::force_use_mmap_code = 1;
-
 	my $c = eval { mapfraw($name) };
         if ($@) {
            diag("$@");
@@ -1,137 +0,0 @@
-use strict;
-
-use PDL;
-use PDL::FFT;
-use Test::More;
-
-eval "use PDL::FFTW;";
-my $loaded = ($@ ? 0 : 1);
-
-# this value is add-hoc and adjusted each time we find a problem with a
-# given OS or library version of FFTW...
-#
-# We use the PDL::Core::approx() routine for comparing piddles
-#
-use constant ABSDIFF => 1.2e-4;
-
-if ($loaded) {
-   plan tests => 9;
-} else {
-   plan skip_all => "PDL::FFTW not available";
-}
-
-# get the type (double or float) used by the FFTW library and module
-# The eval() is to avoid warning messages from Perl
-#
-my $datatype = eval('$PDL::FFTW::COMPILED_TYPE');
-
-my $n = 30;
-my $m = 40;
-
-my ( $ir, $ii, $i, $fi, $fir, $fii, $ffi );
-$ir = zeroes($n,$m)->$datatype();
-$ii = zeroes($n,$m)->$datatype();
-$ir = random $ir;
-$ii = random $ii;
-
-$i = cat $ir,$ii;
-$i = $i->mv(2,0);
-$fi = ifftw $i;
-
-$fir = $ir->copy;
-$fii = $ii->copy;
-fftnd $fir,$fii;
-$ffi = cat $fir,$fii;
-$ffi = $ffi->mv(2,0);
-
-my ( $t, $orig, $i2, $sffi );
-$t = ($ffi-$fi)*($ffi-$fi);
-
-# print diff fftnd and ifftw: ",sqrt($t->sum),"\n";
-ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
-   "fftnd() and ifftw()");
-
-$orig = fftw $fi;
-$orig /= $n*$m;
-
-$t = ($orig-$i)*($orig-$i);
-# print "diff ifftw fftw and orig: ",sqrt($t->sum),"\n";
-ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
-   "ifftw() fftw() and original");
-
-# Inplace FFT
-$i2 = $i->copy;
-
-infftw($i2);
-
-$t = ($i2-$ffi)*($i2-$ffi);
-# print "diff fftnd and infftw: ",sqrt($t->sum),"\n";
-ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
-   "fftnd and infftw");
-
-$i2 = nfftw $i2;
-$i2 /= $n*$m;
-
-$t = ($i-$i2)*($i-$i2);
-# print "diff infftw nfftw and orig: ",sqrt($t->sum),"\n";
-ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
-   "infftw nfftw and original");
-
-$ir = zeroes($n,$m)->$datatype();
-$ii = zeroes($n,$m)->$datatype();
-$ir = random $ir;
-
-$fir = $ir->copy;
-$fii = $ii->copy;
-ifftnd $fir,$fii;
-$ffi = cat $fir,$fii;
-$ffi = $ffi->mv(2,0);
-$ffi *= $n*$m;
-$sffi = $ffi->mslice('X',[0,$n/2],'X');
-
-$fi = rfftw $ir;
-
-$t = ($sffi-$fi)*($sffi-$fi);
-# print "diff rfftw and infft: ",sqrt($t->sum),"\n";
-ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
-   "rfftw() and infft()");
-
-$orig = irfftw $fi;
-$orig /= $n*$m;
-
-$t = ($orig-$ir)*($orig-$ir);
-# print "diff ifftw fftw and orig: ",sqrt($t->sum),"\n";
-ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
-   "ifftw() fftw() and original");
-
-my ( $rin, $srin, $tmp );
-$rin = zeroes(2*(int($n/2)+1),$m)->$datatype();
-$tmp = $rin->mslice([0,$n-1],'X');
-$tmp .= $ir;
-$srin = $rin->copy;
-
-$rin = nrfftw $rin;
-
-$t = ($sffi-$rin)*($sffi-$rin);
-# print "diff nrfftw and infft: ",sqrt($t->sum),"\n";
-ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
-   "nrfftw() and infft()");
-
-$rin = inrfftw $rin;
-$rin /= $n*$m;
-
-$rin = $rin->mslice([0,$n-1],'X');
-$srin = $srin->mslice([0,$n-1],'X');
-
-$t = ($srin-$rin)*($srin-$rin);
-# print "diff inrfftw nrfftw and orig: ",sqrt($t->sum),"\n";
-ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
-   "inrfftw() nrfftw() and original");
-
-# do the inplace routines work with slices?
-my $a = ones(2,4)->$datatype();
-my $fa = fftw $a;
-nfftw $a->slice('');
-ok(approx($fa,$a,ABSDIFF)->all,
-   "inplace routine (nfftw) works with slices");
-#print "$a\n$fa\n";
@@ -12,7 +12,7 @@ use PDL::Config;
 
 kill 'INT',$$  if $ENV{UNDER_DEBUGGER}; # Useful for debugging.
 
-use Test::More tests => 84;
+use Test::More tests => 90;
 
 BEGIN {
       use_ok( "PDL::IO::FITS" ); #1
@@ -73,7 +73,11 @@ sub compare_piddles ($$$) {
     my $new   = shift;
     my $label = shift;
 
-    is( $new->type->symbol, $orig->type->symbol, "$label has the correct type" );
+    TODO: {
+       local $TODO = "Need to fix alias between PDL_IND and PDL_L or PDL_LL";
+
+       is( $new->type->symbol, $orig->type->symbol, "$label has the correct type" );
+    }
     is( $new->nelem, $orig->nelem, "  and the right number of elements" );
     is( $new->ndims, $orig->ndims, "  and the right number of dimensions" );
 
@@ -270,6 +274,29 @@ SKIP:{
     wfits($a,$file);
     my $b = rfits($file);
     ok(all($a==$b),"fftnd output (non-contiguous in memory) is written correctly");
+    unlink $file;
 }
 
+##############################
+# Check multi-HDU read/write
+
+$a = sequence(5,5);
+$b = rvals(5,5);
+
+our @aa;
+
+eval { wfits([$a,$b],$file); };
+ok(!$@, "wfits with multiple HDUs didn't fail");
+
+eval { @aa = rfits($file); };
+ok(!$@, "rfits in list context didn't fail");
+
+ok( $aa[0]->ndims == $a->ndims && all($aa[0]->shape == $a->shape), "first element has right shape");
+ok( all($aa[0] == $a), "first element reproduces written one");
+
+ok( $aa[1]->ndims == $b->ndims && all($aa[1]->shape == $b->shape), "second element has right shape");
+ok( all($aa[1] == $b), "Second element reproduces written one");
+
+unlink $file;
+
 1;
@@ -63,8 +63,6 @@ unlink $cdname, $cdname . '.hdr';	# just to be absolutely sure
 # some mapflex tests
 SKIP: {
 
-   # $PDL::force_use_mmap_code = 1;
-
    my $c = eval { mapflex($name) };
    if ($@) {
       diag("$@");
@@ -7,6 +7,7 @@ use strict;
 
 use Test::More;
 use File::Temp qw(tempfile);
+use File::Spec;
 
 my ($data,$head,$hdr);
 
@@ -57,8 +58,8 @@ BEGIN{
     #
     if(-e 'flexraw.t') {
 	unshift @INC, '../Lib/Slatec/' if -e 'flexraw.t';
-    } elsif(-e 'Changes') {
-	unshift @INC, 'Lib/Slatec/' if -e 'Changes';
+    } elsif(-e 'INTERNATIONALIZATION') {
+	unshift @INC, 'Lib/Slatec/' if -e 'INTERNATIONALIZATION';
     } else {
 	print "I'm not in PDL now, right? Still trying\n";
     }
@@ -572,8 +573,9 @@ SKIP: {
    $ok &&= $#a==6;
    @a = readflex("${data}.Z");
    $ok &&= $#a==6;
-   0 == system "gunzip -q ${data}.Z" or diag "system gunzip -q ${data}.Z failed: $?";
-   0 == system "gzip -q $data" or diag "system gzip -q $data failed: $?";
+   my $NULL = File::Spec->devnull();
+   0 == system "gunzip -q ${data}.Z >$NULL 2>&1" or diag "system gunzip -q ${data}.Z failed: $?";
+   0 == system "gzip -q $data >$NULL 2>&1" or diag "system gzip -q $data failed: $?";
    @a = readflex($data);
    $ok &&= $#a==6;
    @a = readflex("${data}.gz");
@@ -595,7 +597,7 @@ SKIP: {
 
 # Try writing data
 my $flexhdr = writeflex($data,@req);
-writeflexhdr($data,$flexhdr);
+writeflexhdr($data,$flexhdr) unless $PDL::IO::FlexRaw::writeflexhdr;
 @a = readflex($data);
 unlink $hdr;
 $ok = 1;
@@ -624,20 +626,21 @@ $flexhdr = [ {Type => 'byte',   NDims => 1, Dims => 10},
 	     {Type => 'float',  NDims => 1, Dims => 10},
 	     {Type => 'double', NDims => 1, Dims => 10} ];
 @a = readflex($data, $flexhdr);
+unlink $data;
 $ok = 1;
 foreach (@req) {
     # print "$_ vs ",@a[0],"\n";
     $ok &&= tapprox($_,slice(shift @a,"(0)"));
 }
 ok( $ok, "writeflex combined types[10], readflex explicit hdr array");
-unlink $data;
 
 # Writing multidimensional data
 map {$_ = $_->dummy(0,10)} @req;
 $flexhdr = writeflex($data,@req);
-writeflexhdr($data,$flexhdr);
+writeflexhdr($data,$flexhdr) unless $PDL::IO::FlexRaw::writeflexhdr;
 @a = readflex($data);
-unlink $data, $hdr;
+unlink $data;
+unlink $hdr;
 $ok = 1;
 foreach (@req) {
     # print "$_ vs ",@a[0],"\n";
@@ -13,6 +13,8 @@ use Test::More;
 
 BEGIN
 {
+    my $Ntests = 32;
+
     use PDL::Config;
     if ( $PDL::Config{WITH_GD} ) 
     {
@@ -21,13 +23,21 @@ BEGIN
         {
             plan skip_all => "PDL::IO::GD requires the gd image library.";
         }  
-        elsif( $^O =~ /(bsd|dragonfly)$/i)
-        {
-            plan skip_all => "Known problem: sf.net bug #3518190, t/gd_oo_tests.t fails for AMD64";
-        }  
+#        elsif( $^O =~ /bsd$/i or $^O =~ /dragonfly/i )
+#        {
+#           if ( $ENV{AUTOMATED_TESTING} )
+#           {
+#              plan skip_all => "Known problem: sf.net bug #3518190, t/gd_oo_tests.t fails for BSD AMD64";
+#           }
+#           else
+#           {
+#              diag "Known problem: sf.net bug #3518190, t/gd_oo_tests.t fails for BSD AMD64";
+#              plan tests => $Ntests;
+#           }
+#        }  
         else
         {
-            plan tests => 28;
+            plan tests => $Ntests;
         }
     }
     else
@@ -51,194 +61,222 @@ sub tapprox
     return all($d < 1.0e-5);
 }
 
-# Test files:
-#
-my $tempdir = $PDL::Config{TEMPDIR} || "/tmp";
-
-my $lutfile = "$tempdir/default.rcols";
-my $testfile1 = "$tempdir/test.png";
-my $testfile2 = "$tempdir/test2.png";
-my $testfile3 = "$tempdir/test3.png";
-
-# Write out the lutfile below, so we don't have to include it in the distro:
-write_lut($lutfile);
-
-# Start the tests:
-#
-
-print "Test writing byte (8bit) PNG image...\n";
-my $pdl = sequence(byte, 30, 30);
-
-# TEST 1:
-# Load a lut from an ASCII file:
-#print "\$pdl:\n$pdl\n";
-my $lut = load_lut( $lutfile );
-#print "\$lut info(): " . $lut->info() . "\n";
-#print "\$lut:\n$lut\n";
-ok( ($lut->dim(0) == 3 && $lut->dim(1) == 256) );
-
-# TEST 2:
-# write a PNG with the old interface:
-write_png( $pdl, $lut, $testfile1 );
-ok(1);
-
-# TEST 3:
-# write a truecolor PNG with the old interface:
-print "Testing writing true color (32 bit) PNG image...\n";
-write_true_png(sequence(100, 100, 3), $testfile3);
-ok(1);
-
-
-#
-# Open the file:
-#
-# TEST 4:
-# Create a new object:
-my $gd = PDL::IO::GD->new( { filename => $testfile1 } );
-print "Object created!\n";
-ok( defined( $gd ) );
-
-# TEST 5 & 6:
-# Query the dims:
-my $x = $gd->gdImageSX();
-ok( $x );
-my $y = $gd->gdImageSY();
-ok( $y );
-print "\$x = $x\t\$y = $y\n";
-
-# TEST 7:
-# Read it into a PDL, and make sure it matches:
-my $pdl2 = $gd->to_pdl();
-ok( tapprox( $pdl, $pdl2 ) );
-
-# TEST 8:
-# Kill it:
-$gd->DESTROY();
-print "Object destroyed!\n";
-ok( 1 );
-
-#
-# Create a new object:
-# 
-# TEST 9:
-# Create a new image from scratch:
-my $im = PDL::IO::GD->new( { x => 300, y => 300 } );
-ok( defined( $im ) );
-
-#
-# Allocate some colors:
-#
-# TEST 10:
-$im->apply_lut( $lut );
-ok( 1 );
-
-# TESTS 11-14:
-# Resolve some colors:
-my $black = $im->ColorResolve( 0, 0, 0 );
-ok( defined( $black ) );
-my $red = $im->ColorResolve( 255, 0, 0 );
-ok( defined( $red ) );
-my $green = $im->ColorResolve( 0, 255, 0 );
-ok( defined( $green ) );
-my $blue = $im->ColorResolve( 0, 0, 255 );
-ok( defined( $blue ) );
-
-# TEST 15:
-# Draw a rectangle:
-$im->Rectangle( 5, 5, 295, 295, $red );
-ok( 1 );
-
-# TEST 16:
-# Add some text:
-$im->String( gdFontGetLarge(), 10, 10, "Test Large Font!", $green );
-ok( 1 );
-
-# TEST 17:
-# Generate a color bar:
-my $x1 = zeroes( long, 256 ) + 50;
-my $y1 = sequence( long, 256 ) + 30;
-my $color = sequence(long, 256);
-$im->Lines( $x1, $y1, $x1 + 100, $y1, $color );
-ok( 1 );
-
-# TEST 18:
-# Write the output file:
-$im->write_Png( $testfile2 );
-ok( 1 );
-$im->DESTROY(); $im = undef;
-
-#
-# New tests on object creation:
-#
-
-# TEST 19:
-# Create from a 2d PDL without a LUT:
-my $pic = sequence(100, 100);
-$im = PDL::IO::GD->new({ pdl => $pic });
-ok( defined( $im ) );
-$im->DESTROY(); $im = undef;
-
-# TEST 20:
-# Create from a 2d PDL and a LUT:
-$im = PDL::IO::GD->new({ pdl => $pic, lut => $lut });
-ok( defined( $im ) );
-$im->DESTROY(); $im = undef;
-
-# TEST 21:
-# Create from a RGB PDL:
-my $pic3d = $pic->dummy(2,3);
-$im = PDL::IO::GD->new({ pdl => $pic3d });
-ok( defined( $im ) );
-$im->DESTROY(); $im = undef;
-
-# TEST 22:
-# Create an RGB from scratch:
-$im = PDL::IO::GD->new({ x => 100, y => 100, true_color => 1 });
-ok( defined( $im ) );
-$im->DESTROY(); $im = undef;
-
-# TEST 23-24:
-# Create from a 2d PNG data glob:
-my $rc = open( TF1, $testfile1 );
-ok( $rc );
-binmode( TF1 );
-$/ = undef;
-my $blob = <TF1>;
-close( TF1 );
-$im = PDL::IO::GD->new({ data => $blob });
-ok( defined( $im ) );
-$im->DESTROY(); $im = undef;
-
-# TEST 25:
-# Create from a 2d PNG data glob, with the type given:
-$im = PDL::IO::GD->new({ data => $blob, type => 'png' });
-ok( defined( $im ) );
-$im->DESTROY(); $im = undef;
-
-# TEST 26-27:
-# Create from a 3d PNG data glob:
-$rc = open( TF3, $testfile3 );
-ok( $rc );
-binmode( TF3 );
-$/ = undef;
-my $blob3d = <TF3>;
-close( TF3 );
-$im = PDL::IO::GD->new({ data => $blob3d });
-ok( defined( $im ) );
-
-# TEST 28:
-# Get a PNG data glob from a created 
-my $png_blob = $im->get_Png_data();
-ok( $blob3d eq $png_blob );
-$im->DESTROY(); $im = undef;
-
-
-# Remove our test files:
-#
-unlink( $lutfile );
-unlink( $testfile1 );
-unlink( $testfile2 );
-unlink( $testfile3 );
+#TODO:
+#{
+
+#    local $TODO = 'gd_oo_tests.t fail for AMD64, sf.net #3518190';
+    # Test files:
+    #
+    my $tempdir = $PDL::Config{TEMPDIR} || "/tmp";
+
+    my $lutfile = "$tempdir/default.rcols";
+    my $testfile1 = "$tempdir/test.png";
+    my $testfile2 = "$tempdir/test2.png";
+    my $testfile3 = "$tempdir/test3.png";
+
+    # Write out the lutfile below, so we don't have to include it in the distro:
+    write_lut($lutfile);
+
+    # Start the tests:
+    #
+
+    #diag "Test writing byte (8bit) PNG image...\n";
+    my $pdl = sequence(byte, 30, 30);
+
+    # TEST 1:
+    # Load a lut from an ASCII file:
+    #diag "\$pdl:\n$pdl\n";
+    my $lut = load_lut( $lutfile );
+    #diag "\$lut info(): " . $lut->info() . "\n";
+    #diag "\$lut:\n$lut\n";
+    ok( ($lut->dim(0) == 3 && $lut->dim(1) == 256), 'Load a lut from an ASCII file' );
+
+    # TEST 2:
+    # write a PNG with the old interface:
+    write_png( $pdl, $lut, $testfile1 );
+    ok(1,'write a PNG with the old interface');
+
+    # TEST 3:
+    # write a truecolor PNG with the old interface:
+    #diag "Testing writing true color (32 bit) PNG image...\n";
+    write_true_png(sequence(100, 100, 3), $testfile3);
+    ok(1, 'write a truecolor PNG with the old interface');
+
+
+    #
+    # Open the file:
+    #
+    # TEST 4:
+    # Create a new object:
+    my $gd = PDL::IO::GD->new( { filename => $testfile1 } );
+    #diag "Object created!\n";
+    ok( defined( $gd ), 'Object created' );
+
+    # TEST 5 & 6:
+    # Query the dims:
+    my $x = $gd->gdImageSX();
+    ok( $x, 'query X dim' );
+    my $y = $gd->gdImageSY();
+    ok( $y, 'query Y dim' );
+    #diag "\$x = $x\t\$y = $y\n";
+
+    # TEST 7:
+    # Read it into a PDL, and make sure it matches:
+    my $pdl2 = $gd->to_pdl();
+    ok( tapprox( $pdl, $pdl2 ), 'image matches original pdl' );
+
+    # TEST 8:
+    # Kill it:
+    $gd->DESTROY();
+    #diag "Object destroyed!\n";
+    ok( 1, 'Object destroyed' );
+
+    #
+    # Create a new object:
+    # 
+    # TEST 9:
+    # Create a new image from scratch:
+    my $im = PDL::IO::GD->new( { x => 300, y => 300 } );
+    ok( defined( $im ), 'creat new image from scratch' );
+
+    #
+    # Allocate some colors:
+    #
+    # TEST 10:
+    $im->apply_lut( $lut );
+    ok( 1, 'allocate some colors' );
+
+    # TESTS 11-14:
+    # Resolve some colors:
+    my $black = $im->ColorResolve( 0, 0, 0 );
+    ok( defined( $black ), 'resolve color black' );
+    my $red = $im->ColorResolve( 255, 0, 0 );
+    ok( defined( $red ), 'resolve color red' );
+    my $green = $im->ColorResolve( 0, 255, 0 );
+    ok( defined( $green ), 'resolve color green' );
+    my $blue = $im->ColorResolve( 0, 0, 255 );
+    ok( defined( $blue ), 'resolve color blue' );
+
+    # TEST 15:
+    # Draw a rectangle:
+    $im->Rectangle( 5, 5, 295, 295, $red );
+    ok( 1, 'draw a rectangle' );
+
+    # TEST 16:
+    # Add some text:
+    $im->String( gdFontGetLarge(), 10, 10, "Test Large Font!", $green );
+    ok( 1, 'add some text' );
+
+    # TEST 17:
+    # Generate a color bar:
+    my $x1 = zeroes( long, 256 ) + 50;
+    my $y1 = sequence( long, 256 ) + 30;
+    my $color = sequence(long, 256);
+    $im->Lines( $x1, $y1, $x1 + 100, $y1, $color );
+    ok( 1, 'generate a color bar' );
+
+    # TEST 18:
+    # Write the output file:
+    $im->write_Png( $testfile2 );
+    ok( 1, 'write the output file' );
+    $im->DESTROY(); $im = undef;
+
+    #
+    # New tests on object creation:
+    #
+
+    # TEST 19:
+    # Create from a 2d PDL without a LUT:
+    my $pic = sequence(100, 100);
+    $im = PDL::IO::GD->new({ pdl => $pic });
+    ok( defined( $im ), 'create from 2d PDL without a LUT' );
+    $im->DESTROY(); $im = undef;
+
+    # TEST 20:
+    # Create from a 2d PDL and a LUT:
+    $im = PDL::IO::GD->new({ pdl => $pic, lut => $lut });
+    ok( defined( $im ), 'create from 2d PDL and a LUT' );
+    $im->DESTROY(); $im = undef;
+
+    # TEST 21:
+    # Create from a RGB PDL:
+    my $pic3d = $pic->dummy(2,3);
+    $im = PDL::IO::GD->new({ pdl => $pic3d });
+    ok( defined( $im ), 'create from a RGB PDL' );
+    $im->DESTROY(); $im = undef;
+
+    # TEST 22:
+    # Create an RGB from scratch:
+    $im = PDL::IO::GD->new({ x => 100, y => 100, true_color => 1 });
+    ok( defined( $im ), 'create an RGB from scratch' );
+    $im->DESTROY(); $im = undef;
+
+    # TEST 23-24:
+    # Create from a 2d PNG data glob:
+    my $rc = open( TF1, $testfile1 );
+    ok( $rc, 'opened test file and handle' );
+    binmode( TF1 );
+    $/ = undef;
+    my $blob = <TF1>;
+    close( TF1 );
+    $im = PDL::IO::GD->new({ data => $blob });
+    ok( defined( $im ), 'create from a 2d PNG data glob' );
+    $im->DESTROY(); $im = undef;
+
+    # TEST 25:
+    # Create from a 2d PNG data glob, with the type given:
+    $im = PDL::IO::GD->new({ data => $blob, type => 'png' });
+    ok( defined( $im ), 'create from glob with type given' );
+    $im->DESTROY(); $im = undef;
+
+    # TEST 26-27:
+    # Create from a 3d PNG data glob:
+    $rc = open( TF3, $testfile3 );
+    ok( $rc , 'testfile3 successfully opened');
+    binmode( TF3 );
+    $/ = undef;
+    my $blob3d = <TF3>;
+    close( TF3 );
+    $im = PDL::IO::GD->new({ data => $blob3d });
+    ok( defined( $im ), 'create from a 3d PNG data glob' );
+
+    # TEST 28:
+    # Get a PNG data glob from a created 
+    my $png_blob = $im->get_Png_data();
+    ok( $blob3d eq $png_blob, 'get a PNG data glob' );
+    $im->DESTROY(); $im = undef;
+
+    # TEST 29:
+    # Try a nicer way to make an object. Just pass in a filename:
+    my $gd_new_just_filename = PDL::IO::GD->new( $testfile1 );
+    ok( defined( $gd_new_just_filename ), 'initialize an object from JUST the filename' );
+
+    # TEST 30:
+    # Try another nicer way to make an object: Pass in an inline hash:
+    my $gd_new_inline_hash = PDL::IO::GD->new( filename => $testfile1 );
+    ok( defined( $gd_new_inline_hash ), 'initialize an object from an inline hash' );
+
+    # TEST 31:
+    # Make sure bogus inline hashes generate complaints. First, give an odd
+    # number of args
+    my $gd_new_inline_hash_broken1;
+    eval { $gd_new_inline_hash_broken1 = PDL::IO::GD->new( filename => $testfile1, 34 ) };
+    ok( $@ && !defined( $gd_new_inline_hash_broken1 ), 'incorrectly initialize an object from an inline hash: odd Nargs' );
+    # TEST 32:
+    # Make sure bogus inline hashes generate complaints. Give a non-string key
+    my $gd_new_inline_hash_broken2;
+    eval { $gd_new_inline_hash_broken2 = PDL::IO::GD->new( filename => $testfile1, [34] => 12 ) };
+    ok( $@ && !defined( $gd_new_inline_hash_broken2 ), 'incorrectly initialize an object from an inline hash: non-string key' );
+
+
+    # Remove our test files:
+    #
+    unlink( $lutfile );
+    unlink( $testfile1 );
+    unlink( $testfile2 );
+    unlink( $testfile3 );
+
+#}
 
 exit (0);
 # 
@@ -14,7 +14,8 @@ BEGIN
    if ( $PDL::Config{WITH_GSL} ) {
       eval " use PDL::GSL::MROOT; ";
       unless ($@) {
-         plan tests => 2;
+         ## plan tests => 2;
+         plan skip_all => "PDL::GSL::MROOT doesn't work with PDL_Index, yet";
       } else {
          plan skip_all => "PDL::GSL::MROOT not installed";
       }
@@ -16,7 +16,11 @@ sub hdrcmp {
   my ($ah,$bh) = map {$_->gethdr} @_;
 # Copy-by-reference test is obsolete; check contents instead (CED 12-Apr-2003)
 #   return $ah==$bh
-  return join("",%{$ah}) eq join("",%{$bh});
+  my %ahh = %{$ah};
+  my (@ahhkeys) = sort keys %ahh;
+  my %bhh = %{$bh};
+  my (@bhhkeys) =  sort keys %bhh;
+  return join("",@bhh{@bhhkeys}) eq join("",@ahh{@ahhkeys});
 }
 
 print "1..9\n";
@@ -3,7 +3,7 @@
 
 use Test;
 BEGIN {
-    plan tests => 22;
+    plan tests => 26;
 }
 
 use PDL;
@@ -43,11 +43,15 @@ tapprox( conv2d($a,$b), $b );    # 2
 # conv2d: boundary => reflect
 $a=ones(3,3);  
 $ans = pdl ([12,18,24],[30,36,42],[48,54,60]);
-tapprox( conv2d($b,$a,{Boundary => 'Reflect'}), $ans );
+tapprox( conv2d($b,$a,{Boundary => 'Reflect'}), $ans );  #3
+
+# conv2d: boundary => replicate
+$ans = pdl ([12,18,24],[30,36,42],[48,54,60]);
+tapprox( conv2d($b,$a,{Boundary => 'Replicate'}), $ans ); #4
 
 # conv2d: boundary => truncate
 $ans = pdl ([8,15,12],[21,36,27],[20,33,24]);
-tapprox( conv2d($b,$a,{Boundary => 'Truncate'}), $ans );
+tapprox( conv2d($b,$a,{Boundary => 'Truncate'}), $ans ); #5
 
 # max2d_ind
 $a = 100 / (1.0 + rvals(5,5));
@@ -147,9 +151,27 @@ ok($@ eq '');
 my $px = pdl(0,3,1);
 my $py = pdl(0,1,4);
 my $im = zeros(5,5);
+my $im2 = zeroes(5,5);
 my $x = $im->xvals;
 my $y = $im->yvals;
+my $ps = $px->cat($py)->xchg(0,1);
 my $im_mask = pnpoly($x,$y,$px,$py);
 ok(sum($im_mask) == 5);
 my $inpixels = pdl q[ 1 1 ; 1 2 ; 1 3 ; 2 1 ; 2 2 ];
 ok(sum($inpixels - qsortvec(scalar whichND($im_mask))) == 0);
+
+# Make sure the PDL pnpoly and the PP pnpoly give the same result
+ok(all($im_mask == $im->pnpoly($ps)));
+
+# Trivial test to make sure the polyfills using the pnpoly algorithm are working
+$im .= 0;
+polyfillv($im2,$ps,{'Method'=>'pnpoly'}) .= 22;
+ok(all(polyfill($im,$ps,22,{'Method'=>'pnpoly'}) == $im2));
+
+
+# Trivial test to make sure the polyfills are working
+$im .= 0;
+$im2 .= 0;
+polyfillv($im2,$ps) .= 25;
+polyfill($im,$ps,25);
+ok(all($im == $im2));
@@ -0,0 +1,110 @@
+# This test checks that multiline comments in user code does not cause
+# compilation errors. Strictly speaking, this is not really an Inline test,
+# but Inline happens to provide the simplest framework for performing these
+# tests. :-)
+#  -- DCM, April 16, 2012
+
+use strict;
+use Test::More;
+use blib;  # otherwise possible error on virgin systems not finding PDL::Core
+
+use PDL::LiteF;
+
+# First some Inline administivia.
+BEGIN {
+   # Check for BSD platforms
+   plan skip_all => 'Known problem: sf.net bug #3518190, t/inline-comment-test.t fails for BSD'
+      if $^O =~ /(bsd|dragonfly)$/i;
+
+   # Test for Inline and set options
+   my $inline_test_dir = './.inlinepdlpp';
+   mkdir $inline_test_dir unless -d $inline_test_dir;
+   
+   # See if Inline loads without trouble, or bail out
+   eval {
+      require Inline;
+      Inline->import (Config => DIRECTORY => $inline_test_dir , FORCE_BUILD => 1);
+      1;
+   } or do {
+      plan skip_all => "Skipped: Inline not installed";
+   };
+   
+   # Make sure we have a recent enough version of Inline
+   eval q{
+      use Inline 0.43;
+      1;
+   } or do {
+      plan skip_all => 'Unable to load a new enough version of Inline';
+   };
+
+   # All clear, so declare the three tests
+   plan tests => 3;
+}
+
+# use Inline 'INFO'; # use to generate lots of info
+use Inline 'Pdlpp';
+
+print "Inline Version: $Inline::VERSION\n";
+ok(1, 'Everything seems to have compiled');
+
+$a = sequence(3,3);
+
+$b = $a->testinc;
+
+ok(all ($b == $a+1), 'Sanity check runs correctly');
+
+# Test the inability to comment-out a threadloop. This is documented on the
+# 11th page of the PDL::PP chapter of the PDL book. If somebody ever fixes this
+# wart, this test will fail, in which case the book's text should be updated.
+$b = $a->testinc2;
+TODO: {
+	# Note: This test appears to fail on Cygwin and some flavors of Linux.
+	local $TODO = 'This test inexplicably passes on some machines';
+	ok(not (all $b == $a + 1), 'WART: commenting out a threadloop does not work')
+		or diag("\$a is $a and \$b is $b");
+}
+
+__DATA__
+
+__Pdlpp__
+
+# simple PP definition with user irritation tests :-)
+
+pp_def('testinc',
+	Pars => 'a(); [o] b()',
+	Code => q{
+	   /* emulate user debugging */
+	   
+	   /* Why doesn't this work???!!!! */
+       threadloop %{
+    /*         printf("  %f, %f\r", $a(), $b());
+             printf("  Here\n");
+	*/
+    
+	         /* Sanity check */
+	         $b() = $a() + 1;
+   
+         %}
+	   
+	},
+);
+
+# make sure that if the word "threadloop" appears, later automatic threadloops
+# will not be generated, even if the original threadloop was commented-out
+
+pp_def('testinc2',
+	Pars => 'a(); [o] b()',
+	Code => q{
+	   /* emulate user debugging */
+	   
+	   /* Why doesn't this work???!!!! */
+   /*    threadloop %{
+             printf("  %f, %f\r", $a(), $b());
+             printf("  Here\n");
+         %}
+	*/
+          /* Sanity check */
+          $b() = $a() + 1;
+	   
+	},
+);
@@ -5,7 +5,7 @@ use PDL::IO::FlexRaw;
 use PDL::Config;
 use File::Temp;
 
-use Test;
+use Test::More;
 use strict;
 
 # eventually this should test all our io routines with all
@@ -14,11 +14,12 @@ use strict;
 # $SIG{__DIE__} = sub {print Carp::longmess(@_); die ;};
 BEGIN { 
   my @ntypes = (PDL::Types::typesrtkeys());
-  plan tests => scalar @ntypes;
+  plan tests => scalar grep { ! m/^PDL_IND$/ } @ntypes;
 }
 
 our @types = map { print "making type $_\n";
-		   new PDL::Type typefld($_,'numval') } typesrtkeys();
+		   new PDL::Type typefld($_,'numval') }
+                   grep { ! m/^PDL_IND$/ } typesrtkeys();
 
 ##my $data = $PDL::Config{TEMPDIR} . "/tmprawdata";
 my $data = File::Temp::tmpnam();
@@ -29,8 +30,11 @@ for my $type (@types) {
   my $hdr = writeflex $data, $pdl;
   writeflexhdr($data,$hdr);
   my $npdl = eval {readflex $data};
-  ok ($pdl->type == $npdl->type && 
-     all $pdl == $npdl);
+  TODO: {
+     local $TODO = "readflex returns index instead of long";
+     ok ($pdl->type == $npdl->type && 
+        all $pdl == $npdl);
+  }
 }
 
 unlink $data, "${data}.hdr";
@@ -0,0 +1,49 @@
+# -*-perl-*-
+
+use strict;
+use Test::More;
+use PDL;
+use PDL::LiteF;
+use Config;
+use PDL::Config;
+
+$| = 1;
+
+my $test_count = 6;
+my $eps = 1e-9;
+
+if($Config{cc} eq 'cl') {
+  plan skip_all => 'lgamma not implemented for MS compilers';
+  exit 0;
+}
+elsif ( $PDL::Config{WITH_BADVAL} ) {
+  plan tests => $test_count;
+}
+else {
+  # reduced testing
+  plan tests => $test_count - 2;
+}
+
+my @x = lgamma(-0.1);
+is(approx($x[0], 2.36896133272879), 1);
+is($x[1], -1);
+
+@x = lgamma(1.1);
+is(approx($x[0], -0.0498724412598397), 1);
+is($x[1], 1);
+
+if($PDL::Config{WITH_BADVAL}) {
+  my $p = sequence (1);
+  $p->badvalue (0);
+  $p->badflag (1);
+
+  my @x = lgamma($p->index(0));
+  is($x[0]->badflag(), 1);
+  is($x[1]->badflag(), 1);
+}
+
+sub my_approx {
+  if($_[0] + $eps > $_[1] && $_[0] - $eps < $_[1]) {return 1}
+  return 0;
+}
+
@@ -209,7 +209,7 @@ foreach my $test ( @tests )
   my ( $msg, $limits, $exp ) = @$test;
 
   my @range = limits( @udsets_arr, { %attr, Limits => $limits } );
-  ok( mostly_eq_array( \@range, $exp ), "array: $msg" );
+  ok( mostly_eq_array( \@range, $exp ), "array: $msg" ) or diag "(@range), [@$exp]\n";
 }
 
 # check equality of array refs up to a tolerance
@@ -4,18 +4,24 @@ use PDL::Config;
 use Test::More;
         
 BEGIN{
-  eval " use PDL::Minuit; ";
-  unless ($@){
-    plan tests => 5;
-  }
-  else {
-    print "$@\n";
-    plan skip_all => 'PDL::Minuit not available';
-    exit;
-  }
+   unless ($PDL::Config{WITH_MINUIT}) {
+      plan skip_all => 'PDL not built WITH_MINUIT';
+      exit;
+   }
+   eval " use PDL::Minuit; ";
+   unless ($@){
+      plan tests => 5;
+   }
+   else {
+      diag "$@\n";
+      plan skip_all => 'PDL::Minuit not available';
+      exit;
+   }
 }
 
-my $tempd = $PDL::Config{TEMPDIR} or die "TEMPDIR not found in %PDL::Config";
+use File::Temp qw( tempfile tempdir );
+my $tempd = tempdir( CLEANUP => 1 ) or die "Couldn't get tempdir\n";
+
 require File::Spec;
 my $logfile = File::Spec->catfile($tempd, 'minuit.log.' . $$);
 
@@ -9,10 +9,11 @@ use PDL::IO::Misc;
 use PDL::Core ':Internal'; # For howbig()
 use PDL::Config;
 
+use File::Temp qw( tempfile tempdir );
+
 kill 'INT',$$  if $ENV{UNDER_DEBUGGER}; # Useful for debugging.
 
-use Test;
-BEGIN { plan tests => 18; }
+use Test::More tests => 19;
 
 sub tapprox {
         my($a,$b) = @_;
@@ -21,37 +22,50 @@ sub tapprox {
         $d < 0.0001;
 }
 
-require File::Spec;
-my $fs = 'File::Spec';
-sub cdir { return $fs->catdir(@_)}
-sub cfile { return $fs->catfile(@_)}
+my $tempd = tempdir( CLEANUP => 1 ) or die "Couldn't get tempdir\n";
+my ($fileh,$file) = tempfile( DIR => $tempd );
+
+############# Test rcols with colsep and missing fields ###################
+
+print $fileh <<EOD;
+1,6,11
+2,7,
+3,8,13
+4,,14
+5,10,15
+EOD
+close($fileh);
 
-my $tempd = $PDL::Config{TEMPDIR} or
-  die "TEMPDIR not found in %PDL::Config";
-my $file = cfile $tempd, "iotest$$";
+{
+   local $PDL::undefval = -1;
+   $a = rcols $file, [], { colsep=>',' };
+}
+
+is( (sum($a<0)==2 && $a->getdim(0)==5 && $a->getdim(1)==3), 1, "rcols with undefval and missing cols" );
+unlink $file;
 
 ############# Test rcols with filename and pattern #############
 
-open(OUT, ">$file") || die "Can not open $file for writing\n";
-print OUT <<EOD;
+($fileh,$file) = tempfile( DIR => $tempd );
+print $fileh <<EOD;
 1 2
 2 33 FOO
 3 7
 4 9  FOO
 5 66
 EOD
-close(OUT);
+close($fileh);
 
 ($a,$b) = rcols $file,0,1;
 $a = long($a); $b=long($b);
 
-ok( (sum($a)==15 && max($b)==66 && $b->getdim(0)==5), 1, "rcols with filename" );
+is( (sum($a)==15 && max($b)==66 && $b->getdim(0)==5), 1, "rcols with filename" );
 
 ($a,$b) = rcols $file, "/FOO/",0,1;
 $a = long($a);
 $b=long($b);
 
-ok( (sum($a)==6 && max($b)==33 && $b->getdim(0)==2), 1, "rcols with filename + pattern" );
+is( (sum($a)==6 && max($b)==33 && $b->getdim(0)==2), 1, "rcols with filename + pattern" );
 
 ############# Test rcols with file handle with nothing left #############
 
@@ -61,38 +75,38 @@ my @slurp = <$fh>;
 # Now apply rcols:
 $@ = '';
 $a = eval { rcols $fh };
-ok($@, '', 'rcols does not die on a used file handle');
+is($@, '', 'rcols does not die on a used file handle');
 close $fh;
 
 ############### Test rgrep with FILEHANDLE #####################
 
-open(OUT, ">$file") || die "Can not open $file for writing\n";
-print OUT <<EOD;
+($fileh,$file) = tempfile( DIR => $tempd );
+print $fileh <<EOD;
 foo"1" -2-
 foo"2"  Test -33-
 foo"3" jvjtvbjktrbv -7-
 foo"4" -9-
 fjrhfiurhe foo"5" jjjj -66-
 EOD
-close(OUT);
+close($fileh);
 
 open(OUT, $file) || die "Can not open $file for reading\n";
 ($a,$b) = rgrep {/foo"(.*)".*-(.*)-/} *OUT;
 $a = long($a); $b=long($b);
 close(OUT);
 
-ok( (sum($a)==15 && max($b)==66 && $b->getdim(0)==5), 1, "rgrep" );
+is( (sum($a)==15 && max($b)==66 && $b->getdim(0)==5), 1, "rgrep" );
 
 ########### Explicit test of byte swapping #################
 
 $a = short(3); $b = long(3); # $c=long([3,3]);
 bswap2($a); bswap4($b);
-ok(sum($a)==768 && sum($b)==50331648,1,"bswap2");
+is(sum($a)==768 && sum($b)==50331648,1,"bswap2");
 
 ############# Test rasc  #############
 
-open(OUT, ">$file") || die "Can not open $file for writing\n";
-print OUT <<EOD;
+($fileh,$file) = tempfile( DIR => $tempd );
+print $fileh <<EOD;
 0.231862613
 0.20324005
 0.067813045
@@ -115,18 +129,18 @@ print OUT <<EOD;
 0.260724391
 
 EOD
-close(OUT);
+close($fileh);
 
 $a = PDL->null;
 $a->rasc($file,20);
-ok( abs($a->sum - 5.13147) < .01, 1, "rasc on null piddle" );
+is( abs($a->sum - 5.13147) < .01, 1, "rasc on null piddle" );
  
 $b = zeroes(float,20,2);
 $b->rasc($file);
-ok( abs($b->sum - 5.13147) < .01, 1, "rasc on existing piddle" );
+is( abs($b->sum - 5.13147) < .01, 1, "rasc on existing piddle" );
 
 eval '$b->rasc("file_that_does_not_exist")';
-ok( $@, qr/Can't open/, "rasc on non-existant file" );
+like( $@, qr/Can't open/, "rasc on non-existant file" );
 
 unlink $file; # clean up
 
@@ -134,54 +148,56 @@ unlink $file; # clean up
 # Tests of rcols() options
 #   EXCLUDE/INCLUDE/LINES/DEFTYPE/TYPES
 
-open(OUT, ">$file") || die "Can not open $file for writing\n";
-print OUT <<EOD;
+($fileh,$file) = tempfile( DIR => $tempd );
+print $fileh <<EOD;
 1 2
 # comment line
 3 4
 -5 6
 7 8
 EOD
-close(OUT);
+close($fileh);
 
 ($a,$b) = rcols $file,0,1;
-ok( $a->nelem==4 && sum($a)==6 && sum($b)==20, 1,
+is( $a->nelem==4 && sum($a)==6 && sum($b)==20, 1,
     "rcols: default" );
 
 ($a,$b) = rcols \*DATA,0,1;
-ok( $a->nelem==4 && sum($a)==6 && sum($b)==20, 1,
+is( $a->nelem==4 && sum($a)==6 && sum($b)==20, 1,
     "rcols: pipe" );
 
 ($a,$b) = rcols $file,0,1, { INCLUDE => '/^-/' };
-ok( $a->nelem==1 && $a->at(0)==-5 && $b->at(0)==6, 1,
+is( $a->nelem==1 && $a->at(0)==-5 && $b->at(0)==6, 1,
     "rcols: include pattern" );
 
 ($a,$b) = rcols $file,0,1, { LINES => '-2:0' };
-ok( $a->nelem==3 && tapprox($a,pdl(-5,3,1)) && tapprox($b,pdl(6,4,2)), 1,
+is( $a->nelem==3 && tapprox($a,pdl(-5,3,1)) && tapprox($b,pdl(6,4,2)), 1,
     "rcols: lines option" );
 
 use PDL::Types;
 ($a,$b) = rcols $file, { DEFTYPE => long };
-ok( $a->nelem==4 && $a->get_datatype==$PDL_L && $b->get_datatype==$PDL_L, 1,
+is( $a->nelem==4 && $a->get_datatype==$PDL_L && $b->get_datatype==$PDL_L, 1,
     "rcols: deftype option" );
 
 ($a,$b) = rcols $file, { TYPES => [ ushort ] };
-ok( $a->nelem==4 && $a->get_datatype==$PDL_US && $b->get_datatype==$PDL_D, 1,
+is( $a->nelem==4 && $a->get_datatype==$PDL_US && $b->get_datatype==$PDL_D, 1,
     "rcols: types option" );
 
-ok( UNIVERSAL::isa($PDL::IO::Misc::deftype,"PDL::Type"), 1,
+is( UNIVERSAL::isa($PDL::IO::Misc::deftype,"PDL::Type"), 1,
     "PDL::IO::Misc::deftype is a PDL::Type object" );
-ok( $PDL::IO::Misc::deftype->[0], double->[0],
+is( $PDL::IO::Misc::deftype->[0], double->[0],
     "PDL::IO::Misc::deftype check" );
 
 $PDL::IO::Misc::deftype = short;
 ($a,$b) = rcols $file;
-ok( $a->get_datatype, short->[0], "rcols: can read in as 'short'" );
+is( $a->get_datatype, short->[0], "rcols: can read in as 'short'" );
 
 unlink $file;
 
-eval { wcols $a, $b };
-ok(!$@,1, "wcols" );
+($fileh,$file) = tempfile( DIR => $tempd );
+eval { wcols $a, $b, $fileh };
+is(!$@,1, "wcols" );
+unlink $fileh;
 
 1;
 
@@ -1,84 +0,0 @@
-# -*-perl-*-
-# Test of the NDF I/O system
-# Requires that the NDF module is available.
-
-use strict;
-
-use Test::More;
-
-use PDL::LiteF;
-$PDL::verbose = 1;
-
-my $loaded;
-
-# Check that we can load the module
-BEGIN {
-  # Kluge loading to force NDF module to be loaded now.
-  # This is required since currently the PDL::IO::NDF module
-  # only loads the NDF module when required.
-  eval " use PDL::IO::NDF; use NDF";
-  $loaded = ( $@ ? 0 : 1 );
-}
-
-kill 'INT',$$  if $ENV{UNDER_DEBUGGER}; # Useful for debugging.
-
-unless ( $loaded ) {
-   plan skip_all => "PDL::IO::NDF module not available.";
-} else {
-   plan tests => 10;
-}
-
-sub tapprox ($$) {
-    my ( $a, $b ) = @_;
-    return abs($a-$b) <= 1.0e-5;
-}
-
-# Now start by creating a test PDL
-my $pdl = pdl( 1,5,10,8);
-
-# Now add a header
-$pdl->sethdr(  { NDFTEST => 'yes' } );
-
-# output file name
-my $ndffile = "test.sdf";
-unlink $ndffile if -e $ndffile;
-
-# Write it out to disk
-$pdl->wndf( $ndffile );
-ok( -e $ndffile );
-
-# Set up an END block to remove the file
-END {
-  unlink $ndffile if defined $ndffile and -e $ndffile;
-}
-
-# Now read it back in
-my $in = rndf( $ndffile );
-
-# Compare the number of entries
-ok( $in->dims == $pdl->dims );
-
-# Check each entry
-my $range = $pdl->getdim(0) - 1;
-foreach ( 0 .. $range ) {
-  ok( $in->at($_) == $pdl->at($_))
-}
-
-# Now compare headers
-ok( $pdl->gethdr->{NDFTEST} eq $in->gethdr->{NDFTEST} );
-
-# try a 2D image
-$pdl = pdl( [1,5,10],[8,4,-4]);
-$pdl->wndf( $ndffile );
-$in = rndf( $ndffile );
-
-# Compare the number of entries
-ok( $in->dims == $pdl->dims );
-ok( tapprox( sum($in - $pdl), 0.0 ) );
-
-# try a subset of the 2D image
-# NOTE: NDF starts counting at 1, not 0
-$in = rndf( "test(1:2,2)" );
-ok( tapprox( sum($in - $pdl->slice('0:1,1') ), 0.0 ) );
-
-# end of test
@@ -6,7 +6,7 @@ use PDL::LiteF;
 BEGIN { 
     eval 'require PDL::NiceSlice';
     unless ($@) {
-	plan tests => 43,
+	plan tests => 44,
 	# todo => [37..40],
     } else {
 	plan tests => 1;
@@ -46,6 +46,7 @@ ok($b->getndims == 0 && all $b == 6);
 # the latest versions should do the 'at' automatically
 eval translate_and_show '$b = $a(($c(1)));';
 ok (!$@);
+print "ERROR is $@\n" if($@);
 ok($b->getndims == 0 && all $b == 6);
 
 eval translate_and_show '$c = $a(:);';
@@ -208,7 +209,13 @@ eval translate_and_show '$b = $a(1:2,pdl(0,2));';
 # Old hdrcpy test (for copy-by-reference); this is obsolete
 # with quasi-deep copying.  --CED 11-Apr-2003
 #   ok (!$@ and $b->gethdr() == $h);
-ok(!$@ and join("",%{$b->gethdr}) eq join("",%{$h}));
+if ( ok(!$@) ) {
+   my %bh = %{$b->gethdr};
+   my (@bhkeys) = sort keys %bh;
+   my %hh = %{$h};
+   my (@hhkeys) =  sort keys %hh;
+   ok(join("",@bh{@bhkeys}) eq join("",@hh{@hhkeys}));
+}
 
 $a = ones(10);
 my $i = which $a < 0;
@@ -15,7 +15,7 @@ sub tapprox {
 	return $d < 0.01;
 }
 
-print "1..42\n";
+print "1..43\n";
 
 # $a0 = zeroes 3,5;
 # $b0 = xvals $a0;
@@ -150,5 +150,9 @@ ok(40,sum($b != pdl(2,0,1,2,0,1,2,0,1,2,0,1,2,0,1)) == 0);
 $b = $a % -3;
 ok(41,sum($b != pdl(-1,0,-2,-1,0,-2,-1,0,-2,-1,0,-2,-1,0,-2))==0);
 $b = $a % 0;
-ok(42,sum($b != 0) == 0)
+ok(42,sum($b != 0) == 0);
+#check that modulus works on PDL_Index types correctly
+$b = $a->qsorti;
+$c = $b % 3;
+ok(43,all($c->double==pdl("0 1 2 " x 5)));
 
@@ -1,15 +1,16 @@
 #!/usr/bin/perl
 #
 # This tests the new PDL constructor with a string argument.
-# There are two goals from the new functionality: (1) allow
-# MATLAB to use familiar syntax to create arrays, and
-# (2) to allow cut-n-paste of PDL print output as input
-# for scripts and programs
+# There are three goals from the new functionality: (1) to allow
+# MATLAB to use familiar syntax to create arrays, (2) to allow
+# cut-n-paste of PDL print output as input for scripts and programs,
+# and (3) to allow easy ways to construct nan and inf values in piddles.
 #
 
-use Test::More tests => 111;
+use Test::More tests => 113;
 use strict;
 use warnings;
+use Config;
 
 #############################
 # Loading and ISA tests - 2 #
@@ -153,7 +154,7 @@ $got = pdl q[[]];
 ok(all($got == $expected), 'Empty bracket is correctly interpreted');
 
 #############################
-# Bad, inf, nan checks - 13 #
+# Bad, inf, nan checks - 15 #
 #############################
 
 my $bad_values = pdl q[nan inf -inf bad];
@@ -162,28 +163,38 @@ my $bad_values = pdl q[nan inf -inf bad];
 # values
 require PDL::Config;
 
-# nan test: nan is never considered equal to itself ... unless perl itself is buggy.
-my $skip = 0;
-if (	not $PDL::Config{BADVAL_USENAN}
-	and $bad_values->at(0) == $bad_values->at(0)
-	and pdl($bad_values->at(0)) != pdl($bad_values->at(0))
-) {
-	warn "Looks like your perl asserts (incorrectly) that NaN == NaN\n";
-	$skip = 1;
+if($ActivePerl::VERSION || $Config{cc} eq 'cl') {
+   TODO: {
+      local $TODO = 'ActivePerl and/or perls built using MS compilers might fail this test';
+
+      if ($PDL::Config{BADVAL_USENAN}) {
+         ok($bad_values->isbad->at(0), 'sets nan to bad')
+            or diag("Zeroeth bad value should be bad but it describes itself as "
+            . $bad_values->at(0));
+      }
+      else {
+         ok($bad_values->at(0) != $bad_values->at(0), 'properly handles nan')
+            or diag("Zeroeth bad value should be nan but it describes itself as "
+            . $bad_values->at(0));
+      }
+   } # close TODO
 }
-SKIP: {
-	skip "because perl's handling of NaN seems buggy", 1 if $skip;
-	if ($PDL::Config{BADVAL_USENAN}) {
-		ok($bad_values->isbad->at(0), 'sets nan to bad')
-			or diag("Zeroeth bad value should be bad but it describes itself as "
-				. $bad_values->at(0));
-	}
-	else {
-		ok($bad_values->at(0) != $bad_values->at(0), 'properly handles nan')
-			or diag("Zeroeth bad value should be nan but it describes itself as "
-				. $bad_values->at(0));
-	}
+else {
+   if ($PDL::Config{BADVAL_USENAN}) {
+      ok($bad_values->isbad->at(0), 'sets nan to bad')
+         or diag("Zeroeth bad value should be bad but it describes itself as "
+         . $bad_values->at(0));
+   }
+   else {
+      SKIP: {
+         skip "broken for PDL_Index", 1;
+         ok($bad_values->at(0) != $bad_values->at(0), 'properly handles nan')
+            or diag("Zeroeth bad value should be nan but it describes itself as "
+            . $bad_values->at(0));
+      }
+   }
 }
+
 # inf test: inf == inf but inf * 0 != 0
 ok((	$PDL::Config{BADVAL_USENAN} and $bad_values->isbad->at(1)
 		or  $bad_values->at(1) == $bad_values->at(1)
@@ -206,42 +217,120 @@ ok($bad_values->isbad->at(3), 'properly handles bad values')
 my $infty = pdl 'inf';
 my $min_inf = pdl '-inf';
 my $nan = pdl 'nan';
-my $nan2 = pdl '-nan';
+
+my $nan2 = $^O =~ /MSWin32/i && !$ActivePerl::VERSION && $Config{cc} ne 'cl' ? pdl (-((-1) ** 0.5))
+                             : pdl '-nan';
+
 my $bad = pdl 'bad';
-ok((	$PDL::Config{BADVAL_USENAN} and $infty->isbad
+
+if($ActivePerl::VERSION || $Config{cc} eq 'cl') {
+ TODO: {
+
+	local $TODO = 'ActivePerl and/or perls built using MS compilers might fail this test';
+
+	ok((	$PDL::Config{BADVAL_USENAN} and $infty->isbad
+		or $infty == $infty and $infty * 0.0 != 0.0), "pdl 'inf' works by itself")
+		or diag("pdl 'inf' gave me $infty");
+	ok((	$PDL::Config{BADVAL_USENAN} and $min_inf->isbad
+		or $min_inf == $min_inf and $min_inf * 0.0 != 0.0), "pdl '-inf' works by itself")
+		or diag("pdl '-inf' gave me $min_inf");
+ } # close TODO
+}
+else {
+	ok((	$PDL::Config{BADVAL_USENAN} and $infty->isbad
 		or $infty == $infty and $infty * 0.0 != 0.0), "pdl 'inf' works by itself")
-	or diag("pdl 'inf' gave me $infty");
-ok((	$PDL::Config{BADVAL_USENAN} and $min_inf->isbad
+		or diag("pdl 'inf' gave me $infty");
+	ok((	$PDL::Config{BADVAL_USENAN} and $min_inf->isbad
 		or $min_inf == $min_inf and $min_inf * 0.0 != 0.0), "pdl '-inf' works by itself")
-	or diag("pdl '-inf' gave me $min_inf");
+		or diag("pdl '-inf' gave me $min_inf");
+}
+
 SKIP: {
 	skip "because BADVAL_USENAN makes -inf and inf both bad, "
 		. "so checking signs is silly", 1 if $PDL::Config{BADVAL_USENAN};
 	ok($min_inf == -$infty, "pdl '-inf' == -pdl 'inf'");
 }
-SKIP: {
-	skip "because perl's handling of NaN seems buggy", 2 if $skip;
-	ok((	$PDL::Config{BADVAL_USENAN} and $nan->isbad
-			or $nan != $nan), "pdl 'nan' works by itself")
-		or diag("pdl 'nan' gave me $nan");
-	ok((	$PDL::Config{BADVAL_USENAN} and $nan2->isbad
-			or $nan2 != $nan2), "pdl '-nan' works by itself")
-		or diag("pdl '-nan' gave me $nan2");
-}
+
+
+   if($ActivePerl::VERSION || $^O =~ /cygwin/i) {
+     TODO: {
+      local $TODO = 'Cygwin perl and/or ActivePerl might fail these tests';
+
+      ok((	$PDL::Config{BADVAL_USENAN} and $nan->isbad
+               or $nan != $nan), "pdl 'nan' works by itself")
+         or diag("pdl 'nan' gave me $nan");
+      ok((	$PDL::Config{BADVAL_USENAN} and $nan2->isbad
+               or $nan2 != $nan2), "pdl '-nan' works by itself")
+         or diag("pdl '-nan' gave me $nan2");
+      ok((	$PDL::Config{BADVAL_USENAN} and $nan->isbad
+               or $nan =~ /-/), "pdl 'nan' has a negative sign (MS Windows only)")
+         or diag("pdl 'nan' gave me $nan");
+      ok((	$PDL::Config{BADVAL_USENAN} and $nan2->isbad
+               or $nan2 !~ /-/), "pdl '-nan' doesn't have a negative sign (MS Windows only)")
+         or diag("pdl -'nan' gave me $nan2");
+     } #close TODO
+   }
+   else {
+     TODO: {
+      local $TODO = 'Sign of Nan depends on platform, still some loose ends';
+
+        ok((   $PDL::Config{BADVAL_USENAN} and $nan->isbad
+               or $nan != $nan), "pdl 'nan' works by itself")
+            or diag("pdl 'nan' gave me $nan");
+        ok((   $PDL::Config{BADVAL_USENAN} and $nan2->isbad
+               or $nan2 != $nan2), "pdl '-nan' works by itself")
+            or diag("pdl '-nan' gave me $nan2");
+   
+         # On MS Windows, nan is -1.#IND and -nan is 1.#QNAN. IOW, nan has
+         # a leading minus sign, and -nan is not signed.
+         if($^O =~ /MSWin32/i) {
+            ok((        $PDL::Config{BADVAL_USENAN} and $nan->isbad
+                     or $nan =~ /-/), "pdl 'nan' has a negative sign (MS Windows only)")
+               or diag("pdl 'nan' gave me $nan");
+            ok((        $PDL::Config{BADVAL_USENAN} and $nan2->isbad
+                     or $nan2 !~ /-/), "pdl '-nan' doesn't have a negative sign (MS Windows only)")
+               or diag("pdl -'nan' gave me $nan2");
+         }
+         else {
+            ok((        $PDL::Config{BADVAL_USENAN} and $nan->isbad
+                     or $nan !~ /-/), "pdl 'nan' has a positive sign")
+               or diag("pdl 'nan' gave me $nan");
+            ok((        $PDL::Config{BADVAL_USENAN} and $nan2->isbad
+                     or $nan2 =~ /-/), "pdl '-nan' has a negative sign")
+               or diag("pdl '-nan' gave me $nan2");
+         }
+      } #close TODO
+   }
+
 ok($bad->isbad, "pdl 'bad' works by itself")
 	or diag("pdl 'bad' gave me $bad");
 
 # Checks for windows strings:
 $infty = pdl q[1.#INF];
 $nan = pdl q[-1.#IND];
-ok((	$PDL::Config{BADVAL_USENAN} and $infty->isbad
+
+if($ActivePerl::VERSION || $Config{cc} eq 'cl') {
+ TODO: {
+
+	local $TODO = 'ActivePerl and/or perls built using MS compilers might fail this test';
+
+	ok((	$PDL::Config{BADVAL_USENAN} and $infty->isbad
 		or $infty == $infty and $infty * 0 != 0), "pdl '1.#INF' works")
-	or diag("pdl '1.#INF' gave me $infty");
-SKIP: {
-	skip "because perl's handling of NaN seems buggy", 1 if $skip;
+		or diag("pdl '1.#INF' gave me $infty");
+
+	ok(($PDL::Config{BADVAL_USENAN} and $nan->isbad
+		or $nan != $nan), "pdl '-1.#IND' works")
+		or diag("pdl '-1.#IND' gave me $nan");
+ } # close TODO
+}
+else {
+	ok((	$PDL::Config{BADVAL_USENAN} and $infty->isbad
+		or $infty == $infty and $infty * 0 != 0), "pdl '1.#INF' works")
+		or diag("pdl '1.#INF' gave me $infty");
+
 	ok(($PDL::Config{BADVAL_USENAN} and $nan->isbad
 		or $nan != $nan), "pdl '-1.#IND' works")
-	or diag("pdl '-1.#IND' gave me $nan");
+		or diag("pdl '-1.#IND' gave me $nan");
 }
 
 ########################
@@ -60,6 +60,7 @@ use PDL::ImageRGB;
 use PDL::Dbg;
 
 $PDL::debug = 0;
+$PDL::IO::Pic::debug = 0;
 $iform = 'PNMRAW'; # change to PNMASCII to use ASCII PNM intermediate
                    # output format
 
@@ -69,8 +70,9 @@ $iform = 'PNMRAW'; # change to PNMASCII to use ASCII PNM intermediate
 %formats = ('PNM'  => ['pnm',1,0,0.01],
 	    'GIF'  => ['gif',256,0,1.01],
 	    'TIFF' => ['tif',1,0,0.01],
-#  	    'RAST' => ['rast',256,0,0.01],
+	    'RAST' => ['rast',256,0,0.01],
 #	    'SGI'  => ['rgb',1,1,0.01],
+ 	    'PNG'  => ['png',1,1,0.01],
 	   );
 
 # only test PNM format
@@ -84,7 +84,7 @@ else { # MS Windows only
 }
 
 $pl = PDL::Graphics::PLplot->new (DEV => $dev,
-				  FILE => "test2.$dev",
+				  FILE => "test02.$dev",
 				  BACKGROUND => [255,255,255]);
 isa_ok( $pl, "PDL::Graphics::PLplot" ) or die;
 
@@ -94,28 +94,28 @@ $pl->xyplot($x, $y,
 	    BOX => [-5,10,0,200],
 	    PLOTTYPE => 'LINE');
 $pl->close;
-ok (-s "test2.$dev" > 0, "Simple line plot");
+ok (-s "test02.$dev" > 0, "Simple line plot");
 
 $pl = PDL::Graphics::PLplot->new (DEV => $dev,
-				  FILE => "test2a.$dev",
+				  FILE => "test02a.$dev",
 				  LINEWIDTH => 10,
 				  BACKGROUND => [255,255,255]);
 $pl->xyplot($x, $y,
 	    BOX => [-5,10,0,200],
 	    PLOTTYPE => 'LINE');
 $pl->close;
-ok (-s "test2a.$dev" > 0, "Simple line plot with LINEWIDTH specified");
+ok (-s "test02a.$dev" > 0, "Simple line plot with LINEWIDTH specified");
 
-$pl = PDL::Graphics::PLplot->new (DEV => $dev, FILE => "test3.$dev",
+$pl = PDL::Graphics::PLplot->new (DEV => $dev, FILE => "test03.$dev",
 				       BACKGROUND => 'WHITE');
 $pl->xyplot($x, $y, PLOTTYPE => 'POINTS', COLOR => 'BLUEVIOLET', SYMBOL => 1, SYMBOLSIZE => 4);
 $pl->close;
-ok (-s "test3.$dev" > 0, "Symbol plot");
+ok (-s "test03.$dev" > 0, "Symbol plot");
 
-$pl = PDL::Graphics::PLplot->new (DEV => $dev, FILE => "test4.$dev", FRAMECOLOR => 'BLUE');
+$pl = PDL::Graphics::PLplot->new (DEV => $dev, FILE => "test04.$dev", FRAMECOLOR => 'BLUE');
 $pl->xyplot($x, $y, PLOTTYPE => 'LINEPOINTS', COLOR => [50,230,30]);
 $pl->close;
-ok (-s "test4.$dev" > 0, "Lines and symbols");
+ok (-s "test04.$dev" > 0, "Lines and symbols");
 
 $y = sequence(30)+1;
 my $m = (50* (exp(1/$y**2) - 1) * random (30,20))->xchg(0,1);
@@ -127,9 +127,9 @@ my $n  = 500 - exp($y/5);
 #$pl = PDL::Graphics::PLplot->new (DEV => "xwin", FILE => "trillian.cosmic.ucar.edu:0");
 
 # Setting text to 1 like this does not work.  text is hard coded in ps.c ;(
-#$pl = PDL::Graphics::PLplot->new (DEV => "psc", FILE => "test5.ps", OPTS => {'text' => '1'});
+#$pl = PDL::Graphics::PLplot->new (DEV => "psc", FILE => "test05.ps", OPTS => {'text' => '1'});
 
-$pl = PDL::Graphics::PLplot->new (DEV => $dev, FILE => "test5.$dev");
+$pl = PDL::Graphics::PLplot->new (DEV => $dev, FILE => "test05.$dev");
 $pl->xyplot($x1,   $y, COLOR => 'GREEN',
 	               BOX   => [($mean - $rms)->minmax, $y->minmax],
 	               XBOX  => 'bnst', # bottom line, bottom numbers, ticks, subticks
@@ -149,43 +149,43 @@ $pl->text("Count", COLOR => 'PINK',
                                                         # center of string, middle of axis
 
 $pl->close;
-ok (-s "test5.$dev" > 0, "Sample layer statistics plot");
+ok (-s "test05.$dev" > 0, "Sample layer statistics plot");
 
 # test of setting page size.
 $pl = PDL::Graphics::PLplot->new (DEV => $dev,
-				       FILE => "test6.$dev",
+				       FILE => "test06.$dev",
 				       PAGESIZE => [50,80]);
 $x  = sequence(10);
 $y  = $x**2;
 $pl->xyplot($x, $y, PLOTTYPE => 'LINE');
 $pl->close;
-ok (-s "test6.$dev" > 0, "Setting pagesize");
+ok (-s "test06.$dev" > 0, "Setting pagesize");
 
 # test of lines with gaps (plgapline)
 $pl = PDL::Graphics::PLplot->new (DEV => $dev,
-				  FILE => "test7.$dev");
+				  FILE => "test07.$dev");
 $x  = sequence(10);
 $y  = $x**2;
 $x->inplace->setbadat(5); # insert gap
 $y->inplace->setbadat(5); # insert gap
 $pl->xyplot($x, $y, PLOTTYPE => 'LINE');
 $pl->close;
-ok (-s "test7.$dev" > 0, "Line plot with gaps (plgapline)");
+ok (-s "test07.$dev" > 0, "Line plot with gaps (plgapline)");
 
 # test of setting JUSTify = 1
-$pl = PDL::Graphics::PLplot->new (DEV => $dev, FILE => "test8.$dev");
+$pl = PDL::Graphics::PLplot->new (DEV => $dev, FILE => "test08.$dev");
 $x  = sequence(10);
 $y  = $x**2;
 $pl->xyplot($x, $y, PLOTTYPE => 'LINEPOINTS', JUST => 1);
 $pl->close;
-ok (-s "test8.$dev" > 0, "Setting JUSTify = 1");
+ok (-s "test08.$dev" > 0, "Setting JUSTify = 1");
 
-$pl = PDL::Graphics::PLplot->new (DEV  => $dev, FILE => "test9.$dev");
+$pl = PDL::Graphics::PLplot->new (DEV  => $dev, FILE => "test09.$dev");
 
 $pl->text("Test string outside of window", TEXTPOSITION => ['T', 1, 0, 0]);
 $pl->text("Test string inside window",     TEXTPOSITION => [0, 0, 0.5, 0.5, 0]);
 $pl->close;
-ok (-s "test9.$dev" > 0, "Printing text inside and outside of plot window");
+ok (-s "test09.$dev" > 0, "Printing text inside and outside of plot window");
 
 my $pi = atan2(1,1)*4;
 my $a  = (sequence(20)/20) * 2 * $pi;
@@ -494,10 +494,9 @@ for my $i (1 .. 120) {
 }
 ok ($count == 120, "Opening/closing of > 100 streams");
 
-$pltfile = "test28.$dev";
 
 SKIP: {
-  skip 'Not compiled with POSIX threads', 1 unless ($PDL::Config{WITH_POSIX_THREADS} == 1);
+  skip 'Not compiled with POSIX threads', 1 if (($PDL::Config{WITH_POSIX_THREADS} == 0) || ($^O =~/darwin/i));
 
   my $pltfile = "test28.$dev";
   if($^O =~ /MSWin32/i) {
@@ -21,7 +21,7 @@ eval {
 
 my $err_msg = $@;
 isnt($@, undef, 'loop without dim name should throw an error');
-like($@, qr/Expected.*loop.*%{/, 'loop without dim name should explain the error')
+like($@, qr/Expected.*loop.*%\{/, 'loop without dim name should explain the error')
 	or diag("Got this error: $@");
 
 TODO: {
@@ -1,10 +1,18 @@
-use Test::More tests => 23;
+use Test::More tests => 24;
+use Test::Warn;
 
 use PDL::LiteF;
-use PDL::Tests;
 use PDL::Types;
 use PDL::Dbg;
 
+BEGIN
+{
+  warning_like{ require PDL::Tests; PDL::Tests->import; }
+    qr/deprecated.*PDL::Test::Fancy/,
+    "PP deprecation should emit warnings";
+}
+
+
 kill INT,$$ if $ENV{UNDER_DEBUGGER}; # Useful for debugging.
 
 # Is there any good reason we don't use PDL's approx function?
@@ -121,7 +121,8 @@ SKIP: {
    foreach my $i ( 0 .. $#slices )
    {
       my $str = $slices[$i];
-      my $slice = $eqc->slice($str);
+      my $slice = $eqc->slice($str)->copy;
+      $slice->badflag(0);
       # ok( "$slice" eq $ref_eqc_slices[$i], "check ref_eqc for slices[$i]" );
       is( "$slice", $ref_eqc_slices[$i], "check ref_eqc for slices[$i]" );
    }
@@ -138,7 +139,8 @@ SKIP: {
    foreach my $i ( 0 .. $#slices )
    {
       my $str = $slices[$i];
-      my $slice = $ortho->slice($str);
+      my $slice = $ortho->slice($str)->copy;
+      $slice->badflag(0);
       # ok( "$slice" eq $ref_ortho_slices[$i], "check ref_ortho for slices[$i]" );
       is( "$slice", $ref_ortho_slices[$i], "check ref_ortho for slices[$i]" );
    }
@@ -153,7 +155,8 @@ SKIP: {
    foreach my $i ( 0 .. $#slices )
    {
       my $str = $slices[$i];
-      my $slice = $ortho2->slice($str);
+      my $slice = $ortho2->slice($str)->copy;
+      $slice->badflag(0);
       # ok( "$slice" eq $ref_ortho_slices[$i], "check ref_ortho2 for slices[$i]" );
       is( "$slice", $ref_ortho_slices[$i], "check ref_ortho2 for slices[$i]" );
    }
@@ -0,0 +1,44 @@
+use strict;
+use warnings;
+use PDL;
+use PDL::IO::Pic;
+use Test::More tests => 3;
+
+# The rim() function was failing badly for a number of reasons ...
+# and perhaps is still failing.
+# See http://mailman.jach.hawaii.edu/pipermail/pdl-porters/2012-July/004916.html
+# This script serves firstly as a reminder that rim() needs fixing,
+# and subsequently that it stays in a basically functional form.
+# AFAIK, this script itself breaks none of the rules regarding the
+# the usage of the rim() function - Sisyphus.
+
+my $cols = 3;
+my $rows = 3;
+
+my $ext = 'pnm';
+my $fmt = uc($ext);
+
+my $file = "ushort.$ext";
+
+my $in  = sequence($cols, $rows)->ushort * 213;
+$in->wpic($file, {FORMAT => $fmt});
+
+my $out1 = rim($file, {FORMAT => $fmt});
+
+my $out2 = sequence($cols, $rows);
+rim($out2, $file, {FORMAT => $fmt});
+
+my $out3 = PDL->rpic($file, {FORMAT => $fmt});
+
+# Test 1
+ok(sum(abs($out1 - $out2)) == 0, "\$out1 & \$out2 are the same");
+
+# Test 2
+ok(sum(abs($out3 - $out2)) == 0, "\$out3 & \$out2 are the same");
+
+# Test 3
+ok(sum(abs($out1 - $in  )) == 0, "\$out1 & \$in are the same");
+
+END {
+ unlink $file;
+};
@@ -11,7 +11,7 @@ BEGIN {
 		$ntests -= 3 unless ($PDL::Config{WITH_BADVAL}); # two fewer tests if no bad val support
 		plan tests => $ntests;
 	} else { 
-		print "$@\n";
+           ## print STDERR "$@\n";
 		plan skip_all => 'PDL::Slatec not available';
 	}
 }
@@ -31,7 +31,7 @@ my $mat = pdl [1,0.1],[0.1,2];
 
 ($eigvals,$eigvecs) = eigsys($mat);
 
-print $eigvecs,$eigvals,"\n";
+## print STDERR $eigvecs,$eigvals,"\n";
 
 ok(tapprox($eigvals,pdl(0.9901,2.009)));
 ok(!tapprox($eigvals,pdl(0.99,2.5)));
@@ -44,17 +44,17 @@ $inv = matinv($mat);
 
 inner($mat->dummy(2),$inv->xchg(0,1)->dummy(1),($uni=null));
 
-print $mat;
-print $inv;
+## print STDERR $mat;
+## print STDERR $inv;
 
-print $uni;
+## print STDERR $uni;
 
 ok(tapprox($uni,pdl[1,0],[0,1]));
 
 $det = $mat->det;
-$det->dump;
+## $det->dump;
 $deti = $inv->det;
-$deti->dump;
+## $deti->dump;
 
 ok(tapprox($det,-2));
 ok(tapprox($deti,-0.5));
@@ -77,8 +77,8 @@ if ($PDL::Config{WITH_BADVAL}) {
   $y->inplace->setbadat(3);
   ($ndeg, $r, $ierr, $a) = polyfit($x, $y, $w, $maxdeg, $eps);
 
-  print "NDEG, EPS, IERR: $ndeg, $eps, $ierr\n";
-  print "poly = $r\n";
+  ## print STDERR "NDEG, EPS, IERR: $ndeg, $eps, $ierr\n";
+  ## print STDERR "poly = $r\n";
 
   ok(($ierr == 1));
 
@@ -86,8 +86,8 @@ if ($PDL::Config{WITH_BADVAL}) {
   $y = zeroes(9)->setbadif(1);
   ($ndeg, $r, $ierr, $a) = polyfit($x, $y, $w, $maxdeg, $eps);
 
-  print "NDEG, EPS, IERR: $ndeg, $eps, $ierr\n";
-  print "poly = $r\n";
+  ## print STDERR "NDEG, EPS, IERR: $ndeg, $eps, $ierr\n";
+  ## print STDERR "poly = $r\n";
 
   ok(($ierr == 2));
 
@@ -105,8 +105,8 @@ if ($PDL::Config{WITH_BADVAL}) {
 
   ($ndeg, $r, $ierr, $a) = polyfit($x, $y, $w, $maxdeg, $eps);
 
-  print "NDEG, EPS, IERR: $ndeg, $eps, $ierr\n";
-  print "poly = $r\n";
+  ## print STDERR "NDEG, EPS, IERR: $ndeg, $eps, $ierr\n";
+  ## print STDERR "poly = $r\n";
 
   ok((sum($ierr == 1) == 2));
 
@@ -122,8 +122,8 @@ $eps = pdl(0);
 # Do the fit
 my ($ndeg, $r, $ierr, $a) = polyfit($x, $y, $w, $maxdeg, $eps);
 
-print "NDEG, EPS, IERR: $ndeg, $eps, $ierr\n";
-print "poly = $r\n";
+## print STDERR "NDEG, EPS, IERR: $ndeg, $eps, $ierr\n";
+## print STDERR "poly = $r\n";
 
 ok(($ierr == 1));
 
@@ -145,7 +145,7 @@ foreach my $xpos ($x->list) {
     $ypos += $bit * ($xpos- (($c->list)[0]))**$n;
     $n++;
   }
-  print "$xpos, $ypos, $r[$i]\n";
+  ## print STDERR "$xpos, $ypos, $r[$i]\n";
 
   # Compare with answers from polyfit
   ok(sprintf("%5.2f", $ypos) == sprintf("%5.2f", $r[$i]));
@@ -159,7 +159,7 @@ my $nder = 3;
 
 my ($yfit, $yp) = polyvalue($ndeg, $nder, $xx, $a);
 
-print "At $xx, $yfit and $yp\n";
+## print STDERR "At $xx, $yfit and $yp\n";
 ok(int($yp->at(0)) == 8);
 
 # Test polyvalue
@@ -168,7 +168,7 @@ $xx    = pdl(12,4,6.25,1.5); # Ask for multiple positions at once
 
 ($yfit, $yp) = polyvalue($ndeg, $nder, $xx, $a);
 
-print "At $xx is $yfit and $yp\n";
+## print STDERR "At $xx is $yfit and $yp\n";
 
 # Simple test of expected value                                               
 ok(int($yfit->at(1)) == 15);            
@@ -257,8 +257,8 @@ $ans = ($hi**3 - $lo**3) / 3;
 ( $int, $err ) = chid( $x, $f, $d, 1, pdl(0,1), pdl(9,7) );
 ok(all($err == 0));
 ok(all( abs($int-$ans) < 0.06 ) );
-print "int=$int; ans=$ans; int-ans=".($int-$ans)."\n";
-print "ref ans=".(ref $ans)."\n";
+## print STDERR "int=$int; ans=$ans; int-ans=".($int-$ans)."\n";
+## print STDERR "ref ans=".(ref $ans)."\n";
 
 =pod ignore as have commented out chbs interface
 
@@ -0,0 +1,48 @@
+use strict;
+use warnings;
+use PDL;
+use Test::More;
+
+for my $start (0, 4, -4, 20, -20) {
+	for my $stop (0, 4, -4, 20, -20) {
+		# Generate a simple data piddle and a bad slice of that piddle
+		my $data = sequence(10);
+		my $slice = $data->slice("$start:$stop");
+
+		pass('Slice operation for properly formed slice does not croak');
+
+		# Calculate the expected dimension size:
+		my $expected_dim_size;
+		my $real_start = $start;
+		$real_start += 10 if $start < 0;
+		my $real_stop = $stop;
+		$real_stop += 10 if $stop < 0;
+		$expected_dim_size = abs($real_stop - $real_start) + 1
+			if 0 <= $real_stop and $real_stop < 10
+				and 0 <= $real_start and $real_start < 10;
+		
+		my $expected_outcome_description
+			= defined $expected_dim_size ? 'is fine' : 'croaks';
+		
+		my $dim1;
+		# Should croak when we ask about the dimension:
+		eval { $dim1 = $slice->dim(0) };
+		is($dim1, $expected_dim_size, "Requesting dim(0) on slice($start:$stop) $expected_outcome_description");
+
+		# Should *STILL* croak when we ask about the dimension:
+		eval { $dim1 = $slice->dim(0) };
+		is($dim1, $expected_dim_size, "Requesting dim(0) a second time on slice($start:$stop) $expected_outcome_description");
+
+		# Calculate the expected value
+		my $expected_value;
+		$expected_value = $data->at($real_start) if defined $expected_dim_size;
+		
+		# Should croak when we ask about data
+		my $value;
+		eval { $value = $slice->at(0) };
+		is($value, $expected_value, "Requesting first element on slice($start:$stop) $expected_outcome_description");
+	}
+}
+
+
+done_testing;
@@ -1,17 +1,11 @@
 # -*-perl-*-
 #
-# Test ->slice(). This is not yet good enough: we need
-# nasty test cases
-#
-# Okay -- here're a couple (CED 3-apr-2002).
-#	 Added permissive-slicing tests
-#
 
 use strict;
 use Test::More;
 
-plan tests => 74;
-
+plan tests => 86;
+    ;
 use PDL::LiteF;
 
 # PDL::Core::set_debugging(1);
@@ -34,17 +28,11 @@ my ($a, $b, $c, $d, $e, $f);
 
 $a = (1+(xvals zeroes 4,5) + 10*(yvals zeroes 4,5));
 
-print "FOO\n";
-
-print $a;
-
-print "BAR\n";
-
 is($a->at(2,2), 23);
 
 $b = $a->slice('1:3:2,2:4:2');
 
-# print $a; print $b;
+# diag($a); diag($b);
 
 is($b->at(0,0), 22);
 is($b->at(1,0), 24);
@@ -57,8 +45,6 @@ $b .= 0.5 * ones(2,2);
 is($b->at(1,0), 0.5);
 is($b->at(0,1), 0.5);
 
-print $a;
-
 is($a->at(1,2), 0.5);
 
 # Check that nothing happened to other elems
@@ -68,8 +54,6 @@ $a = pdl (1,2);
 $b = pdl [[1,2],[1,2],[1,2]];
 $c = $a->slice(',*3');
 
-print $a,$b,$c;
-
 # check dimensions, sum of elements and correct order of els (using tapprox)
 
 my $sum;
@@ -105,24 +89,18 @@ $c = $b->slice(":,:,1");
 
 is(join(',',$c->dims), "5,3,1");
 
-eval { my $d = $c->slice(":,:,2"); print $d; };
+eval { my $d = $c->slice(":,:,2"); "$d" };
 
-like($@, qr/Slice cannot start or end/, 'check slice bounds error handling') or diag "ERROR WAS: '$@'\n" if $@;
+like($@, qr/out of bounds/, 'check slice bounds error handling') or diag "ERROR WAS: '$@'\n" if $@;
 
 $a = zeroes 3,3;
-print $a;
 
 $b = $a->slice("1,1:2");
 
-# print $b;
-
 $b .= 1;
 
-print $b;
-print $a;
 
 $a = xvals zeroes 20,20;
-print $a;
 
 $b = $a->slice("1:18:2,:");
 $c = $b->slice(":,1:18:2");
@@ -130,11 +108,11 @@ $d = $c->slice("3:5,:");
 $e = $d->slice(":,(0)");
 $f = $d->slice(":,(1)");
 
-print "TOPRINT\n";
-
-# print $b;
-print $e,$f;
-print $d,$c,$b,$a;
+"$b";
+"$c"; 
+"$d";
+"$e";
+"$f";
 
 is("$e", "[7 9 11]");
 is("$f", "[7 9 11]");
@@ -147,8 +125,6 @@ $b = (xvals $a) + 0.1 * (yvals $a) + 0.01 * (zvals $a);
 
 $b = $b->copy;
 
-print $b;
-
 $c = $b->slice("2:3");
 
 $d = $c->copy;
@@ -158,31 +134,22 @@ $d = $c->copy;
 
 $e = $c-$d;
 
-print $e;
-
-print $c;
-print $d;
-
 # $c->dump; $d->dump;
 
 is(max(abs($e)), 0);
 
-print "OUTOUTOUT!\n";
-
 use PDL::Dbg;
 
 my ($im, $im1, $im2, $lut, $in);
 
 $im = byte [[0,1,255],[0,0,0],[1,1,1]];
 ($im1 = null) .= $im->dummy(0,3);
-# print("1..2\n");
-print $im1;
-print ($im2 = $im1->clump(2)->slice(':,0:2')->px);
+$im2 = $im1->clump(2)->slice(':,0:2')->px;
 
 ok(!tapprox(ones(byte,9,3),$im2));
 
 # here we encounter the problem
-print ($im2 = $im1->clump(2)->slice(':,-1:0')->px);
+$im2 = $im1->clump(2)->slice(':,-1:0')->px;
 ok(!tapprox(ones(byte,9,3),$im2));
 
 $a = xvals( zeroes 10,10) + 0.1*yvals(zeroes 10,10);
@@ -217,8 +184,8 @@ $b = $a->slice('0:-10');
 is("$b", "[0]", "slice 0:-n picks first element");
 
 $b = $a->slice('0:-14');
-eval 'print $b';
-like($@, qr/Negative slice cannot start or end above limit/);
+eval '"$b";';
+like($@, qr/slice ends out of bounds/);
 
 # Test of dice and dice_axis
 $a = sequence(10,4);
@@ -240,7 +207,6 @@ $b = $a->dummy(-1,2);
 is(join(',',$b->dims), '3,4,2');
 
 $a = pdl(2);
-print "a\n";
 $b = $a->slice('');
 ok(tapprox($a, $b), "Empty slice");
 
@@ -276,6 +242,35 @@ eval '$b = $a->lags(0,1,11)->make_physdims';
 like($@, qr/too large/, "make_pyhsdim: too large");
 
 ##############################
+# Tests of some edge cases
+$a = sequence(10);
+eval '$b = $a->slice("5")';
+ok(!$@, "simple slice works");
+ok(($b->nelem==1 and $b==5), "simple slice works right");
+
+eval '$b = $a->slice("5:")';
+ok(!$@, "empty second specifier works");
+ok(($b->nelem == 5  and  all($b == pdl(5,6,7,8,9))), "empty second specifier works right");
+
+eval '$b = $a->slice(":5")';
+ok(!$@, "empty first specifier works");
+ok(($b->nelem == 6  and  all($b == pdl(0,1,2,3,4,5))), "empty first specifier works right");
+
+##############################
+# White space in slice specifier
+eval ' $b = $a->slice(" 4:");';
+ok(!$@,"slice with whitespace worked - 1");
+ok(($b->nelem==6 and all($b==pdl(4,5,6,7,8,9))),"slice with whitespace works right - 1");
+eval ' $b = $a->slice(" :4");';
+ok(!$@,"slice with whitespace worked - 2");
+ok(($b->nelem==5 and all($b==pdl(0,1,2,3,4))),"slice with whitespace works right - 2");
+eval ' $b = $a->slice(" 3: 4 ");';
+ok(!$@,"slice with whitespace worked - 3");
+ok(($b->nelem==2 and all($b==pdl(3,4))),"slice with whitespace works right - 3");
+
+
+
+##############################
 # Tests of permissive slicing and dummying
 
 $a = xvals(5,5)+10*yvals(5,5);
@@ -386,3 +381,4 @@ ok("$z" eq 'Empty[0]');
 $z .= 2;
 ok(1);            # should *not* segfault!
 ok(all($a==5));   # should *not* change $a!
+
@@ -1,17 +1,10 @@
-
+#!/usr/bin/perl
+#
 use PDL::LiteF;
+use Test::More tests => 6;
 
 # Test PDL Subclassing via hashes
 
-sub ok {
-        my $no = shift ;
-        my $result = shift ;
-        print "not " unless $result ;
-        print "ok $no\n" ;
-}
-
-print "1..6\n";
-
 ########### First test normal subclassing ###########
 
 package PDL::Derived;
@@ -37,17 +30,17 @@ $z = PDL::Derived->new( ones(5,5) ) ;
 
 $z++;
 
-ok(1, sum($z)==50);
+ok(sum($z)==50, "derived object does PDL stuff");
 
 # And should also have extra bits
 
-ok(2, $$z{SomethingElse}==42 );
+ok($$z{SomethingElse}==42, "derived has extra bits" );
 
 # And survive destruction
 
 undef $z;
 
-ok(3, 1==1);
+ok(1==1, "survives distruction");  # huh?
 
 
 ########### Now test magic subclassing i.e. PDL=code ref ###########
@@ -93,16 +86,15 @@ $z = PDL::Derived2->new(5);
 
 $z++;
 
-ok(4, sum($z)==100);
+ok(sum($z)==100, "derived2 has PDL properties");
 
 # And should also have extra bits
 
-ok(5, $$z{SomethingElse}==42 );
+ok($$z{SomethingElse}==42, "derived2 has extra bits" );
 
 # And survive destruction
 
 undef $z;
 
-ok(6, 1==1);
-
+ok(1==1, "derived2 survives destruction");
 
@@ -1,3 +1,6 @@
+#!/usr/bin/perl
+#
+
 ### Example of subclassing #####
 ###  This script tests for proper output value typing of the major
 ###   categories of PDL primitive operations.
@@ -6,20 +9,11 @@
 ###              then $pdlderived->sumover should return a PDL::derived object.
 ###      
 use PDL::LiteF;
+use Test::More tests => 13;
 
 
 # Test PDL Subclassing via hashes
 
-sub ok {
-        my $no = shift ;
-        my $result = shift ;
-        print "not " unless $result ;
-        print "ok $no\n" ;
-}
-
-print "1..13\n";      
-
-
 ########### Subclass typing Test ###########
 
 ##  First define a PDL-derived object:
@@ -80,62 +74,60 @@ package main;
 
 $z = PDL::Derived->new( ones(5,5) ) ;
 
-
-ok(1,ref($z)eq"PDL::Derived");
+ok(ref($z)eq"PDL::Derived", "create derived instance");
 
 
 
 #### Check the type after incrementing:
 $z++;
-ok(2,ref($z) eq "PDL::Derived");
+ok(ref($z) eq "PDL::Derived", "check type after incrementing");
 
 
 #### Check the type after performing sumover:
 $y = $z->sumover;
-ok(3,ref($y) eq "PDL::Derived");
+ok(ref($y) eq "PDL::Derived", "check type after sumover");
 
 
 #### Check the type after adding two PDL::Derived objects:
 $x = PDL::Derived->new( ones(5,5) ) ;
 $w = $x + $z;
-ok(4,ref($w) eq "PDL::Derived");
+ok(ref($w) eq "PDL::Derived", "check type after adding");
 
 #### Check the type after calling null:
 $a = PDL::Derived->null();
-ok(5,ref($a) eq "PDL::Derived");
+ok(ref($a) eq "PDL::Derived", "check type after calling null");
 
 
 
 ##### Check the type for a byops2 operation:
 $w = ($x == $z);
-ok(6,ref($w) eq "PDL::Derived");
+ok(ref($w) eq "PDL::Derived", "check type for byops2 operation");
 
 ##### Check the type for a byops3 operation:
 $w = ($x | $z);
-ok(7,ref($w) eq "PDL::Derived");
+ok(ref($w) eq "PDL::Derived", "check type for byops3 operation");
 
 ##### Check the type for a ufuncs1 operation:
 $w = sqrt($z);
-ok(8,ref($w) eq "PDL::Derived");
+ok(ref($w) eq "PDL::Derived", "check type for ufuncs1 operation");
 
 ##### Check the type for a ufuncs1f operation:
 $w = sin($z);
-ok(9,ref($w) eq "PDL::Derived");
+ok(ref($w) eq "PDL::Derived", "check type for ufuncs1f operation");
 
 ##### Check the type for a ufuncs2 operation:
 $w = ! $z;
-ok(10,ref($w) eq "PDL::Derived");
+ok(ref($w) eq "PDL::Derived", "check type for ufuncs2 operation");
 
 ##### Check the type for a ufuncs2f operation:
 $w = log $z;
-ok(11,ref($w) eq "PDL::Derived");
+ok(ref($w) eq "PDL::Derived", "check type for ufuncs2f operation");
 
 ##### Check the type for a bifuncs operation:
 $w =  $z**2;
-ok(12,ref($w) eq "PDL::Derived");
+ok(ref($w) eq "PDL::Derived", "check type for bifuncs operation");
 
 ##### Check the type for a slicing operation:
 $a = PDL::Derived->new(1+(xvals zeroes 4,5) + 10*(yvals zeroes 4,5));
 $w = $a->slice('1:3:2,2:4:2');
-ok(13,ref($w) eq "PDL::Derived");
-
+ok(ref($w) eq "PDL::Derived", "check type for slicing operation");
@@ -1,6 +1,7 @@
-
+#!/usr/bin/perl
+#
 use PDL::LiteF;
-
+use Test::More tests => 7;
 
 
 ########### Test of method over-riding in subclassed objects ###########
@@ -123,9 +124,6 @@ sub one2nd{
 package main;
 
 ###### Testing Begins #########
-print "1..7\n";   
-
-my $testNo = 1;
 
 $im = new PDL::Derived [
   [ 1, 2,  3,  3 , 5],
@@ -137,20 +135,20 @@ $im = new PDL::Derived [
 
 
 # Check for PDL::sumover being called by sum
-ok($testNo++, $im->sum == 176 ); # result will be = 134 if derived sumover not called, 176 if it is called.
-
+ok($im->sum == 176, "PDL::sumover is called by sum" ); # result will be = 134 if derived sumover
+                                                       # is not called,   176 if it is called.
 
 ### Test over-ride of minmaximum:
 $main::OVERRIDEWORKED = 0;
 my @minMax = $im->minmax;
-ok($testNo++, $main::OVERRIDEWORKED == 1 );
+ok($main::OVERRIDEWORKED == 1, "over-ride of minmaximum");
 
 
 ### Test over-ride of inner:
 ## Update to use inner, not matrix mult - CED 8-May-2010
 $main::OVERRIDEWORKED = 0;
 my $matMultRes = $im->inner($im);
-ok($testNo++, $main::OVERRIDEWORKED == 1 );
+ok($main::OVERRIDEWORKED == 1, "over-ride of inner");
 
 ### Test over-ride of which, one2nd
 $main::OVERRIDEWORKED = 0;
@@ -158,22 +156,11 @@ $main::OVERRIDEWORKED = 0;
 my $a= PDL::Derived->sequence(10,10,3,4);     
 # $PDL::whichND_no_warning = 1;
 # my ($x, $y, $z, $w)=whichND($a == 203);
-# ok($testNo++, $main::OVERRIDEWORKED == 2 );
+# ok($main::OVERRIDEWORKED == 2, "whichND test");
 my ($x, $y, $z, $w) = whichND($a == 203)->mv(0,-1)->dog;  # quiet deprecation warning
-ok($testNo++, $main::OVERRIDEWORKED == 1 );               # whitebox test condition, uugh!
+ok($main::OVERRIDEWORKED == 1, "whichND worked");         # whitebox test condition, uugh!
 
 # Check to see if the clip functions return a derived object:
-ok( $testNo++, ref( $im->clip(5,7) ) eq "PDL::Derived");
- 
-ok( $testNo++, ref( $im->hclip(5) ) eq "PDL::Derived");
-
-ok( $testNo++, ref( $im->lclip(5) ) eq "PDL::Derived");
- 
-
-
-sub ok {
-        my $no = shift ;
-        my $result = shift ;
-        print "not " unless $result ;
-        print "ok $no\n" ;
-}
+ok(ref( $im->clip(5,7) ) eq "PDL::Derived", "clip returns derived object");
+ok(ref( $im->hclip(5) ) eq "PDL::Derived", "hclip returns derived object");
+ok(ref( $im->lclip(5) ) eq "PDL::Derived", "lclip returns derived object");
@@ -1,6 +1,7 @@
-
+#!/usr/bin/perl
+#
 use PDL::LiteF;
-
+use Test::More tests => 8;
 
 
 ########### Test of Subclassed-object copying for simple function cases ###########
@@ -10,7 +11,6 @@ use PDL::LiteF;
 package PDL::Derived;
 @PDL::Derived::ISA = qw/PDL/;
 
-
 sub new {
    my $class = shift;
 
@@ -61,9 +61,6 @@ sub copy {
 package main;
 
 ###### Testing Begins #########
-print "1..8\n";   
-
-my $testNo = 1;
 
 # Create New PDL::Derived Object
 #   (Initialize sets 'someThingElse' data member
@@ -88,14 +85,5 @@ foreach my $op( @simpleFuncs){
 	
 	$w = $im->$op(); 
 
-	ok($testNo++, $w->{someThingElse} == 24 ); 
-}
-
-
-
-sub ok {
-        my $no = shift ;
-        my $result = shift ;
-        print "not " unless $result ;
-        print "ok $no\n" ;
+	ok($w->{someThingElse} == 24, "$op subclassed object correctly"); 
 }
@@ -2,20 +2,19 @@ use PDL::LiteF;
 use Test;
 
 BEGIN {
-  plan tests => 4;
+  plan tests => 10;
 }
 
 use PDL::Transform;
 
 ##############################
-# Just simple testing of the map autoscaling -- more complete tests should be
-# included... -CED 13-Oct-2006
+# Simple testing of the map autoscaling
 
 $a = sequence(5,5);
 
 # Identity transformation should be an expensive no-op
 # (autoscaled correctly)
-$b = $a->map(t_identity);
+$b = $a->map(t_identity());
 ok( all($a==$b) );
 
 # Identity transformation on pixels should be a slightly less expensive
@@ -32,4 +31,48 @@ ok( all($a==$b) );
 $b = $a->map(t_scale(2),{pix=>1});
 ok(all($b == $a*0.5));
 
+##############################
+# diab jerius' t_scale crash
+# (this is due to a problem with inplace flag handling in PDL <= 2.6; transform works around it)
+
+$a = pdl(49,49);
+$t = t_linear({scale=>pdl([1,3]), offset=>pdl([12,8])});
+$b = pdl( double, 2.2, 9.3);
+print "apply\n";
+$a->inplace->apply($t);
+print "add q\n";
+$a += $q;
+ok(1);  # still here!
+
+##############################
+# bad value handling...
+
+if($PDL::Bad::Status) {
+    $a = sequence(5,5);
+    $t1 = t_linear(pre=>[1.5,2]);
+    $t2 = t_linear(pre=>[1,2]);
+
+    $a->badflag(1);
+
+    eval q{$b = $a->map($t1,{pix=>1,method=>'l'});};
+    ok(!$@);
+
+    ok($b->slice("0:1")->isbad->all  and  $b->slice(":,0:1")->isbad->all  and $b->isbad->sum==16, "Bad values happen");
+
+    eval q{$b = $a->map($t1,{pix=>1,method=>'h'});};
+    ok($b->slice("0")->isbad->all  and  $b->slice(":,0:1")->isbad->all and $b->isbad->sum==13, "Bad values happen with 'h' method"); 
+    
+
+} else {
+    skip(3, "Bad value support not included");
+}
+
+
+use PDL::IO::FITS;
+$m51 = rfits('m51.fits');
+$m51map = $m51->map(t_identity,{method=>'s'}); #SHOULD be a no-op
+ok(all($m51==$m51map));
 
+$m51_coords = pdl(0,0)->apply(t_fits($m51));
+$m51map_coords = pdl(0,0)->apply(t_fits($m51map));
+ok(all(approx($m51_coords, $m51map_coords,1e-8)));
@@ -3,7 +3,7 @@
 # Test some Basic/Ufunc routines
 
 use strict;
-use Test::More tests => 15;
+use Test::More tests => 31;
 
 BEGIN {
     # if we've got this far in the tests then 
@@ -16,8 +16,9 @@ $| = 1;
 sub tapprox ($$) {
     my ( $a, $b ) = @_;
     my $d = abs( $a - $b );
-    print "diff = [$d]\n";
-    return $d <= 0.0001;
+    my $check = ($d <= 0.0001);
+    diag "diff = [$d]\n" unless $check;
+    return $check;
 }
 
 # set up test arrays
@@ -28,6 +29,10 @@ my $b = pdl(55);
 my $b_sort = $b->qsort;
 my $c = cat($a,$a);
 my $c_sort = $c->qsort;
+my $d = sequence(10)->rotate(1);
+my $d_sort = $d->qsort;
+my $e = pdl([[1,2],[0,500],[2,3],[4,2],[3,4],[3,5]]);
+my $e_sort = $e->qsortvec;
 
 # Test a range of values
 ok( tapprox($a->pctover(-0.5), $a_sort->at(0)), "pct below 0 for 25-elem pdl" );
@@ -46,6 +51,26 @@ ok( tapprox($x->pctover(0.23), 2.07), "23rd percential of 10-elem piddle [SF bug
 #
 ok( ( eval { pdl([])->qsorti }, $@ eq '' ), "qsorti coredump,[SF bug 2110074]");
 
+# Test inplace sorting
+$d->inplace->qsort;
+ok(all($d == $d_sort));
+
+# Test inplace sorting with bad values
+$d->setbadat(3);
+$d_sort = $d->qsort;
+$d->inplace->qsort;
+ok(all($d == $d_sort));
+
+# Test inplace lexicographical sorting
+$e->inplace->qsortvec;
+ok(all($e == $e_sort));
+
+# Test inplace lexicographical sorting with bad values
+$e->setbadat(1,3);
+$e_sort = $e->qsortvec;
+$e->inplace->qsortvec;
+ok(all($e == $e_sort));
+
 # test bad value handling with pctover
 #
 SKIP: {
@@ -77,3 +102,35 @@ TODO: {
    ok($a->min == $b->min, "min with NaNs");
    ok($a->max == $b->max, "max with NaNs");
 }
+
+
+#Test subroutines directly.
+
+#set up piddles
+my $f=pdl(1,2,3,4,5);
+my $g=pdl (0,1);
+my $h=pdl(1, 0,-1);
+my $i=pdl (1,0);
+my $j=pdl(-3, 3, -5, 10);
+
+#Test percentile routines
+#Test PDL::pct
+ok (tapprox(PDL::pct($f, .5),     3), 'PDL::pct 50th percentile');
+ok (tapprox(PDL::pct($g, .76), 0.76), 'PDL::pct interpolation test');
+ok (tapprox(PDL::pct($i, .76), 0.76), 'PDL::pct interpolation not in order test');
+
+#Test PDL::oddpct
+ok (tapprox(PDL::oddpct($f, .5),  3), 'PDL::oddpct 50th percentile');
+ok (tapprox(PDL::oddpct($f, .79), 4), 'PDL::oddpct intermediate value test');
+ok (tapprox(PDL::oddpct($h, .5),  0), 'PDL::oddpct 3-member 50th percentile with negative value');
+ok (tapprox(PDL::oddpct($j, .1), -5), 'PDL::oddpct negative values in-between test');
+
+#Test oddmedian
+ok (PDL::oddmedian($g) ==  0, 'Oddmedian 2-value piddle test');
+ok (PDL::oddmedian($h) ==  0, 'Oddmedian 3-value not in order test');
+ok (PDL::oddmedian($j) == -3, 'Oddmedian negative values even cardinality test');
+
+#Test mode and modeover
+my $a = pdl([1,2,3,3,4,3,2],1);
+ok( $a->mode == 0, "mode test" );
+ok( all($a->modeover == pdl(3,0)), "modeover test");
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+
+use PDL;
+use Test::More tests => 1;
+
+my $array = [
+ [[1,2],
+  [3,4]],
+ [[5,6],
+  [7,8]],
+ [[9,10],
+  [11,12]]
+];
+my $pdl = pdl $array;
+
+is_deeply( unpdl($pdl), $array, "back convert 3d");
+
@@ -1,90 +1,23 @@
 Installing on Win32
 ===================
 
-Simplest way to install PDL on both Strawberry Perl and
-ActivePerl is to use the ppm utility.
-
-With Strawberry Perl, installing via ppm will work only
-for their 32-bit builds as their 64-bit builds don't
-provide a ppm utility. (On 64-bit Strawberry Perl it
-is, however, still possible to install the ppm utility
-from CPAN ... if one wants to go down that path.)
-
-Both 32-bit and 64-bit builds of ActivePerl ship with
-the ppm utility.
-
-For ppm installation, first up install Astro::FITS::Header
-and Convert::UU by running:
-
-  ppm install Astro-FITS-Header
-  ppm install Convert-UU
-
-Then install the OpenGL, PGPLOT and PDL modules from
-the sisyphusion repo by running:
-
-    ppm install http://www.sisyphusion.tk/ppm/OpenGL.ppd
-    ppm install http://www.sisyphusion.tk/ppm/PGPLOT.ppd
-    ppm install http://www.sisyphusion.tk/ppm/PDL.ppd
-     or, for the latest PDL developer release:
-    ppm install http://www.sisyphusion.tk/ppm/PDL_dev.ppd
-
-For 32-bit builds of perl, that will work for perl-5.8.0 onwards.
-
-For 64-bit builds of perl, ppm packages from
-sisyphusion are provided only for perl versions 5.10.0
-onwards.
-
-Note that the ActiveState ppm for PDL currently lacks
-some of the functionality that is available in the
-above PDL ppm packages from sisyphusion.
-
-Note also that it's best to install both OpenGL and
-PDL from the *same* repo - ie either install *both*
-from the ActiveState repo, or install *both* from
-the sisyphusion repo. (The difference being that
-ActiveState's OpenGL and PDL packages are built against
-a dynamic freeglut library, whereas the sisyphusion ppm
-packages are built against a static freeglut library.)
-
-Having installed the sisyphusion ppm package, PLPLOT
-and PROJ4 support is enabled by setting the PLPLOT_LIB
-and PROJ_LIB environment variables to the location of
-the plplot_supp and proj_supp folders (respectively).
-The ppm post-install script will terminate with a
-message that tells you the settings these environment
-variables should take on. (If you missed the message,
-the two folders will be in your perl/site/lib
-directory - eg, for most builds of ActivePerl the
-PLPLOT_LIB environment variable would be set to
-C:\perl\site\lib\PDL\plplot_supp, and PROJ_LIB would be
-set to C:\perl\site\lib\PDL\proj_supp.)
-
-Installing ffmpeg will enable the creation of mp4 and
-animated gif files, whereby one can turn a piddle of
-images into a movie.
-
-For a demo of this feature, create an mp4 file
-(bounce.mp4) by running the Example/IO/wmpeg.pl that
-ships with the PDL source. The requisite ffmpeg
-binaries are available from a number of places,
-including (at time of writing):
-
-  http://ffmpeg.zeranoe.com/builds/
-  http://www.videohelp.com/tools/ffmpeg
-
-but googling for 'ffmpeg download' should turn up
-buseful hits if those 2 links ecome dead in the future.
+For instructions relating to the installation of PDL
+binaries (PPM packages) see the wiki:
+http://sourceforge.net/apps/mediawiki/pdl/index.php?title=Installing_PDL_on_Windows
 
 ########################################################################
 ########################################################################
 
 If you would like, instead, to build PDL from source,
-that's also easy!!
+that's (generally) fairly straight forward.
 
 Certain parts of PDL (eg PDL::Slatec and PDL::Minuit)
 can't be built without a fortran compiler. In the docs
 that follow I call these parts (somewhat loosely) "the
 fortran stuff".
+The absence of a fortran compiler does not prevent one
+from building PDL - it simply means that the PDL that
+gets built does not include "the fortran stuff".
 
 
 
@@ -118,9 +51,9 @@ To Build from Source
 
    Strawberry Perl (either 32-bit or 64-bit) is probably
    the easiest path to take, as it comes with a ready-to-go
-   dmake utility and MinGW compiler. Unfortunately, its
-   MinGW compiler does not include the MinGW fortran
-   compiler - however, that fortran compiler (suitable
+   dmake utility and MinGW compiler. And, as of the perl-5.16.0
+   builds, it now includes a fortran compiler. For earlier
+   versions of Strawberry Perl a fortran compiler (suitable
    for building "the fortran stuff") is readily available
    as a separate download that can be installed straight
    over the top of the Strawberry Perl installation. If
@@ -159,18 +92,18 @@ If it's a developer release that you're trying to install
 then you'll need to specify the full distribution path info,
 e.g.:
 
-   cpan -i CHM/PDL-2.4.11_001.tar.gz
+   cpan -i CHM/PDL-2.004_997.tar.gz
 
 
 
 Other Options
 -------------
-1) Using an MS compiler and f2c instead of MinGW/g77 (for
-   "the fortran stuff") The capability of building "the
-   fortran stuff" with an MS compuiler, f2c and associated
-   libraries libi77.lib and libf77.lib probably still
-   exists (but none of the current PDL developers have any
-   knowledge or experience with this option).
+1) Using an MS compiler and f2c instead of MinGW/g77/gfortran
+
+   The capability of building "the fortran stuff" with an MS
+   compiler, f2c, and associated libraries libi77.lib and
+   libf77.lib probably still exists (but none of the current
+   PDL developers have any knowledge or experience with this option).
 
    According to mythology, if you want to use f2c you need
    to edit win32/win32f77.pl to reflect the location of f2c,
@@ -191,21 +124,17 @@ Other Options
    of PDL, download the source from CPAN, extract it
    to some location, cd to that location and edit (the
    self-documenting) perldl.conf accordingly.
-  
+
    Then run, in succession:
-  
+
       perl Makefile.PL
       dmake test
       dmake install
-  
+
    This enables building of such extras as:
     a) PDL::IO::GD (needs the gd C library);
     b) PDL::GSL::* modules (needs the gsl C library);
     c) PDL::Graphics::PLplot (needs the plplot C library);
     d) PDL::GIS::Proj & PDL::Transform::Proj4 (needs the proj4 C library);
     e) PDL::FFTW (needs the fftw2 C library)
-    f) PDL with pthreads (needs the pthreads library)
 
-As of the release of PDL-2.4.9_010 (and later), all of
-this functionality is provided by the above mentioned ppm
-packages from sisyphusion.