> -----Original Message-----
> From: Jackson, Jonah [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 8:42 PM
> To: [EMAIL PROTECTED]
> Subject: HTML::Stream mod
>
>
> Anyone use this module? I can't seem to use a file handle
> for the stream. The syntax:
>
> use HTML::Stream qw(:funcs);
> open (FP,">$htmlfile") || die "Could not open file
> $htmlfile for write\: $!\n";
> $ht =3D HTML::Stream->new (FP);
Use: $ht =3D HTML::Stream->new(\*FP);
> $ht->text("This is a test\n");
>
> gives me an empty file named $htmlfile.
>
> replace the third line with=20
>
> $ht =3D HTML::Stream->new /*STDOUT;
>
> I do get:
>
> This is a test
>
> on the console.
>
> I'm a perl newbie so I could be doing a million things wrong.
> Anyone anna point my tricycle back in the right direction?
Add the following to the top of your script:
use strict;
That will catch your original error. What you had:
$ht =3D HTML::Stream->new(FP);
is equivalent to:
$ht =3D HTML::Stream->new("FP");
Another way to handle this is to use a lexical to
hold the filehandle:
open(my $fp, ">$htmlfile") or die $!;
my $ht = HTML::Stream->new($fp);
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]