projects
/
pkg-perl
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Add the following packages libalgorithm-diff-perl libspiffy-perl libtext-diff-perl...
[pkg-perl]
/
deb-src
/
libfilter-perl
/
libfilter-perl-1.34
/
examples
/
closure
/
Count.pm
1
package Count ;
2
3
use Filter::Util::Call ;
4
5
use strict ;
6
use warnings ;
7
8
sub import
9
{
10
my ($self) = @_ ;
11
my ($count) = 0 ;
12
filter_add(
13
sub
14
{
15
my ($status) ;
16
17
if (($status = filter_read()) > 0 ) {
18
s/Joe/Jim/g ;
19
++ $count ;
20
}
21
elsif ($count >= 0) { # EOF
22
$_ = "print q[Made $count substitutions\n] ;" ;
23
$status = 1 ;
24
$count = -1 ;
25
}
26
27
$status ;
28
})
29
}
30
31
1 ;
32