The module Buffered provides buffered versions of
Open.file, Open.socket and
Open.pipe. The write(vs:VS) method
appends VS to an internal buffer. A method
flushBuffer is provided that causes the buffer's
content to be flushed via Open.xyz, write(...).
The flushBuffer method is automatically triggered by
{File close}
{Socket shutDown(...)}
{Pipe close(...)}
push and pop($)
allow for nesting buffers.
Html.'class' provides a tag method
similar to Open.html (I just copied the code
from Open.html and modified/extended it).
The main difference is that in this version each tag is written
via {self write(vs:...)} instead of first generating
one virtual string and writing it in one go.
Together with classes like Buffered.file, however, the
advantage of concatenation is back again, it happens just somewhere else.
(In principle, it is possible to use this class together with the original
classes Open.file etc., but this may be very slow.)
So why are we doing all this?
The main new feature of this aproach is that it allows for method calls
somewhere deep down in the argument of tag(...). See
Html.document for a demo application.
To view the interface documentation generated by ozh, click here.
class MyHtml from Html.'class'
meth writeTitle
{self write(vs:"Oh, Happy Day... :-)")}
end
meth writeHtml(Content)}
{self tag(html(head(title('self'(writeTitle)))
body(h1('self'(writeTitle))#Content)))}
end
end
This package can be installed by following the usual
configure, build, install procedure, i.e. by executing a the
shell:
./configure
make install
By default, all files of the package are
installed in the user's ~/.oz directory tree. In
particular, all modules are installed in the user's private cache.