eval optional modules in blocks instead of strings.
FossilOrigin-Name: 20f5040a25392e4f124dccafcea60132df79c4aa7989f7b2b9094a1c70e77032
This commit is contained in:
parent
ef6d1fb0c2
commit
62022fe71c
1 changed files with 3 additions and 3 deletions
6
shelldap
6
shelldap
|
|
@ -539,7 +539,7 @@ sub ldap
|
||||||
# not installed and Net::LDAP decides it is required.
|
# not installed and Net::LDAP decides it is required.
|
||||||
#
|
#
|
||||||
if ( $conf->{'tls'} || $conf->{'server'} =~ m|ldaps://| ) {
|
if ( $conf->{'tls'} || $conf->{'server'} =~ m|ldaps://| ) {
|
||||||
eval 'use IO::Socket::SSL';
|
eval { require IO::Socket::SSL; };
|
||||||
die qq{IO::Socket::SSL not installed, but is required for SSL or TLS connections.
|
die qq{IO::Socket::SSL not installed, but is required for SSL or TLS connections.
|
||||||
You may try connecting insecurely, or install the module and try again.\n} if $@;
|
You may try connecting insecurely, or install the module and try again.\n} if $@;
|
||||||
}
|
}
|
||||||
|
|
@ -581,7 +581,7 @@ You may try connecting insecurely, or install the module and try again.\n} if $@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
undef $@; eval 'use Authen::SASL';
|
undef $@; eval { require Authen::SASL; };
|
||||||
my ( $sasl, $sasl_conn );
|
my ( $sasl, $sasl_conn );
|
||||||
my $has_sasl = ! $@;
|
my $has_sasl = ! $@;
|
||||||
my $use_sasl = $has_sasl && $conf->{'sasl'};
|
my $use_sasl = $has_sasl && $conf->{'sasl'};
|
||||||
|
|
@ -2308,7 +2308,7 @@ my $VERSION = '1.3.1';
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
use YAML::Syck;
|
use YAML::Syck;
|
||||||
use Pod::Usage;
|
use Pod::Usage;
|
||||||
eval 'use Term::ReadLine::Gnu';
|
eval { require Term::ReadLine::Gnu; };
|
||||||
warn qq{Term::ReadLine::Gnu not installed.
|
warn qq{Term::ReadLine::Gnu not installed.
|
||||||
Continuing, but shelldap is of limited usefulness without it.\n\n} if $@;
|
Continuing, but shelldap is of limited usefulness without it.\n\n} if $@;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue