Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 exploiting the Monastery: (17)
As of 2014-07-28 16:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (204 votes), past polls