The same computation but we expect the wrong value ... This is not that clever but I could not find a real bug in bc to show here as an example and
I'd like to show what happens when the computation fails. Example 7-3. examples/bc/bc3.pl #!/usr/bin/perl
use strict;
use warnings;
use Expect;
my $e = Expect->new;
$e->raw_pty(1);
$e->spawn("bc") or die "Cannot run bc\n";
$e->expect(1, "warranty") or die "no warranty\n";
$e->send("23+7\n");
$e->expect(1, 29) or die "no sum\n";
print "Success\n";
If you are interested in on-site trainings by the author, please
contact me directly.
|