Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by Tomte (Priest)
on Apr 11, 2006 at 09:19 UTC ( #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


Comment on Re: readdir() only returns one result when used with Fatal.pm
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2015-07-01 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (24 votes), past polls