From: danparker276@yahoo.com on
I have to connect to this module, and I usually send it a file handle,
or stdout. But I want to write it to a string. Is there a string
buffer or something I can use?

open (FILEO, ">test.txt");
$xw = MP3Com::XMLWriter->new (\*FILEO);

or
$xw = MP3Com::XMLWriter->new (\*STDOUT);

I want to do:
my $xmlstring
$xw = MP3Com::XMLWriter->new ($xmlstring);

From: Paul Lalli on
danparker276(a)yahoo.com wrote:
> I have to connect to this module, and I usually send it a file handle,
> or stdout. But I want to write it to a string. Is there a string
> buffer or something I can use?

Yes.

> open (FILEO, ">test.txt");
> $xw = MP3Com::XMLWriter->new (\*FILEO);
>
> or
> $xw = MP3Com::XMLWriter->new (\*STDOUT);
>
> I want to do:
> my $xmlstring
> $xw = MP3Com::XMLWriter->new ($xmlstring);

Check the documentation for the function you're using. In this case,
that's open:
perldoc -f open
[snip]
File handles can be opened to "in memory" files held
in Perl scalars via:

open($fh, '>', \$variable) || ..
[snip]

Paul Lalli

From: Brian McCauley on
danparker276(a)yahoo.com wrote:

> I have to connect to this module, and I usually send it a file handle,
> or stdout. But I want to write it to a string. Is there a string
> buffer or something I can use?

Yes.

> open (FILEO, ">test.txt");

perldoc -f open

(At least on recent Perl. On older Perl you can't just use open() to
make a scalar behave like a file and you need the IO::Scalar module).

BTW: If you _do_ have a recent Perl then you should accept the standard
admonishment to read the documentation for the functions you are using
before you start asking others for help.

From: danparker276@yahoo.com on

Paul Lalli wrote:
> danparker276(a)yahoo.com wrote:
> > I have to connect to this module, and I usually send it a file handle,
> > or stdout. But I want to write it to a string. Is there a string
> > buffer or something I can use?
>
> Yes.
>
> > open (FILEO, ">test.txt");
> > $xw = MP3Com::XMLWriter->new (\*FILEO);
> >
> > or
> > $xw = MP3Com::XMLWriter->new (\*STDOUT);
> >
> > I want to do:
> > my $xmlstring
> > $xw = MP3Com::XMLWriter->new ($xmlstring);
>
> Check the documentation for the function you're using. In this case,
> that's open:
> perldoc -f open
> [snip]
> File handles can be opened to "in memory" files held
> in Perl scalars via:
>
> open($fh, '>', \$variable) || ..

This just opens a file called SCALAR(0x8a09e30)


> [snip]
>
> Paul Lalli

From: xhoster on
"danparker276(a)yahoo.com" <danparker276(a)yahoo.com> wrote:
> I have to connect to this module, and I usually send it a file handle,
> or stdout. But I want to write it to a string. Is there a string
> buffer or something I can use?

I think this should do what you want, from perldoc -f open:

Since v5.8.0, perl has built using PerlIO by
default. Unless you've changed this (ie Configure
-Uuseperlio), you can open file handles to "in
memory" files held in Perl scalars via:

open($fh, '>', \$variable) || ..


Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
 |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8
Prev: Boolean Regexp with perlre
Next: Taint and memory usage