diff options
| author | fukachan <fukachan> | 2001-08-26 05:52:08 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-08-26 05:52:08 +0000 |
| commit | 7b5715dcff778b1aa3886889a788539fbe0daa7d (patch) | |
| tree | 2dd676f11269c6d3325aed26e54a5603f303a3ba /fml/lib/IO/Adapter | |
| parent | 56e590f604349f574237d3024fb017358fe963fb (diff) | |
| download | fml8-7b5715dcff778b1aa3886889a788539fbe0daa7d.tar.gz fml8-7b5715dcff778b1aa3886889a788539fbe0daa7d.tar.bz2 fml8-7b5715dcff778b1aa3886889a788539fbe0daa7d.zip | |
add touch() method only for file type. It creates a file if the file
not exists.
Diffstat (limited to 'fml/lib/IO/Adapter')
| -rw-r--r-- | fml/lib/IO/Adapter/File.pm | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/fml/lib/IO/Adapter/File.pm b/fml/lib/IO/Adapter/File.pm index b59bff29..72ad8131 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.22 2001/05/04 14:32:33 fukachan Exp $ +# $FML: File.pm,v 1.23 2001/05/30 14:35:10 fukachan Exp $ # package IO::Adapter::File; @@ -126,8 +126,26 @@ sub _rw_open } +=head2 C<touch()> + +create a file if not exists. + +=cut + +sub touch +{ + my ($self, $flag) = @_; + my $file = $self->{_file}; + + use IO::File; + my $fh = new IO::File; + $fh->open($file, "a"); + $fh->close; +} + + # debug tools -my $c = 0; +my $c = 0; my $ec = 0; sub line_count { my ($self) = @_; return "${ec}/${c}";} |
