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
/
NewSubst.pm
1
package NewSubst ;
2
3
use Filter::Util::Call ;
4
use Carp ;
5
6
use strict ;
7
use warnings ;
8
9
sub import
10
{
11
my ($self, $start, $stop, $from, $to) = @_ ;
12
my ($found) = 0 ;
13
croak("usage: use Subst qw(start stop from to)")
14
unless @_ == 5 ;
15
16
filter_add(
17
sub
18
{
19
my ($status) ;
20
21
if (($status = filter_read()) > 0) {
22
23
$found = 1
24
if $found == 0 and /$start/ ;
25
26
if ($found) {
27
s/$from/$to/ ;
28
filter_del() if /$stop/ ;
29
}
30
31
}
32
$status ;
33
} )
34
35
}
36
37
1 ;