/[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 660 by dpavlin, Sun Nov 30 14:52:01 2008 UTC revision 661 by dpavlin, Mon Dec 1 22:44:41 2008 UTC
# Line 5  extends 'Frey'; Line 5  extends 'Frey';
5  with 'Frey::Web';  with 'Frey::Web';
6  #with 'Frey::Storage';  #with 'Frey::Storage';
7    
8    use English;
9    
10  has pattern => (  has pattern => (
11          documentation => 'grep for pattern',          documentation => 'grep for pattern',
12          is => 'rw',          is => 'rw',
# Line 36  sub as_markup { Line 38  sub as_markup {
38                  }                  }
39          |);          |);
40    
41          open(my $fh, '-|', $cmd) or die "ack: $@";          open(my $fh, '-|', $cmd) || die "can't open pipe to $cmd $!";
42          while(<$fh>) {          while(<$fh>) {
43                  my ( $path, $line, $text ) = split(/:/,$_,3);                  my ( $path, $line, $text ) = split(/:/,$_,3);
44                  if ( $path ne $last_path ) {                  if ( $path ne $last_path ) {
# Line 46  sub as_markup { Line 48  sub as_markup {
48                  $html .= qq|<dd><a target="editor" href="/editor+$path+$line">$line</a> <code>$text</code>|;                  $html .= qq|<dd><a target="editor" href="/editor+$path+$line">$line</a> <code>$text</code>|;
49                  $last_path = $path;                  $last_path = $path;
50          }          }
51          close($fh) || die $!;          if ( $INPUT_LINE_NUMBER > 0 ) { # closing pipe grep output results in error
52                    close($fh) || die "can't close pipe to $cmd $!";
53            }
54    
55          $html .= qq|</dl>|;          $html .= qq|</dl>|;
56    

Legend:
Removed from v.660  
changed lines
  Added in v.661

  ViewVC Help
Powered by ViewVC 1.1.26