in reply to Re^10: How to completely destroy class attributes with Test::Most?
in thread How to completely destroy class attributes with Test::Most?

I noodled around with this. So, the best I can tell, this makes iterating over files a two step process. First I have to create the iterator and then I have to loop over it? Something like this:

my $iterator = $fc->scan_blah_files; while ($iterator->next_file) { my $file = $iterator->selected_file; print $file . "\n"; } }

I rewrote it a bit to keep the get/next terminology:

sub AUTOLOAD { our $AUTOLOAD; my $s = shift; $AUTOLOAD =~ /.*::get(_next)*(_\w+)*_files*$/ or croak "No such method: $AUTOLOAD"; my ($next, $type) = ($1, $2); if ($next) { # create an iterat +or my $class = ref($s) . '::Iterator'; if (!$type) { return $class->new($s->get_files); # iterator for all + files } else { return $class->new(@{$s->{$type.'_files'}}); # iterator for fil +e subset } } else { return @{$s->{$type.'_files'}}; # return file subs +et } }

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks