Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

stefan k's scratchpad

by stefan k (Curate)
on Jun 01, 2004 at 16:58 UTC ( [id://358222]=scratchpad: print w/replies, xml ) Need Help??

My problem with bsd_glob()

See bsd_glob does not reset $!]
# This file is not there so it doesn't match and afterwards $! ist # set. OK my $pat2 = "this_will_miss_in_globbing"; print "\nPATT $pat2\n"; print "PRE ERR: ", Dumper($!); @list = bsd_glob($pat2, GLOB_ERR | !GLOB_NOCHECK); print "POST ERR: ", Dumper($!); print "GLOB_ERROR: ", Dumper(GLOB_ERROR); print Dumper(\@list); print "\n"; # This file exists so the match is a success # afterwards $! ist still set which is OK my $pat3 = "passwords.dat"; print "\nPATT $pat3\n"; print "PRE ERR: ", Dumper($!); @list = bsd_glob($pat3, GLOB_ERR | !GLOB_NOCHECK); print "POST ERR: ", Dumper($!); print "GLOB_ERROR: ", Dumper(GLOB_ERROR); print Dumper(\@list); print "\n"; # This resets $! back to normal ?? my $pat4 = "*.dat"; print "\nPATT $pat4\n"; print "PRE ERR: ", Dumper($!); @list = bsd_glob($pat4, GLOB_ERR | !GLOB_NOCHECK); print "POST ERR: ", Dumper($!); print "GLOB_ERROR: ", Dumper(GLOB_ERROR); print Dumper(\@list); print "\n";
This produces the output:
PATT this_will_miss_in_globbing PRE ERR: $VAR1 = ''; POST ERR: $VAR1 = 'No such file or directory'; GLOB_ERROR: $VAR1 = 0; $VAR1 = []; PATT passwords.dat PRE ERR: $VAR1 = 'No such file or directory'; POST ERR: $VAR1 = 'No such file or directory'; GLOB_ERROR: $VAR1 = 0; $VAR1 = [ 'passwords.dat' ]; PATT *.dat PRE ERR: $VAR1 = 'No such file or directory'; POST ERR: $VAR1 = ''; GLOB_ERROR: $VAR1 = 0; $VAR1 = [ 'DATEN_20050427210054.dat', 'passwords.dat' ];

 Node Collection 

New user scratch pad.
Number of Monks by Level
How good is Perl for AI?
Seeking a good punchline
fork...
Fun With Perl: Golf
XS Library - Embedding C code in Perl
3-D Stereogram, Self replicating source.
camel code<INSERTHERE>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2024-04-19 07:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found