- my $ok = length($bar) > $barexpect -1 && length($bar) < $barexpect+1;
- ok $ok;
-
- save_output('stderr', *STDERR{IO});
-
- ok (evcheck(sub { $p->message(MESSAGE1) }, 'Count 1-10 ( 5)'),
- 1, 'Count 1-10 ( 5)');
- ok (evcheck(sub { $p->update($_) for 6..10 }, 'Count 1-10 ( 6)'),
- 1, 'Count 1-10 ( 6)');
- $err = restore_output('stderr');
+ cmp_ok length($bar), '>', $barexpect -1;
+ cmp_ok length($bar), '<', $barexpect+1;
+
+ $err = capture_stderr {
+ lives_ok { $p->message($MESSAGE1) } 'Count 1-10 ( 5)';
+ lives_ok { $p->update($_) for 6..10 } 'Count 1-10 ( 6)';
+ };