Another approach is to add another level into the hash:
package FunnyEmail;
use strict;
use warnings;
use Email::Simple;
sub new {
my $class = shift;
my $simple = Email::Simple->new(...);
my $self = {simple => $simple};
bless $self, $class;
}
Now, you have to redirect all the methods of Email::Simple into the subhash:
our $AUTOLOAD;
sub AUTOLOAD {
my $self = shift;
my $simple = $self->{simple};
my $method = (split /::/, $AUTOLOAD)[-1];
if ($simple->can($method)) {
$simple->$method(@_);
} else {
die "Cannot run $method\n";
}
}