Skip Menu |

This queue is for tickets about the MARC-XML CPAN distribution.

Report information
The Basics
Id: 84933
Status: resolved
Priority: 0/
Queue: MARC-XML

People
Owner: Nobody in particular
Requestors: NJFRANCK [...] cpan.org
Cc: Nicolas.Franck [...] UGent.be
AdminCc:

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



CC: Nicolas.Franck [...] UGent.be
Subject: MARC::File->in does not support IO::*
Dear mr. Charlton, Your cpan module MARC::File supports filehandles by use of the method 'in'. But other input handles like 'IO::String' are blocked by use of the 'fileno' check. Although I do not see anything in your code that is not supported by these other IO-handles (apart from the argument 'filename' which is rarely used). Could it be possible to allow all kinds of IO::*? I know, this is not a bug, just a kind request;-) Thanks for doing a great job! best regards, Nicolas Franck
This was actually a bug in IO::* that was reported in 5.8.8 and fixed sometime later (Change 28766). The fileno description used to read (in part): Returns the file descriptor for a filehandle, or undefined if the filehandle is not open. ...(Filehandles connected to memory objects via new features of open may return undefined even though they are open.) but in 5.14 reads: Returns the file descriptor for a filehandle, or undefined if the filehandle is not open. If there is no real file descriptor at the OS level, as can happen with filehandles connected to memory objects via open with a reference for the third argument, -1 is returned. -bill On Tue Apr 30 03:31:47 2013, NJFRANCK wrote: Show quoted text
> Dear mr. Charlton, > > Your cpan module MARC::File supports filehandles by use of the method > 'in'. > But other input handles like 'IO::String' are blocked by use of the > 'fileno' check. > Although I do not see anything in your code that is not supported by > these > other IO-handles (apart from the argument 'filename' which is rarely > used). > > Could it be possible to allow all kinds of IO::*? > > I know, this is not a bug, just a kind request;-) > > Thanks for doing a great job! > > best regards, > > Nicolas Franck
Recommend you update perl to at least 5.14 if you need this functionality.
On Tue Apr 30 07:57:23 2013, BBIRTH wrote: Show quoted text
> Recommend you update perl to at least 5.14 if you need this functionality.
Thanks for your quick reply: - I am using perl 5.14.2 $ perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi (with 64 registered patches, see perl -V for more detail) Copyright 1987-2011, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. - try this command: $ perl -MIO::String -MData::Dumper -e 'my $buf = "test";my $val = fileno(IO::String->new($buf));print Dumper($val)' $VAR1 = undef; - Is there something wrong with this code I posted?
Hi Nicolas, There was nothing wrong with the code you posted. The problem was in my earlier response. The functionality formerly associated with IO:String has been pulled into the core 'open' (a while back) and it was that fileno which was fixed in 5.14. Try the following tiny program: #!/usr/bin/perl use strict; use warnings; my $buf = "test"; # my $io = IO::String->new($buf); open(my $io, "<", \$buf) || die "Can't open string: $!"; my $contents = $io->getline; my $val = $io->fileno; print "contents='$contents', fileno='$val'\n"; It looks like IO::String is no longer included in the Ubuntu 12.04 base install. It was in Ubuntu 10.04. I didn't see anything that said it is deprecated - but I didn't look very hard. And I haven't tried this sort of string with MARC::File, either. Let us know if it resolves the issue. -bill On Tue Apr 30 09:59:32 2013, NJFRANCK wrote: Show quoted text
> On Tue Apr 30 07:57:23 2013, BBIRTH wrote:
> > Recommend you update perl to at least 5.14 if you need this
> functionality. > > Thanks for your quick reply: > > - I am using perl 5.14.2 > > $ perl -v > This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64- > linux-gnu-thread-multi > (with 64 registered patches, see perl -V for more detail) > > Copyright 1987-2011, Larry Wall > > Perl may be copied only under the terms of either the Artistic License > or the > GNU General Public License, which may be found in the Perl 5 source > kit. > > Complete documentation for Perl, including FAQ lists, should be found > on > this system using "man perl" or "perldoc perl". If you have access to > the > Internet, point your browser at http://www.perl.org/, the Perl Home > Page. > > > - try this command: > > $ perl -MIO::String -MData::Dumper -e 'my $buf = "test";my $val = > fileno(IO::String->new($buf));print Dumper($val)' > $VAR1 = undef; > > - Is there something wrong with this code I posted?
Yes it works now. Thanks a lot! Looks like IO::String is no longer needed. On Tue Apr 30 16:48:45 2013, BBIRTH wrote: Show quoted text
> Hi Nicolas, > > There was nothing wrong with the code you posted. The problem was in > my earlier response. The functionality formerly associated with > IO:String has been pulled into the core 'open' (a while back) and > it was that fileno which was fixed in 5.14. Try the following tiny > program: > > #!/usr/bin/perl > > use strict; > use warnings; > > my $buf = "test"; > # my $io = IO::String->new($buf); > open(my $io, "<", \$buf) || die "Can't open string: $!"; > my $contents = $io->getline; > my $val = $io->fileno; > print "contents='$contents', fileno='$val'\n"; > > It looks like IO::String is no longer included in the Ubuntu 12.04 > base install. It was in Ubuntu 10.04. I didn't see anything that > said it is deprecated - but I didn't look very hard. And I haven't > tried this sort of string with MARC::File, either. Let us know if > it resolves the issue. > > -bill > > On Tue Apr 30 09:59:32 2013, NJFRANCK wrote:
> > On Tue Apr 30 07:57:23 2013, BBIRTH wrote:
> > > Recommend you update perl to at least 5.14 if you need this
> > functionality. > > > > Thanks for your quick reply: > > > > - I am using perl 5.14.2 > > > > $ perl -v > > This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64- > > linux-gnu-thread-multi > > (with 64 registered patches, see perl -V for more detail) > > > > Copyright 1987-2011, Larry Wall > > > > Perl may be copied only under the terms of either the Artistic
> License
> > or the > > GNU General Public License, which may be found in the Perl 5 source > > kit. > > > > Complete documentation for Perl, including FAQ lists, should be
> found
> > on > > this system using "man perl" or "perldoc perl". If you have access
> to
> > the > > Internet, point your browser at http://www.perl.org/, the Perl Home > > Page. > > > > > > - try this command: > > > > $ perl -MIO::String -MData::Dumper -e 'my $buf = "test";my $val = > > fileno(IO::String->new($buf));print Dumper($val)' > > $VAR1 = undef; > > > > - Is there something wrong with this code I posted?
> >