git.shiar.nl
/
perl
/
file-rewrite.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
t: test result of "remove regex"
[perl/file-rewrite.git]
/
lib
/
File
/
Rewrite.pm
diff --git
a/lib/File/Rewrite.pm
b/lib/File/Rewrite.pm
index b3bf3d74019bc72ed127ef8015338b2464e674bf..731925929d9536a09ed1e2a998850f648b7ef47e 100644
(file)
--- a/
lib/File/Rewrite.pm
+++ b/
lib/File/Rewrite.pm
@@
-6,14
+6,15
@@
use warnings;
use autodie ':all';
use Exporter 'import';
use autodie ':all';
use Exporter 'import';
+our $VERSION = '1.00';
our @EXPORT_OK = qw(fileset);
sub fileset {
our @EXPORT_OK = qw(fileset);
sub fileset {
- my ($filename, $
replace, $search
) = @_;
+ my ($filename, $
search, $replace
) = @_;
my $tmpname = "$filename.$$.tmp";
my $changes = 0;
my $tmpname = "$filename.$$.tmp";
my $changes = 0;
- $
search = $replace
if @_ < 3;
+ $
replace = $search
if @_ < 3;
# generate a single regex to emulate smart match
$search = [$search] unless ref $search eq 'ARRAY';
# generate a single regex to emulate smart match
$search = [$search] unless ref $search eq 'ARRAY';
@@
-66,12
+67,12
@@
sub fileset {
=head1 NAME
=head1 NAME
-File::Rewrite
+File::Rewrite
- Append and/or strip lines from text files
=head1 SYNOPSIS
use File::Rewrite 'fileset';
=head1 SYNOPSIS
use File::Rewrite 'fileset';
- fileset('/tmp/somefile',
undef, qr/match/
);
+ fileset('/tmp/somefile',
qr/match/ => undef
);
=head1 DESCRIPTION
=head1 DESCRIPTION