joe++ has asked for the wisdom of the Perl Monks concerning the following question:
I'm in the process of connecting the ouput of one external module to the input of another external module. The problem ist that the caller gives me a scalar ref, while I can call the imported method only with a file handle for output.
My solution is to pass the incoming scalar reference to one of IO::File or IO::Scalar, and then passing the resulting file handle along to the next function.
Now my question is: which IO::* module should I pick, considering that I want to ditribute my code to the general Perl users audience?
The docs of IO::Scalar mention IO::String as being its potential successor, but there is only one release of this module on CPAN, which also predates IO::Scalar's latest release...
Example code (snippet):
Any help and opinions are welcome!... # do they provide a scalar ref as output buffer? if ($output_ref) { $fh_out = new IO::Scalar($output_ref); } ... if (defined $fh_out) { # write XML to the scalar-tied file handle $self->{x_out} = new XML::Writer(OUTPUT => $fh_out); } else { # default: print to STDOUT $self->{x_out} = new XML::Writer(); } ...
Joe.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: IO::Scalar vs IO::String
by hiseldl (Priest) on Sep 13, 2002 at 13:51 UTC | |
by joe++ (Friar) on Sep 13, 2002 at 14:01 UTC | |
by hiseldl (Priest) on Sep 13, 2002 at 14:15 UTC | |
Re: IO::Scalar vs IO::String
by PodMaster (Abbot) on Sep 14, 2002 at 04:37 UTC |