--- trunk/Estraier.pm 2006/01/16 21:34:14 77 +++ trunk/Estraier.pm 2006/01/16 21:42:09 78 @@ -754,6 +754,34 @@ my $node = new Search::HyperEstraier::Node( 'http://localhost:1978/node/test' ); +or in more verbose form + + my $node = new Search::HyperEstraier::Node( + url => 'http://localhost:1978/node/test', + debug => 1, + croak_on_error => 1 + ); + +with following arguments: + +=over 4 + +=item url + +URL to node + +=item debug + +dumps a B of debugging output + +=item croak_on_error + +very helpful during development. It will croak on all errors instead of +silently returning C<-1> (which is convention of Hyper Estraier API in other +languages). + +=back + =cut sub new { @@ -776,7 +804,8 @@ } else { my $args = {@_}; - $self->{debug} = $args->{debug}; + %$self = ( %$self, @_ ); + warn "## Node debug on\n" if ($self->{debug}); } @@ -1434,7 +1463,13 @@ ($self->{status}, $self->{status_message}) = split(/\s+/, $res->status_line, 2); - return -1 if (! $res->is_success); + if (! $res->is_success) { + if ($self->{croak_on_error}) { + croak("can't get $url: ",$res->status_line); + } else { + return -1; + } + } $$resbody .= $res->content;