From 6128a6fa53b23aec8af4069d0e50598ab9ecfdac Mon Sep 17 00:00:00 2001 From: Bas Zoetekouw Date: Tue, 30 Sep 2008 18:43:19 +0000 Subject: Only load MIME::Lite and Email::Address if we actually need them (i.e., -m option was specified) CVS version numbers check_trans.pl: 1.66 -> 1.67 --- check_trans.pl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'check_trans.pl') diff --git a/check_trans.pl b/check_trans.pl index 8e96437df73..646cc606da3 100755 --- a/check_trans.pl +++ b/check_trans.pl @@ -84,10 +84,8 @@ use File::Spec::Functions; use List::MoreUtils qw{ uniq }; use Term::ANSIColor; use File::Slurp; -use MIME::Lite; use Encode; #use Data::Dumper; -use Email::Address; use FindBin; FindBin::again(); @@ -784,6 +782,24 @@ sub parse_cmdargs ."(assuming you know what you're doing)\n"; } + # load additional module we need for mail + if ( $OPT{'m'} ) + { + eval { + require MIME::Lite; + import MIME::Lite; + }; + die "The module MIME::Lite could not be loaded.\n" + ."Please install libmime-lite-perl\n" if $@; + + eval { + require Email::Address; + import Email::Address; + }; + die "The module Email::Address could not be loaded.\n" + ."Please install libemail-address-perl\n" if $@; + } + if ( $OPT{'g'} and not $OPT{'m'} ) { die "Option -g (debuG mail) without -m (use mail) " -- cgit v1.2.3