Skip Menu | will be shut down on March 1st, 2021.

This queue is for tickets about the Search-Dict CPAN distribution.

Report information
The Basics
Id: 88299
Status: new
Priority: 0/
Queue: Search-Dict

Owner: Nobody in particular
Requestors: user42 [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: size by seek not back to start
Date: Sat, 31 Aug 2013 10:35:37 +1000
To: bug-Search-Dict [...]
From: Kevin Ryde <user42 [...]>
Download (untitled) / with headers
text/plain 803b
In Search::Dict 0.7 the file size is found by $size = do { seek($fh,0,2); my $s = tell($fh); seek($fh,0,0); $s } As a tiny optimization I think the second seek is unnecessary. No assumptions are made about the $fh position on entry so can freely muck about with it for the size. For tightness perhaps an error check at that point too. The subsequent error checks catch unseekable too but this would be the first place to notice. my($size, $blksize) = @stat[7,11]; unless (defined $size) { seek($fh,0,2) && ($size = tell($fh)) >= 0 or return -1; } Tested with Dict.t and an unseekable made by { package MyTieUnseekable; use vars '@ISA'; @ISA = ('Tie::StdHandle'); sub SEEK { # Test::More::diag "unseekable"; return 0; # fail } }

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to