Help for this page

Select Code to Download


  1. or download this
    #                Caches the first value of the iterator in %next_value
    +_for.
    
  2. or download this
        # Notes:         Keeps one forward-looking value for the iterator 
    +in
        #                   %next_value_for.  This is so we have something
    + to
        #                   return when user's code throws Am_Now_Exhauste
    +d.
    
  3. or download this
    When you use an iterator in separate parts of your program, or as an a
    +rgument to the various iterator functions, you do not get a copy of t
    +he iterator's stream of values.
    
    ...
        my $value  = $it_two->value();
        my $whoops = $it_one->value;
    Here, some_iterator_transformation takes an iterator as an argument, a
    +nd returns an iterator as a result. When a value is fetched from $it_
    +two, it internally grabs a value from $it_one (and presumably transfo
    +rms it somehow). If you then grab a value from $it_one, you'll get it
    +s second value (or third, or whatever, depending on how many values $
    +it_two grabbed), not the first.