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

Re: Fighting the Good Fight against spam deluge

Johan Vromans
August 1, 2008 12:28
Re: Fighting the Good Fight against spam deluge
Message ID:
Roland Giersig <> writes:

> Could we please have a more general Iterator::Files that takes a list
> of filenames with new()?
>    $input = Iterator::Files->new(@filelist);

I don't think that is a good idea. 

Since Iterator::Diamond is intended to behave like <>, it must operate
on global @ARGV, $ARGV and ARGVOUT. When you can say:

   $input = Iterator::Files->new(@filelist);

you can also say:

   $input1 = Iterator::Files->new(@file1list);
   $input2 = Iterator::Files->new(@file2list);

and things would terribly screw up.

Besides, it is very easy and straightforward to write:

  { local (@ARGV) = @filelist;
    $input = Iterator::Files->new;
    while ( <$input> ) { ... }

Alternatively, I could limit the use of @ARGV, $ARGV and ARGVOUT to
the case where no explicit file list is used.

> Apart from that: OK.


-- Johan Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About