<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,9 +1,11 @@
 
 =head1 List of Known Bugs in Math::GSL
 
+* OO interface to NTuples is only a stub
+
 * Only NTuples of integers are currently supported
 
-* Reading/Writings NTuples from a file is broken
+* Reading NTuples from a file is broken, since -&gt;swig_ntuple_data_get returns a SWIG-encoded void pointer to the data
 
 * Mathieu Functions currently do not work.
 </diff>
      <filename>KNOWN_BUGS</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,7 @@
 %perlcode %{
+use Data::Dumper;
+use Carp qw/croak/;
+use Math::GSL::Errno qw/:all/;
 
 @EXPORT_OK = qw/
                gsl_ntuple_open
@@ -11,11 +14,9 @@
              /;
 %EXPORT_TAGS = ( all =&gt; [ @EXPORT_OK ] );
 
-__END__
-
 =head1 NAME
 
-Math::GSL::NTuple - Functions for creating and manipulating ntuples, sets of values associated with events
+Math::GSL::NTuple - Functions for creating and manipulating ntuples, sets of values
 
 =head1 SYNOPSIS
 
@@ -29,6 +30,22 @@ Here is a list of all the functions in this module :
 
 =over
 
+=cut 
+
+sub new
+{
+    my ($class,$values) = @_;
+    my $this = {};
+    my $ntuple = Math::GSL::NTuple::gsl_ntuple-&gt;new;
+    $this-&gt;{_ntuple} = $ntuple;
+
+    bless $this, $class;
+}
+
+sub raw
+{
+    return (shift)-&gt;{_ntuple};
+}
 =item * &lt;gsl_ntuple_open($filename, $ntuple_data, $size)&gt; - This function opens an existing ntuple file $filename for reading and returns a pointer to a corresponding ntuple struct. The ntuples in the file must have size $size. A pointer to memory for the current ntuple row $ntuple_data, which is an array reference, must be supplied&#8212;this is used to copy ntuples in and out of the file.
 
 =item * &lt;gsl_ntuple_create &gt; - This function creates a new write-only ntuple file $filename for ntuples of size $size and returns a pointer to the newly created ntuple struct. Any existing file with the same name is truncated to zero length and overwritten. A pointer to memory for the current ntuple row $ntuple_data, which is an array reference, must be supplied&#8212;this is used to copy ntuples in and out of the file.
@@ -58,7 +75,7 @@ Jonathan Leto &lt;jonathan@leto.net&gt; and Thierry Moisan &lt;thierry.moisan@gmail.com&gt;
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2008 Jonathan Leto and Thierry Moisan
+Copyright (C) 2008-2009 Jonathan Leto and Thierry Moisan
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.</diff>
      <filename>pod/NTuple.pod</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,11 @@
 package Math::GSL::NTuple::Test;
 use base q{Test::Class};
-use Test::More tests =&gt; 9;
+use Test::More tests =&gt; 11;
 use Test::Exception;
-use Math::GSL::NTuple qw/:all/; 
-use Math::GSL::Const qw/:all/; 
-use Math::GSL::Errno qw/:all/; 
-use Math::GSL qw/:all/;
-use Math::GSL::Test qw/:all/;
+use Math::GSL::NTuple qw/:all/;
+use Math::GSL::Const  qw/:all/;
+use Math::GSL::Errno  qw/:all/;
+use Math::GSL::Test   qw/:all/;
 use Data::Dumper;
 use strict;
 
@@ -16,18 +15,18 @@ END { warn &quot;This is the end&quot; }
 
 sub make_fixture : Test(setup) {
     my $self = shift;
-    my $size = 2 + int rand(100);
+    my $size = 2 + int rand(10);
     $self-&gt;{size}   = $size;
     my $stuff       = [1..$size];
 
-    $self-&gt;{ntuple} = gsl_ntuple_create('ntuple', $stuff ,$size);
+    my ($ntuple) = gsl_ntuple_create('ntuple', $stuff ,$size);
+    $self-&gt;{ntuple} = $ntuple;
     gsl_ntuple_write($self-&gt;{ntuple});
     gsl_ntuple_close($self-&gt;{ntuple});
 }
 
 sub teardown : Test(teardown) {
     unlink 'ntuple' if -f 'ntuple';
-    unlink 'ntuple2' if -f 'ntuple2';
 }
 
 sub GSL_NTUPLE_CREATE : Tests(2) {
@@ -45,26 +44,36 @@ sub GSL_NTUPLE_OPEN_CLOSE : Tests(2) {
 }
 
 sub GSL_NTUPLE_WRITE: Tests(2) {
-    my $self = shift; 
-    my $data = [1..100];
-    my $base = gsl_ntuple_create('ntuple', $data, 100);
+    my $self = shift;
+    my $data = [1..255];
+    my $base = gsl_ntuple_create('ntuple', $data, 255);
     ok_status(gsl_ntuple_write($base));
     ok_status(gsl_ntuple_close($base));
 }
 
 sub GSL_NTUPLE_READ: Tests(2) {
-    my $self = shift; 
-    my $data = [1..100];
-    my $ntuple = gsl_ntuple_open('ntuple', $data, 100 );
-    # why does this return an EOF?
-    # perhaps gsl_ntuple_write is not doing it's job, so the file is empty...
-    ok_status(gsl_ntuple_read($ntuple),$GSL_EOF);
+    my $self = shift;
+    my $data = [ (42) x $self-&gt;{size} ];
+    my $ntuple = Math::GSL::NTuple::gsl_ntuple-&gt;new;
+    $ntuple = gsl_ntuple_open('ntuple', $data, $self-&gt;{size} );
+
+    ok_status(gsl_ntuple_read($ntuple));
+
+    my $cdata = $ntuple-&gt;swig_ntuple_data_get ;
+    # warn Dumper [ $data, $cdata ];
     ok_status(gsl_ntuple_close($ntuple));
 }
-sub GSL_NTUPLE_OBJECT: Tests(1) {
+
+sub GSL_NTUPLE_GSL_NTUPLE: Tests(1) {
     my $ntuple = Math::GSL::NTuple::gsl_ntuple-&gt;new;
     isa_ok($ntuple,'Math::GSL::NTuple::gsl_ntuple');
 }
 
+sub GSL_NTUPLE_OBJECT: Tests(2) {
+    my $ntuple = Math::GSL::NTuple-&gt;new;
+    isa_ok($ntuple,'Math::GSL::NTuple');
+    isa_ok($ntuple-&gt;raw,'Math::GSL::NTuple::gsl_ntuple');
+}
+
 1;
 Test::Class-&gt;runtests;</diff>
      <filename>t/NTuple.t</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>cff8393a97df689335a031764f13f3ed322eaea1</id>
    </parent>
  </parents>
  <author>
    <name>Duke Leto</name>
    <email>jonathan@leto.net</email>
  </author>
  <url>http://github.com/leto/math--gsl/commit/622f134a3a4cc97a9f4c9bf5081f29df88deccf5</url>
  <id>622f134a3a4cc97a9f4c9bf5081f29df88deccf5</id>
  <committed-date>2009-05-08T23:54:53-07:00</committed-date>
  <authored-date>2009-05-08T23:54:53-07:00</authored-date>
  <message>Improve NTuple interface and tests</message>
  <tree>4a8dcc625663ae500ec67711110a99256f712a0f</tree>
  <committer>
    <name>Duke Leto</name>
    <email>jonathan@leto.net</email>
  </committer>
</commit>
