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

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

revision 21 by dpavlin, Sun Feb 18 15:07:03 2007 UTC revision 58 by dpavlin, Wed Feb 21 19:10:20 2007 UTC
# Line 24  sub canonicalize_uri { Line 24  sub canonicalize_uri {
24          my $self = shift;          my $self = shift;
25          my $value = shift;          my $value = shift;
26          warn "uri: $value";          warn "uri: $value";
27          if ($value =~ s/=grep/=%s/) {          if ($value =~ s/\bgrep\b/%s/) {
28                  $self->canonicalization_note( uri => 'Replaced grep with %s' );                  $self->canonicalization_note( uri => 'Replaced grep with %s' );
29          }          }
30          return $value;          return $value;
31  }  }
32    
33    =head2 canonicalize_cookie
34    
35    Remove C<Cookie:> header from beginning and replace EOL with space.
36    
37    =cut
38    
39    # disabled for now
40    sub xx_canonicalize_cookie {
41            my $self = shift;
42            my $value = shift;
43    
44            warn "cookie: $value";
45    
46            $self->canonicalization_note( uri => 'Removed Cookie: header' )
47                    if ($value =~ s/^Cookie:\s+//);
48    
49            $self->canonicalization_note( uri => 'Converted EOL to space' )
50                    if ($value =~ s/[\n\r]/ /gs);
51    
52            return $value;
53    }
54  =head2 take_action  =head2 take_action
55    
56  =cut  =cut
# Line 66  sub take_action { Line 87  sub take_action {
87    
88                  @feeds = map {                  @feeds = map {
89                          my $t = $_;                          my $t = $_;
90                          $t =~ s/=$search_moniker/=%s/;                          $t =~ s/\b$search_moniker\b/%s/;
91                          $t                          $t
92                  } grep(/=$search_moniker/,@feeds);                  } grep(/\b$search_moniker\b/,@feeds);
93    
                 $self->result->message('Found ' . @feeds . ' feeds, using first one. ' . join(" ", @feeds) );  
94    
95                  $uri = shift @feeds;                  my $feed_uri = shift @feeds;
96    
97                  $self->argument_value('uri', $uri);                  return $self->result->error("Can't find any feed at $uri") unless ( $feed_uri );
98    
99                  Jifty->log->debug("calling parent take_action with new uri $uri");                  $self->result->message('Found ' . @feeds . ' feeds, using first one. ' . join(" ", @feeds) );
100                    $self->argument_value('uri', $feed_uri);
101    
102                  $self->SUPER::take_action( @ARGS );                  Jifty->log->debug("calling parent take_action with new uri $feed_uri");
103    
104                  return 1;                  return $self->SUPER::take_action( @ARGS );
105    
106          } else {          } else {
107    

Legend:
Removed from v.21  
changed lines
  Added in v.58

  ViewVC Help
Powered by ViewVC 1.1.26