Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Data-Printer CPAN distribution.

Report information
The Basics
Id: 74391
Status: resolved
Priority: 0/
Queue: Data-Printer

People
Owner: Nobody in particular
Requestors: andy_bach [...] wiwb.uscourts.gov
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.28
  • 0.29
Fixed in: (no value)



Subject: t/29-output.t - can't locate object method seek via IO::Handle
t/27.3-pass_through-DDP.t ... ok t/27.4-pass_through-DDP.t ... ok t/28-void_return.t .......... ok t/29-output.t ............... 1/? Can't locate object method "seek" via package "IO::Handle" at t/29-output.t line 70. # Tests were run but no plan was declared and done_testing() was not seen. t/29-output.t ............... Dubious, test returned 255 (wstat 65280, 0xff00) All 7 subtests passed t/pod.t ..................... skipped: set TEST_POD to enable this test (developer only!) The code: $fh->seek( 0, SEEK_SET ); making it: seek($fh, 0, SEEK_SET ); and it passes. perl, v5.10.1 Data-Printer-0.28 IO::Handle is up to date (1.28) File::Temp is up to date (0.22) Linux wiwmb-afb-ub1 2.6.32-37-generic #81-Ubuntu SMP Fri Dec 2 20:35:14 UTC 2011 i686 GNU/Linux 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 ); So, it's not really DPP's fault, but the 'modern' (?) filehandle usage? Thanks. a
On Wed Jan 25 15:20:10 2012, afbach wrote: Show quoted text
> t/29-output.t ............... 1/? Can't locate object method "seek" via > package "IO::Handle" at t/29-output.t line 70. > > The code: > $fh->seek( 0, SEEK_SET ); > > making it: > seek($fh, 0, SEEK_SET ); > > and it passes. > perl, v5.10.1 > Data-Printer-0.28 > IO::Handle is up to date (1.28) > File::Temp is up to date (0.22) > Linux wiwmb-afb-ub1 2.6.32-37-generic #81-Ubuntu SMP Fri Dec 2 20:35:14 > UTC 2011 i686 GNU/Linux >
Hi there! First of all, thanks for using Data::Printer and for taking the time to analyze the problem and submit not only a bug report, but a patch! I really appreciate it :) This is really odd. Actually, the seek() method comes from IO::Seekable, not IO::Handle. The object returned by File::Temp should inherit from both according to their documentation - which doesn't seem to be happening in your case. I've changed the call to a plain seek() function call on github and the fix will be available via CPAN in the next release (thanks!), but since you're already playing with this and I can't reproduce it at all, would it be too abusive of me to ask you to do something like: --------->8--------- use Data::Printer; use File::Temp qw( :seekable tempfile ); my $fh = tempfile; p $fh; ---------8<--------- This should help us figure out what's coming out of $fh in your system, and hopefully we'll be able to help Tim improve File::Temp. 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 ); >
You, um... commented out DDP? Show quoted text
> So, it's not really DPP's fault, but the 'modern' (?) filehandle usage? >
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! Cheers,
Subject: Re: [rt.cpan.org #74391] t/29-output.t - can't locate object method seek via IO::Handle
Date: Thu, 26 Jan 2012 11:03:08 -0600
To: bug-Data-Printer [...] rt.cpan.org
From: Andy_Bach [...] wiwb.uscourts.gov
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
I committed the fix on 0.30, should be ok now. Please reopen the issue if you run into it again. Thanks again! On Thu Jan 26 12:03:22 2012, afbach wrote: Show quoted text
> 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) >
> > Also, I have absolutely no clue as to what you meant by this:
>
> >> 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 ); > >
>
> > You, um... commented out DDP?
>
> >> 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. > >
> > 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, Show quoted text
> 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