--On Friday, October 17, 2003 13:54 -0400 Steve Grazzini <[EMAIL PROTECTED]> wrote:

You could use a lexically-scoped filehandle.

  {
     my $fh;

     sub do_open   { open $fh  .... }
     sub do_append { print $fh .... }
     sub do_close  { close $fh .... }
  }


I actually tried that, using the following code:
----------

my $curFile;            # The current output file.
my $html;                       # The HTML Stream.

# Some code....

# The start of a slide.
sub slide
{
# Open/create the file.
$slideNum++; # Incriment the slide number.
open $curFile, "> slide$slideNum.html" or warn "Could not open slide$slideNum.html: $!";


$html = new HTML::Stream($curFile);

# More code...  (All from HTML::Stream)
}

# The end of a slide.
sub slide_
{
# Closing code...
        
        # Close the file.
        close $curFile;
}

------------

But that doesn't seem to work either. (I've tried re-creating the HTML::Stream too, or just using the 'global' version.) This actually was my first try at it. Again, slide() works fine, but slide_() doesn't, even though it gets called. Any ideas what I'm doing wrong?

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to