Change 13402 by jhi@alpha on 2001/12/01 15:52:13

        Subject: Re: [PATCH] [ID 20011130.166] "in memory" file handles via scalas not 
documented in perldoc -f open 
        From: Tels <[EMAIL PROTECTED]>
        Date: Sat, 01 Dec 2001 10:29:11 +0100 (CET)
        Message-Id: <[EMAIL PROTECTED]>

Affected files ...

.... //depot/perl/pod/perlfunc.pod#280 edit

Differences ...

==== //depot/perl/pod/perlfunc.pod#280 (text) ====
Index: perl/pod/perlfunc.pod
--- perl/pod/perlfunc.pod.~1~   Sat Dec  1 09:00:05 2001
+++ perl/pod/perlfunc.pod       Sat Dec  1 09:00:05 2001
@@ -2666,6 +2666,8 @@
 
 =item open FILEHANDLE,MODE,EXPR,LIST
 
+=item open FILEHANDLE,MODE,REFERENCE
+
 =item open FILEHANDLE
 
 Opens the file whose filename is given by EXPR, and associates it with
@@ -2778,6 +2780,10 @@
 
 opens a filehandle to an anonymous temporary file.
 
+File handles can be opened to "in memory" files held in Perl scalars via:
+
+    open($fh,'>', \$variable) || ..
+
 Examples:
 
     $ARTICLE = 100;
@@ -2802,6 +2808,11 @@
     open(EXTRACT, "|sort >/tmp/Tmp$$")         # $$ is our process id
        or die "Can't start sort: $!";
 
+    # in memory files
+    open(MEMORY,'>', \$var)
+       or die "Can't open memory file: $!";
+    print MEMORY "foo!\n";                     # output will end up in $var
+
     # process argument list of files along with any includes
 
     foreach $file (@ARGV) {
End of Patch.

Reply via email to