LanX has asked for the wisdom of the Perl Monks concerning the following question:
Perl allows to open an file "abstraction" ° by providing a scalar-ref to a string
open FH, "<", \$str;
which is cool, because we can reuse all functionality based on reading files. Like with cached files.
see open#Opening-a-filehandle-into-an-in-memory-scalar for details.
But is there a way to do it with opendir ,too?
I did some experiments providing a scalarref, but with no avail.
like opendir DH, \$str
Since telldir returns an integer-positions, I suppose the input has to be a scalar text with line delimiters and not an array.
DISCLAIMER: Since I'm not very optimistic about an existing solution, this should probably rather be a meditation (?)
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) dunno how to phrase it better
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: opendir a directory abstraction?
by Corion (Patriarch) on Feb 14, 2021 at 08:54 UTC | |
by LanX (Saint) on Feb 14, 2021 at 19:15 UTC | |
by Corion (Patriarch) on Feb 14, 2021 at 19:28 UTC | |
by LanX (Saint) on Feb 14, 2021 at 20:09 UTC | |
|
Re: opendir a directory abstraction?
by salva (Canon) on Feb 14, 2021 at 08:38 UTC | |
|
Re: opendir a directory abstraction?
by jcb (Parson) on Feb 14, 2021 at 03:24 UTC | |
|
Re: opendir a directory abstraction?
by jwkrahn (Abbot) on Feb 13, 2021 at 15:00 UTC | |
by LanX (Saint) on Feb 13, 2021 at 15:24 UTC |