Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: readdir() only returns one result when used with Fatal.pm

by Tomte (Priest)
on Apr 11, 2006 at 09:19 UTC ( [id://542491]=note: print w/replies, xml ) Need Help??


in reply to readdir() only returns one result when used with Fatal.pm

Seems to be a bug in context evaluation in FATAL, this code works and throws an exception when readdir returns undef:

#!/usr/bin/perl use strict; use warnings; use Fatal qw(readdir); $| = 1; my $start_dir = '.'; opendir(my $dir, $start_dir); while($_= readdir($dir)) { print "$_ "; } closedir $dir;

Update 2006/04/28: This apparently isn't a bug in Fatal, but simply the fact that readdir can't be correctly "fatalized" 'cause it doesn't clearly indicates failure (and only failure) returning a false value. The documentation of Fatal will be updated to reflect better when to use it.

regards,
tomte


An intellectual is someone whose mind watches itself.
-- Albert Camus

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://542491]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-20 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found