develooper Front page | perl.perl5.porters | Postings from August 2008

Iterator::Diamond (Was: Re: Fighting the Good Fight against spam deluge)

Thread Previous | Thread Next
From:
Johan Vromans
Date:
August 2, 2008 02:28
Subject:
Iterator::Diamond (Was: Re: Fighting the Good Fight against spam deluge)
Message ID:
m2k5ezwyt4.fsf_-_@phoenix.squirrel.nl
"H.Merijn Brand" <h.m.brand@xs4all.nl> writes:

> What I was wondering, can you switch mode during while (<>) ?
> 
> my $input = Iterator::Files->new;
> while (<$input>) {
>    ...;
>    m/some situation/ and # I want all files to come to open different
>        $input->magic ("stdin");
>    ...;
>    }

Maybe Iterator::Files can :).
Iterator::Diamond is intended to do what <> does, but safely.

I do, however, consider adding pre/post open/close callbacks for fine
tuning. It does go way beyond the original intent, though.

-- Johan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About