Hey,
No, I'm glad to help - was puzzled myself as I though the
use File::Temp qw( :seekable tempfile );
would make that the case - I also tried changing:
my $fh = tempfile;
to:
my ($fh, $fname) = File::Temp::tempfile();
but w/ the same result
anyway, from:
use Data::Printer;
use File::Temp qw( :seekable tempfile );
my $fh = tempfile;
p $fh;
I get:
\ *File::Temp::$fh (read/write, layers: unix perlio)
Show quoted text> Also, I have absolutely no clue as to what you meant by this:
Show quoted text>> This does the same thing:
>> use strict;
>> use warnings;
>
> #use Data::Printer return_value => 'void';
>
> use Fcntl ; #qw( :seek );
> use File::Temp qw( :seekable tempfile );
> my ($fh, $fname) = File::Temp::tempfile();
> warn "n: $fname\n";
>
> # seek( $fh, 0, SEEK_SET );
> $fh->seek( 0, SEEK_SET );
>
Show quoted text> You, um... commented out DDP?
Show quoted text>> So, it's not really DPP's fault, but the 'modern' (?) filehandle usage?
Right, I meant to show, as short as possible, that the
$fh->seek(
used in the test was the problem - not a specific DDP error, but a test
script bug.
Show quoted text> It looks like some sort of bug in File::Temp. If you are kind enough to
help even further by seeing if, for instance, the handle object inherits
from IO::Seekable, I'm sure we can figure this one out. Thanks again for
all the help!
Well, I see:
IO::Seekable is up to date (1.10).
If I, in your test code, do:
my $fh = File::Temp->new();
p $fh;
I get:
File::Temp {
Parents IO::Handle, IO::Seekable
Linear @ISA File::Temp, IO::Handle, Exporter, IO::Seekable
public methods (70) : cleanup, cmpstat, DESTROY, FD_CLOEXEC, F_DUPFD,
F_EXLCK, F_GETFD, F_GETFL, F_GETLK, F_GETLK64, F_GETOWN, filename,
F_RDLCK, F_SETFD, F_SETFL, F_SETLK, F_SETLKW, F_SETLKW64, F_SETLK64,
F_SETOWN, F_SHLCK, F_UNLCK, F_WRLCK, HIGH, MAX_TRIES, MEDIUM, MINX,
mkdtemp, mkstemp, mkstemps, mktemp, new, newdir, O_ACCMODE, O_APPEND,
O_ASYNC, O_BINARY, O_CREAT, O_DIRECT, O_DIRECTORY, O_DSYNC, O_EXCL,
O_LARGEFILE, O_NDELAY, O_NOCTTY, O_NOFOLLOW, O_NONBLOCK, O_RDONLY, O_RDWR,
O_RSYNC, O_SYNC, O_TEXT, O_TRUNC, O_WRONLY, safe_level, SEEK_CUR,
SEEK_END, SEEK_SET, STANDARD, STRINGIFY, tempdir, tempfile, tempnam,
TEMPXXX, tmpfile, tmpnam, top_system_uid, unlink_on_destroy, unlink0,
unlink1
private methods (8) : _can_do_level, _can_unlink_opened_file,
_deferred_unlink, _force_writable, _gettemp, _is_safe, _is_verysafe,
_replace_XX
internals: *File::Temp::$fh (read/write, layers: unix perlio)
}
and
$fh->seek(0,0);
works, not surprisingly.
a
----------------------
Andy Bach
Systems Mangler
Internet: andy_bach@wiwb.uscourts.gov
Voice: (608) 261-5738, Cell: (608) 658-1890
We are what we pretend to be, so we must be careful about what we
pretend to be.
Kurt Vonnegut