Use local implementation of slurp()
FossilOrigin-Name: 8dbbb620b86c4f0dca85a2be208473a7f1cc6ae5f8658b9edae342c347915550
This commit is contained in:
parent
248cedd05e
commit
deb044199f
1 changed files with 15 additions and 6 deletions
21
shelldap
21
shelldap
|
|
@ -548,7 +548,7 @@ use Algorithm::Diff qw//;
|
||||||
use Carp 'confess';
|
use Carp 'confess';
|
||||||
use POSIX qw//;
|
use POSIX qw//;
|
||||||
use Tie::IxHash qw//;
|
use Tie::IxHash qw//;
|
||||||
use Perl6::Slurp qw/slurp/;
|
use Fatal qw/open/;
|
||||||
use base 'Term::Shell';
|
use base 'Term::Shell';
|
||||||
|
|
||||||
my $conf = $main::conf;
|
my $conf = $main::conf;
|
||||||
|
|
@ -716,7 +716,7 @@ You may try connecting insecurely, or install the module and try again.\n} if $@
|
||||||
} elsif($conf->{'pass'}) {
|
} elsif($conf->{'pass'}) {
|
||||||
$conf->{'bindpass'} = $conf->{'pass'}
|
$conf->{'bindpass'} = $conf->{'pass'}
|
||||||
} elsif($conf->{'passfile'}) {
|
} elsif($conf->{'passfile'}) {
|
||||||
chomp( $conf->{'bindpass'} = slurp $conf->{'passfile'} );
|
chomp( $conf->{'bindpass'} = slurp($conf->{'passfile'}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -869,7 +869,7 @@ sub chksum
|
||||||
my $file = shift or return;
|
my $file = shift or return;
|
||||||
|
|
||||||
my $md5 = Digest::MD5->new();
|
my $md5 = Digest::MD5->new();
|
||||||
open F, $file or die "Unable to read file: $!\n";
|
open F, $file;
|
||||||
my $hash = $md5->addfile( *F )->hexdigest();
|
my $hash = $md5->addfile( *F )->hexdigest();
|
||||||
close F;
|
close F;
|
||||||
|
|
||||||
|
|
@ -2006,7 +2006,7 @@ sub run_edit
|
||||||
}
|
}
|
||||||
|
|
||||||
# load it into an array for potential comparison
|
# load it into an array for potential comparison
|
||||||
open LDIF, "$self->{'ldif_fname'}" or return;
|
open LDIF, "$self->{'ldif_fname'}";
|
||||||
my @orig_ldif = <LDIF>;
|
my @orig_ldif = <LDIF>;
|
||||||
close LDIF;
|
close LDIF;
|
||||||
|
|
||||||
|
|
@ -2056,7 +2056,7 @@ sub run_edit
|
||||||
|
|
||||||
# load changes into a new array for comparison
|
# load changes into a new array for comparison
|
||||||
#
|
#
|
||||||
open LDIF, "$self->{'ldif_fname'}" or return;
|
open LDIF, "$self->{'ldif_fname'}";
|
||||||
my @new_ldif = <LDIF>;
|
my @new_ldif = <LDIF>;
|
||||||
close LDIF;
|
close LDIF;
|
||||||
|
|
||||||
|
|
@ -2754,7 +2754,7 @@ sub load_config
|
||||||
}
|
}
|
||||||
$confpath or return undef;
|
$confpath or return undef;
|
||||||
|
|
||||||
open YAML, $confpath or return undef;
|
open YAML, $confpath;
|
||||||
do {
|
do {
|
||||||
local $/ = undef;
|
local $/ = undef;
|
||||||
$data = <YAML>; # slurp!
|
$data = <YAML>; # slurp!
|
||||||
|
|
@ -2795,5 +2795,14 @@ sub save_config
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub slurp
|
||||||
|
{
|
||||||
|
open my $fh, '<:encoding(UTF-8)', $_[0];
|
||||||
|
local $/;
|
||||||
|
my $ret = <$fh>;
|
||||||
|
close $fh;
|
||||||
|
return $ret;
|
||||||
|
};
|
||||||
|
|
||||||
### EOF
|
### EOF
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue