diff options
author | Karl Berry <karl@freefriends.org> | 2017-04-18 23:10:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-04-18 23:10:57 +0000 |
commit | 40b4b6e177c62a14c166dbba6adf3abc415af4b2 (patch) | |
tree | 2996bf29509c806bd8064fb6cf38092c1b375ff8 /Master/tlpkg/tlperl/lib/Tie | |
parent | 8e743c86b6872f30b7a35c72aa944455157d4b3f (diff) |
tlperl 5.24.1 from siep
git-svn-id: svn://tug.org/texlive/trunk@43914 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Tie')
-rw-r--r-- | Master/tlpkg/tlperl/lib/Tie/File.pm | 42 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Tie/Scalar.pm | 4 |
2 files changed, 23 insertions, 23 deletions
diff --git a/Master/tlpkg/tlperl/lib/Tie/File.pm b/Master/tlpkg/tlperl/lib/Tie/File.pm index df8a197867f..d546b81f44e 100644 --- a/Master/tlpkg/tlperl/lib/Tie/File.pm +++ b/Master/tlpkg/tlperl/lib/Tie/File.pm @@ -7,7 +7,7 @@ use Fcntl 'O_CREAT', 'O_RDWR', 'LOCK_EX', 'LOCK_SH', 'O_WRONLY', 'O_RDONLY'; sub O_ACCMODE () { O_RDONLY | O_RDWR | O_WRONLY } -$VERSION = "1.01"; +$VERSION = "1.02"; my $DEFAULT_MEMORY_SIZE = 1<<21; # 2 megabytes my $DEFAULT_AUTODEFER_THRESHHOLD = 3; # 3 records my $DEFAULT_AUTODEFER_FILELEN_THRESHHOLD = 65536; # 16 disk blocksful @@ -2013,32 +2013,32 @@ Tie::File - Access the lines of a disk file via a Perl array =head1 SYNOPSIS - # This file documents Tie::File version 0.98 - use Tie::File; + # This file documents Tie::File version 0.98 + use Tie::File; - tie @array, 'Tie::File', filename or die ...; + tie @array, 'Tie::File', filename or die ...; - $array[13] = 'blah'; # line 13 of the file is now 'blah' - print $array[42]; # display line 42 of the file + $array[13] = 'blah'; # line 13 of the file is now 'blah' + print $array[42]; # display line 42 of the file - $n_recs = @array; # how many records are in the file? - $#array -= 2; # chop two records off the end + $n_recs = @array; # how many records are in the file? + $#array -= 2; # chop two records off the end - for (@array) { - s/PERL/Perl/g; # Replace PERL with Perl everywhere in the file - } + for (@array) { + s/PERL/Perl/g; # Replace PERL with Perl everywhere in the file + } - # These are just like regular push, pop, unshift, shift, and splice - # Except that they modify the file in the way you would expect + # These are just like regular push, pop, unshift, shift, and splice + # Except that they modify the file in the way you would expect - push @array, new recs...; - my $r1 = pop @array; - unshift @array, new recs...; - my $r2 = shift @array; - @old_recs = splice @array, 3, 7, new recs...; + push @array, new recs...; + my $r1 = pop @array; + unshift @array, new recs...; + my $r2 = shift @array; + @old_recs = splice @array, 3, 7, new recs...; - untie @array; # all finished + untie @array; # all finished =head1 DESCRIPTION @@ -2174,8 +2174,8 @@ The default memory limit is 2Mib. You can adjust the maximum read cache size by supplying the C<memory> option. The argument is the desired cache size, in bytes. - # I have a lot of memory, so use a large cache to speed up access - tie @array, 'Tie::File', $file, memory => 20_000_000; + # I have a lot of memory, so use a large cache to speed up access + tie @array, 'Tie::File', $file, memory => 20_000_000; Setting the memory limit to 0 will inhibit caching; records will be fetched from disk every time you examine them. diff --git a/Master/tlpkg/tlperl/lib/Tie/Scalar.pm b/Master/tlpkg/tlperl/lib/Tie/Scalar.pm index b56ac9abd88..50b97018ad1 100644 --- a/Master/tlpkg/tlperl/lib/Tie/Scalar.pm +++ b/Master/tlpkg/tlperl/lib/Tie/Scalar.pm @@ -1,6 +1,6 @@ package Tie::Scalar; -our $VERSION = '1.03'; +our $VERSION = '1.04'; =head1 NAME @@ -145,7 +145,7 @@ package Tie::StdScalar; sub TIESCALAR { my $class = shift; - my $instance = shift || undef; + my $instance = @_ ? shift : undef; return bless \$instance => $class; } |