summaryrefslogtreecommitdiff
path: root/fml/lib/IO
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-07-24 11:05:49 +0000
committerfukachan <fukachan>2002-07-24 11:05:49 +0000
commitd9c7e86f8b10d892c3bc7485f0fb6e0cd3124714 (patch)
tree2baaee0c19a4bb567bc9b0bd373184b0fe198b63 /fml/lib/IO
parentb9ec2c61f14ec9454e9bfd4f6b72a35bc8e8f589 (diff)
downloadfml8-d9c7e86f8b10d892c3bc7485f0fb6e0cd3124714.tar.gz
fml8-d9c7e86f8b10d892c3bc7485f0fb6e0cd3124714.tar.bz2
fml8-d9c7e86f8b10d892c3bc7485f0fb6e0cd3124714.zip
removed replace()
Diffstat (limited to 'fml/lib/IO')
-rw-r--r--fml/lib/IO/Adapter.pm25
-rw-r--r--fml/lib/IO/Adapter/DBI.pm32
-rw-r--r--fml/lib/IO/Adapter/File.pm42
3 files changed, 6 insertions, 93 deletions
diff --git a/fml/lib/IO/Adapter.pm b/fml/lib/IO/Adapter.pm
index e4ec0faa..e38a8147 100644
--- a/fml/lib/IO/Adapter.pm
+++ b/fml/lib/IO/Adapter.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Adapter.pm,v 1.18 2002/07/23 13:06:35 fukachan Exp $
+# $FML: Adapter.pm,v 1.19 2002/07/24 09:29:53 fukachan Exp $
#
package IO::Adapter;
@@ -386,29 +386,6 @@ sub delete
}
-# Descriptions: replace $value for key matching $regexp
-# Arguments: OBJ($self) STR($regexp) STR($value)
-# Side Effects: modify map content
-# Return Value: replace()
-sub replace
-{
- my ($self, $regexp, $value) = @_;
-
- if ($self->{ _hints }->{ read_only }) {
- my $map = $self->{ _map };
- croak("this map $map is read only.");
- }
-
- if ($self->can('replace')) {
- $self->SUPER::replace($regexp, $value);
- }
- else {
- $self->error_set("Error: replace() method is not supported.");
- undef;
- }
-}
-
-
=head2 C<find($regexp [,$args])>
search $regexp in C<map> and return the line which matches C<$regexp>.
diff --git a/fml/lib/IO/Adapter/DBI.pm b/fml/lib/IO/Adapter/DBI.pm
index c99dc0c5..cdba65d7 100644
--- a/fml/lib/IO/Adapter/DBI.pm
+++ b/fml/lib/IO/Adapter/DBI.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2000,2001,2002 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: DBI.pm,v 1.15 2002/07/23 13:06:36 fukachan Exp $
+# $FML: DBI.pm,v 1.16 2002/07/24 09:30:45 fukachan Exp $
#
package IO::Adapter::DBI;
@@ -314,35 +314,11 @@ sub delete
}
-=head2 C<replace($regexp, $value)>
+=head2 md_find()
-=cut
-
-
-# Descriptions: replace value
-# Arguments: OBJ($self) STR($regexp) STR($value)
-# Side Effects: update map
-# Return Value: none
-sub replace
-{
- my ($self, $regexp, $value) = @_;
- my (@addr);
-
- # firstly, get list matching /$regexp/i;
- my $a = $self->find($regexp, { want => 'key', all => 1});
+map specific find().
- # secondarly double check: get list matchi /$regexp/;
- for my $addr (@$a) {
- push(@addr, $addr) if ($addr =~ /$regexp/);
- }
-
- # thirdly, replace it
- for my $addr (@addr) {
- $self->delete( $addr );
- $self->add( $value );
- }
-
-}
+=cut
# Descriptions: search, md = map dependent
diff --git a/fml/lib/IO/Adapter/File.pm b/fml/lib/IO/Adapter/File.pm
index dfffbda0..9ff37ee4 100644
--- a/fml/lib/IO/Adapter/File.pm
+++ b/fml/lib/IO/Adapter/File.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: File.pm,v 1.32 2002/06/21 03:54:13 fukachan Exp $
+# $FML: File.pm,v 1.33 2002/07/24 09:29:39 fukachan Exp $
#
package IO::Adapter::File;
@@ -410,46 +410,6 @@ sub delete
}
-=head2 C<replace($regexp, $value)>
-
-replace lines which matches $regexp with $value.
-
-=cut
-
-
-# Descriptions: replace address(es) matching $reexp with $value
-# Arguments: OBJ($self) STR($regexp) STR($value)
-# Side Effects: update map
-# Return Value: same as close()
-sub replace
-{
- my ($self, $regexp, $value) = @_;
-
- $self->open("w");
-
- my $rh = $self->{ _fh };
- my $wh = $self->{ _wh };
-
- if (defined $rh) {
- FILE_IO:
- while (<$rh>) {
- if (/$regexp/) {
- print $wh $value, "\n";
- }
- else {
- print $wh $_;
- }
- }
- $wh->close;
- $rh->close;
- }
- else {
- $self->error_set("Error: cannot open file=$self->{ _file }");
- return undef;
- }
-}
-
-
=head1 SEE ALSO
L<IO::Adapter>