[redland] Re: Perl method Stream->end is corrupt

Dave Beckett dave.beckett at bristol.ac.uk
Tue Dec 19 16:57:58 GMT 2000


>>>Stefan Meinert said:
> >
> 
> Forget my last mail. I send you a code segment which produces the
> error; the only difference to your code is that the storage isn't
> in memory, but persistent:

The code you include below wasn't legal perl - there was a " that
does not end on the first line.  When I corrected it, the code
crashed for me.  I really prefer complete, unedited examples!

The storage used doesn't make any difference.

If I tidy the code to make all the variables 'my' ones, then it does
not die.  If I remove the 'my' before $storage, $model or $statement
(not $stream), it dies.  Wierd - must be some object/class
destruction ordering thing.

Code that works included below; delete any of first three 'my 's for
a crash.

Dave

----------------------------------------------------------------------
#!/usr/bin/perl -w

use RDF;

my $storage=new RDF::Storage("hashes", "test2", "new='yes',hash-type='memory'");
if(!$storage) {
  warn "storage failed!\n";
  exit;
}

my $model=new RDF::Model($storage,"");
if(!$model) {
   warn "model failed!\n";
   exit;
}

my $statement=RDF::Statement->new_from_nodes(undef,undef,RDF::Node->new_from_uri_string("http://foo.com/"));

my $stream=$model->find_statements($statement);
while (!$stream->end) {
  $stream->next;
}
exit;







More information about the redland-dev mailing list