/[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 77 by dpavlin, Mon Jan 16 21:34:14 2006 UTC revision 91 by dpavlin, Thu Jan 26 01:53:58 2006 UTC
# Line 157  sub new { Line 157  sub new {
157                          } elsif ($line =~ m/^$/) {                          } elsif ($line =~ m/^$/) {
158                                  $in_text = 1;                                  $in_text = 1;
159                                  next;                                  next;
160                          } elsif ($line =~ m/^(.+)=(.+)$/) {                          } elsif ($line =~ m/^(.+)=(.*)$/) {
161                                  $self->{attrs}->{ $1 } = $2;                                  $self->{attrs}->{ $1 } = $2;
162                                  next;                                  next;
163                          }                          }
164    
165                          warn "draft ignored: $line\n";                          warn "draft ignored: '$line'\n";
166                  }                  }
167          }          }
168    
# Line 735  sub hint { Line 735  sub hint {
735          return $self->{hints}->{$key};          return $self->{hints}->{$key};
736  }  }
737    
738    =head2 hints
739    
740    More perlish version of C<hint>. This one returns hash.
741    
742      my %hints = $rec->hints;
743    
744    =cut
745    
746    sub hints {
747            my $self = shift;
748            return $self->{hints};
749    }
750    
751  package Search::Estraier::Node;  package Search::Estraier::Node;
752    
# Line 754  or optionally with C<url> as parametar Line 766  or optionally with C<url> as parametar
766    
767    my $node = new Search::HyperEstraier::Node( 'http://localhost:1978/node/test' );    my $node = new Search::HyperEstraier::Node( 'http://localhost:1978/node/test' );
768    
769    or in more verbose form
770    
771      my $node = new Search::HyperEstraier::Node(
772            url => 'http://localhost:1978/node/test',
773            debug => 1,
774            croak_on_error => 1
775      );
776    
777    with following arguments:
778    
779    =over 4
780    
781    =item url
782    
783    URL to node
784    
785    =item debug
786    
787    dumps a B<lot> of debugging output
788    
789    =item croak_on_error
790    
791    very helpful during development. It will croak on all errors instead of
792    silently returning C<-1> (which is convention of Hyper Estraier API in other
793    languages).
794    
795    =back
796    
797  =cut  =cut
798    
799  sub new {  sub new {
# Line 776  sub new { Line 816  sub new {
816          } else {          } else {
817                  my $args = {@_};                  my $args = {@_};
818    
819                  $self->{debug} = $args->{debug};                  %$self = ( %$self, @_ );
820    
821                  warn "## Node debug on\n" if ($self->{debug});                  warn "## Node debug on\n" if ($self->{debug});
822          }          }
823    
# Line 1434  sub shuttle_url { Line 1475  sub shuttle_url {
1475    
1476          ($self->{status}, $self->{status_message}) = split(/\s+/, $res->status_line, 2);          ($self->{status}, $self->{status_message}) = split(/\s+/, $res->status_line, 2);
1477    
1478          return -1 if (! $res->is_success);          if (! $res->is_success) {
1479                    if ($self->{croak_on_error}) {
1480                            croak("can't get $url: ",$res->status_line);
1481                    } else {
1482                            return -1;
1483                    }
1484            }
1485    
1486          $$resbody .= $res->content;          $$resbody .= $res->content;
1487    

Legend:
Removed from v.77  
changed lines
  Added in v.91

  ViewVC Help
Powered by ViewVC 1.1.26