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', |
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 ) { |
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 |
|
|