package Foo::Live; sub new { my $class = shift; return bless { iterator => Iterator->new(class => $class)->where(live => 1); }, class; }; sub next { my $self = shift; $self->{iterator}->next; }; #### my $foo = Foo::Live->new; while (my $subfoo = $foo->next) { print "$subfoo\n" }; #### $o->foo unless eval { $foo->bar }; #### eval { $foo->bar }; $o->foo if $@;