Gregory S Hayes wrote:
>
> but it would look much nicer in the framework of this version of open(),
> perhaps something like ...
> 
> ($readme, $writeme) = open doublehandle "/path/program -args";
> print $writeme "here's your input\n";
> $output = $readme;
> $writeme->close;
> $readme->close;
> 
> Thoughts?

Believe it or not, I have been tooling around with this very idea. Great
minds think alike. ;-)

The exact syntax I've been toying with involves a "dual" pseudoclass,
much like the "dir" pseudoclass:

   ($readme, $writeme) = open dual "/path/program -args";
   print $writeme "here's your input\n";
   $output = <$readme>;   # readline, not assignment
   close $writeme;        # indirect object syntax
   close $readme;         # ditto

There are some subtle differences between this and your syntax to make
this comply with existing Perl, but the idea remains the same. You can
call "close $handle" or "$handle->close" by virtue of the indirect
object syntax.

-Nate

Reply via email to