Skip Menu |

This queue is for tickets about the perl-ldap CPAN distribution.

Report information
The Basics
Id: 35331
Status: resolved
Priority: 0/
Queue: perl-ldap

People
Owner: Nobody in particular
Requestors: joaocosta [...] zonalivre.org
Cc:
AdminCc:

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



Subject: EOF behaviour on empty files
The eof method returns false when the LDIF object is initialised with an empty file.
Subject: Re: [rt.cpan.org #35331] EOF behaviour on empty files
Date: Wed, 23 Apr 2008 06:30:15 -0500
To: bug-perl-ldap [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
On Apr 23, 2008, at 5:57 AM, Joao Costa via RT wrote: Show quoted text
> The eof method returns false when the LDIF object is initialised > with an > empty file.
Please given a sample of code to demonstrate what you mean by initialized ? open(my $fh, "empty_file"); could be considered initializing the file handle $fh with an empty file but eof($fh) is not true until oyu try to read from it. Graham.
From: joaocosta [...] zonalivre.org
On Wed Apr 23 07:30:56 2008, gbarr@pobox.com wrote: Show quoted text
> Please given a sample of code to demonstrate what you mean by > initialized ?
Maybe i meant instantiated instead of initialised. For instance: ------------------------------------------ use Net::LDAP::LDIF; $ldif = Net::LDAP::LDIF->new( "file.ldif", "r", onerror => 'undef' ); while( not $ldif->eof ( ) ) { $entry = $ldif->read_entry ( ); } ------------------------------------------ If "file.ldif" is empty, the loop above still runs once, which i thought was odd. Not sure if it's the intended behaviour or not, but i was assuming the code inside the loop would not run when "file.ldif" is empty. Thanks for taking your time to look at this.