/[Grep]/lib/Grep/Source.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 /lib/Grep/Source.pm

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

revision 108 by dpavlin, Sun Mar 4 22:51:01 2007 UTC revision 109 by dpavlin, Wed Mar 14 18:46:37 2007 UTC
# Line 8  package Grep::Source; Line 8  package Grep::Source;
8  use Carp qw/verbose/;  use Carp qw/verbose/;
9  use Module::Pluggable search_path => 'Grep::Source', sub_name => 'sources', require => 1;  use Module::Pluggable search_path => 'Grep::Source', sub_name => 'sources', require => 1;
10  use base qw(Class::Accessor Jifty::Object);  use base qw(Class::Accessor Jifty::Object);
11  Grep::Source->mk_accessors( qw(feed uri q new_items collection) );  Grep::Source->mk_accessors( qw(feed uri q new_items collection search) );
12    
13  use HTML::TreeBuilder;  use HTML::TreeBuilder;
14  use WWW::Mechanize;  use WWW::Mechanize;
# Line 112  sub search { Line 112  sub search {
112          $class->fetch( $parent );          $class->fetch( $parent );
113          undef $parent;          undef $parent;
114    
         Grep::Search->finish if $self->new_items;  
   
115          return $self->collection;          return $self->collection;
116  }  }
117    
# Line 131  This will also update L</new_items> Line 129  This will also update L</new_items>
129  sub add_record {  sub add_record {
130          my $self = shift;          my $self = shift;
131    
132            $self->search( Grep::Search->new() ) unless ($self->search);
133    
134          my $i = Grep::Model::Item->new();          my $i = Grep::Model::Item->new();
135    
136          my $rec = {@_};          my $rec = {@_};
# Line 149  sub add_record { Line 149  sub add_record {
149    
150                  # is new record?                  # is new record?
151                  if ( $msg !~ m/^Found/ ) {                  if ( $msg !~ m/^Found/ ) {
152                          Grep::Search->add( $i );                          $search->add( $i );
153                          $self->new_items( ( $self->new_items || 0 ) + 1 );                          $self->new_items( ( $self->new_items || 0 ) + 1 );
154                  }                  }
155          } else {          } else {

Legend:
Removed from v.108  
changed lines
  Added in v.109

  ViewVC Help
Powered by ViewVC 1.1.26