/[Search-Estraier]/trunk/Estraier.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/Estraier.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 102 by dpavlin, Sat Jan 28 19:46:20 2006 UTC revision 103 by dpavlin, Sat Jan 28 20:44:15 2006 UTC
# Line 1172  Get ID of document specified by URI Line 1172  Get ID of document specified by URI
1172    
1173    my $id = $node->uri_to_id( 'file:///document/uri/42' );    my $id = $node->uri_to_id( 'file:///document/uri/42' );
1174    
1175    This method won't croak, even if using C<croak_on_error>.
1176    
1177  =cut  =cut
1178    
1179  sub uri_to_id {  sub uri_to_id {
1180          my $self = shift;          my $self = shift;
1181          my $uri = shift || return;          my $uri = shift || return;
1182          return $self->_fetch_doc( uri => $uri, path => '/uri_to_id', chomp_resbody => 1 );          return $self->_fetch_doc( uri => $uri, path => '/uri_to_id', chomp_resbody => 1, croak_on_error => 0 );
1183  }  }
1184    
1185    
# Line 1237  sub _fetch_doc { Line 1239  sub _fetch_doc {
1239                  'application/x-www-form-urlencoded',                  'application/x-www-form-urlencoded',
1240                  $arg,                  $arg,
1241                  \$resbody,                  \$resbody,
1242                    $a->{croak_on_error},
1243          );          );
1244    
1245          return if ($rv != 200);          return if ($rv != 200);
# Line 1505  use LWP::UserAgent; Line 1508  use LWP::UserAgent;
1508  sub shuttle_url {  sub shuttle_url {
1509          my $self = shift;          my $self = shift;
1510    
1511          my ($url, $content_type, $reqbody, $resbody) = @_;          my ($url, $content_type, $reqbody, $resbody, $croak_on_error) = @_;
1512    
1513            $croak_on_error = $self->{croak_on_error} unless defined($croak_on_error);
1514    
1515          $self->{status} = -1;          $self->{status} = -1;
1516    
# Line 1549  sub shuttle_url { Line 1554  sub shuttle_url {
1554          ($self->{status}, $self->{status_message}) = split(/\s+/, $res->status_line, 2);          ($self->{status}, $self->{status_message}) = split(/\s+/, $res->status_line, 2);
1555    
1556          if (! $res->is_success) {          if (! $res->is_success) {
1557                  if ($self->{croak_on_error}) {                  if ($croak_on_error) {
1558                          croak("can't get $url: ",$res->status_line);                          croak("can't get $url: ",$res->status_line);
1559                  } else {                  } else {
1560                          return -1;                          return -1;

Legend:
Removed from v.102  
changed lines
  Added in v.103

  ViewVC Help
Powered by ViewVC 1.1.26