diff --git a/Build.PL b/Build.PL index add70096..888a72d0 100644 --- a/Build.PL +++ b/Build.PL @@ -50,6 +50,7 @@ my $module_build_args = { "IO::Socket::SSL" => 0, "IO::Uncompress::Gunzip" => 0, "IO::Uncompress::Unzip" => 0, + "Module::Load" => 0, "Net::DNS::Resolver" => 0, "Net::IDN::Encode" => 0, "Net::IP" => 0, diff --git a/Makefile.PL b/Makefile.PL index bddf60a5..6a665983 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -70,6 +70,7 @@ my %META = ( "IO::Socket::SSL" => 0, "IO::Uncompress::Gunzip" => 0, "IO::Uncompress::Unzip" => 0, + "Module::Load" => 0, "Net::DNS::Resolver" => 0, "Net::IDN::Encode" => 0, "Net::IP" => 0, diff --git a/lib/Mail/DMARC/Report/Receive.pm b/lib/Mail/DMARC/Report/Receive.pm index 7ba15612..456acfbe 100644 --- a/lib/Mail/DMARC/Report/Receive.pm +++ b/lib/Mail/DMARC/Report/Receive.pm @@ -11,6 +11,7 @@ use Email::Simple; use Encode; use IO::Uncompress::Unzip; use IO::Uncompress::Gunzip; +use Module::Load; use XML::LibXML; use parent 'Mail::DMARC::Base'; @@ -20,7 +21,7 @@ require Mail::DMARC::Report::Aggregate::Record; sub from_imap { my $self = shift; - eval "require Net::IMAP::Simple"; ## no critic (Eval) + load "Net::IMAP::Simple"; croak "Net::IMAP::Simple seems to not work, is it installed?" if $@; my $server = $self->config->{imap}{server} or croak "no imap server conf"; @@ -112,7 +113,7 @@ sub from_mbox { # TODO: replace this module # commented out due to build test failures - # eval "require Mail::Mbox::MessageParser"; ## no critic (Eval) + # load "Mail::Mbox::MessageParser"; # croak "is Mail::Mbox::MessageParser installed?" if $@; # my $file_handle = FileHandle->new($file_name); diff --git a/lib/Mail/DMARC/Report/Store.pm b/lib/Mail/DMARC/Report/Store.pm index 4562e5b3..f26b392a 100644 --- a/lib/Mail/DMARC/Report/Store.pm +++ b/lib/Mail/DMARC/Report/Store.pm @@ -4,6 +4,7 @@ use strict; use warnings; use Carp; +use Module::Load; use parent 'Mail::DMARC::Base'; @@ -40,7 +41,7 @@ sub backend { return $self->{$backend} if ref $self->{$backend}; my $module = "Mail::DMARC::Report::Store::$backend"; - eval "use $module"; ## no critic (Eval) + load $module; if ($@) { croak "Unable to load backend $backend: $@\n"; }