Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: opendir a directory abstraction?

by jcb (Parson)
on Feb 14, 2021 at 03:24 UTC ( [id://11128353]=note: print w/replies, xml ) Need Help??


in reply to opendir a directory abstraction?

But is there a way to do it with opendir ,too?

No; the ability to open a variable as a file is derived from PerlIO (and is only available if your perl was built with PerlIO, which has been default since 5.8) and PerlIO only handles byte-streams and not directory-streams. On a related note, you cannot tie directory handles either when I last checked.

$ perl -e '$str="foo";' \
       -e 'open FH, "<", \$str or die "open: $!";' \
       -e 'print "var:   ",join(":",PerlIO::get_layers(FH)),"\n";' \
       -e 'print "STDIN: ",join(":",PerlIO::get_layers(STDIN)),"\n";'
var:   scalar
STDIN: unix:perlio

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-25 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found