On demand Import



examples/modules/B/Calc.pm
package B::Calc;
use strict;
use warnings;

use Exporter qw(import);

our @EXPORT = qw(add);
our @EXPORT_OK = qw(multiply);

my $base = 10;

sub add {
    validate_parameters(@_);

    my $total = 0;
    $total += $_ for (@_);
    return $total;
}

sub multiply {
}

sub validate_parameters {
    die 'Not all of them are numbers'
        if  grep {/\D/} @_;
    return 1;
}


1;

examples/modules/calcb.pl
#!/usr/bin/perl
use strict;
use warnings;

use lib 'examples/modules';

use B::Calc qw(add);

print add(2, 3), "\n";