--- lib/Grep/Source.pm 2007/02/23 11:48:39 73 +++ lib/Grep/Source.pm 2007/02/23 18:10:26 82 @@ -136,7 +136,7 @@ # is new record? if ( $msg !~ m/^Found/ ) { Grep::Search->add( $i ); - $self->new_items( $self->new_items + 1 ); + $self->new_items( ( $self->new_items || 0 ) + 1 ); } } else { warn "can't add entry ", dump( @_ ), "\n"; @@ -158,9 +158,15 @@ foreach my $s ( $self->sources ) { Jifty->log->debug("testing source class $s"); - if ($s->can('content_have') && $s->content_have( $content ) ) { - Jifty->log->debug("${s}->content_have succesful"); - return "$s"; + if ( $s->can('content_have') ) { + my $regex = $s->content_have( $content ) or + die "${s}->content_have didn't return anything"; + die "${s}->content_have didn't return regex but ", dump( $regex ), " ref ", ref( $regex ) + unless ( ref($regex) eq 'Regexp' ); + if ( $content =~ $regex ) { + Jifty->log->debug("${s}->content_have succesful"); + return $s; + } } } }