/[Frey]/trunk/lib/Frey/Shell/Grep.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/lib/Frey/Shell/Grep.pm

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

revision 732 by dpavlin, Sat Dec 6 00:26:12 2008 UTC revision 840 by dpavlin, Sun Dec 14 23:10:23 2008 UTC
# Line 38  sub { Line 38  sub {
38          my ($self) = @_;          my ($self) = @_;
39    
40          my $patt = $self->pattern;          my $patt = $self->pattern;
41            my $opt = '';
42            $opt = '--' if $patt =~ m{^-};
43    
44          my $cmd = 'grep -rn ' . $patt . ' ' . $self->path;          if ( $patt =~ m{'} ) {
45          $self->_grep_command( $cmd );                  $patt = qq|"$patt"|;
46            } else {
47                    $patt = qq|'$patt'|;
48            }
49    
50            my $cmd = qq|grep -rn $opt $patt | . $self->path;
51          warn "# $cmd";          warn "# $cmd";
52            $self->_grep_command( $cmd );
53    
54          my @results;          my @results;
55    
# Line 92  sub as_markup { Line 100  sub as_markup {
100    
101          foreach my $result ( @{ $self->results_as_data } ) {          foreach my $result ( @{ $self->results_as_data } ) {
102    
103                  warn $self->dump( $result );                  warn $self->dump( $result ) if $self->debug;
104    
105                  my $text = $result->{text} || die "no text";                  my $text = $result->{text} || die "no text";
106    
# Line 125  sub as_markup { Line 133  sub as_markup {
133                  $html = $self->error( "No results for $patt\n" );                  $html = $self->error( "No results for $patt\n" );
134          }          }
135    
136            $self->add_head(qq|
137                    <link rel="search" type="application/opensearchdescription+xml" title="Frey::Shell::Grep" href="/Frey::OpenSearch/grep_as_markup">
138            |);
139    
140          return $html;          return $html;
141  }  }
142    

Legend:
Removed from v.732  
changed lines
  Added in v.840

  ViewVC Help
Powered by ViewVC 1.1.26