summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorElvin Aslanov <rwp.primary@gmail.com>2022-08-30 11:32:25 +0400
committerKarl Williamson <khw@cpan.org>2022-08-30 09:32:45 -0600
commit047c4f33756612ef7efae41cb4efca52f800787a (patch)
treee925cd9a0bea67f8f62651216a27d3081e4211dd /lib
parentce789034b8334f0287b20cd30ee2b8859ec79ca9 (diff)
downloadperl-047c4f33756612ef7efae41cb4efca52f800787a.tar.gz
[doc] Update FileHandle synopsis
Add `my` to examples for better practice.
Diffstat (limited to 'lib')
-rw-r--r--lib/FileHandle.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/FileHandle.pm b/lib/FileHandle.pm
index c9d5f40999..a4ae1e437c 100644
--- a/lib/FileHandle.pm
+++ b/lib/FileHandle.pm
@@ -4,7 +4,7 @@ use 5.006;
use strict;
our($VERSION, @ISA, @EXPORT, @EXPORT_OK);
-$VERSION = "2.04";
+$VERSION = "2.05";
require IO::File;
@ISA = qw(IO::File);
@@ -111,36 +111,36 @@ FileHandle - supply object methods for filehandles
use FileHandle;
- $fh = FileHandle->new;
+ my $fh = FileHandle->new;
if ($fh->open("< file")) {
print <$fh>;
$fh->close;
}
- $fh = FileHandle->new("> FOO");
+ my $fh = FileHandle->new("> FOO");
if (defined $fh) {
print $fh "bar\n";
$fh->close;
}
- $fh = FileHandle->new("file", "r");
+ my $fh = FileHandle->new("file", "r");
if (defined $fh) {
print <$fh>;
undef $fh; # automatically closes the file
}
- $fh = FileHandle->new("file", O_WRONLY|O_APPEND);
+ my $fh = FileHandle->new("file", O_WRONLY|O_APPEND);
if (defined $fh) {
print $fh "corge\n";
undef $fh; # automatically closes the file
}
- $pos = $fh->getpos;
+ my $pos = $fh->getpos;
$fh->setpos($pos);
- $fh->setvbuf($buffer_var, _IOLBF, 1024);
+ $fh->setvbuf(my $buffer_var, _IOLBF, 1024);
- ($readfh, $writefh) = FileHandle::pipe;
+ my ($readfh, $writefh) = FileHandle::pipe;
autoflush STDOUT 1;