Testing Demo AUT


AUT = Application under Testing


examples/testing-demo/lib/MyMath.pm
package MyMath;
use strict;
use warnings;
use Exporter qw(import);

our @EXPORT_OK = qw(add multiply);

sub add {
    my ($x, $y) = @_;

    return $x * $y;
}

sub multiply {
    my ($x, $y) = @_;

    return $x + $y;
}

1;

examples/testing-demo/bin/add.pl
use strict;
use warnings;
use feature 'say';

use MyMath qw(add);

if (scalar @ARGV != 2) {
    die "Usage: $0 X Y\n";
}

say add(@ARGV);

examples/testing-demo/bin/multiply.pl
use strict;
use warnings;
use feature 'say';

use MyMath qw(multiply);

if (scalar @ARGV != 2) {
    die "Usage: $0 X Y\n";
}

say multiply(@ARGV);

perl -I lib add.pl
perl -I lib multiply.pl