IOLayer::StripHTML has been uploaded
to CPAN. That's a small input-only perlio layer, written in perl, whose idea was suggested at the latest Lyon.pm meeting. Next step is to write the
output-only counterpart. Further step may be to write
a small article about it, first in a hypothetical series
what's new in the shiny world of Perl 5.8.
P.S. If you like closures, this module
(although very short) uses some of them in an
interesting way. There's even an lvalue closure. Cool.
interesting (Score:1)
One small point, don't you seem to call $p->eof. I've had odd things happen sometimes without it.
Re:interesting (Score:1)
Extremely Exciting (Score:2)
This is of course incredibly cool. I've been toying with the idea of making one myself, but I can't seem to find docs on how one passes arguments to a layer (say
open $fh,"<:Via(Foo::Bar=arg1,arg2)";?). The docs for PerlIO::Via haven't been very helpful there (or I've been very dumb).-- Robin Berjon [berjon.com]
Re:Extremely Exciting (Score:1)
Re:Extremely Exciting (Score:2)
Hmm, that's a pity. I was hoping that PerlIO::Via would have argument passing semantics (as the above would be an illegal class name) so that arguments could be passed to the layer.
The reason I came up with this was while thinking about IOLayer::XSLT. One would need to provide the path to the stylesheet as an argument, and if one can't then there's no way of implementing that module.
I'll look into subclassing PerlIO::Via to see if that could work, as I would very much like to avoid having to
-- Robin Berjon [berjon.com]
Re:Extremely Exciting (Score:1)
to work. In fact the internals of this thing are not very clearly documented and I'm just beginning to get how it works.
To keep it simple, I suggest action-at-distance
my $fh = do {
# this global variable is read at push-time
local $IOLayer::XSLT::path = "....";
open my $fh, ">:Via(IOLayer::XSLT)", "..."
or die $!;
$fh;
};
Re:Extremely Exciting (Score:2)
I very much doubt subclassing will work either, in fact I tried and it didn't appear to do anything, though I might have done it wrong.
Action-at-a-distance is out of the picture, either it can be done cleanly or I won't bother. One thing I thought about was
$fh->setPath('/path/to/file.xsl')but that's not really satisfying, if indeed it does work (I'm pretty much sure it won't if IOLayer::XSLT isn't the last one in the stack).I don't have much time to consecrate to this, but my current pla
-- Robin Berjon [berjon.com]
Re:Extremely Exciting (Score:1)
Re:Extremely Exciting (Score:2)
Sorry, I didn't mean to imply that this was a Perl limit, just a limit in an implementation of something that ships with Perl.
I very much know that I can go ahead and implement a different Via module, I just wish that it were in this module (note: I'm not complaining, otherwise I'd be working on that right now and sending stuff to p5p). Part of this idea was precisely to implement something that would help test perlio, it's in fact the main reason why I grabbed RC1 (apart from checking that my stuf
-- Robin Berjon [berjon.com]