Acme-IEnumerable

 view release on metacpan or  search on metacpan

lib/Acme/IEnumerable.pm  view on Meta::CPAN


sub element_at {
  my ($self, $index) = @_;

  Carp::cluck "Index out of range for element_at" if $index < 0;

  my $base = $self->new();
  while (1) {
    my $item = $base->();
    do {
      use Data::Dumper;
      warn Dumper[$self->count(sub { warn Data::Dumper::Dumper($_); 1; })];
      Carp::cluck "Index out of range for element_at";
    } unless ref $item;
    return $$item unless $index--;
  }
  Carp::confess("Impossible");
}

sub last {
  my ($self) = @_;
  my $base = $self->new();



( run in 0.501 second using v1.01-cache-2.11-cpan-a5abf4f5562 )