# HG changeset patch # User Davor Ocelic # Date 1557169873 -7200 # Node ID 2d7f16eff198eda056be8e6250ee9cf66bf9a000 # Parent eb1bcbaf9763cbb38f4ad7f3efa1f7b871aadf9c Use local implementation of slurp() diff -r eb1bcbaf9763 -r 2d7f16eff198 shelldap --- a/shelldap Sun May 05 10:51:34 2019 +0200 +++ b/shelldap Mon May 06 21:11:13 2019 +0200 @@ -548,7 +548,7 @@ use Carp 'confess'; use POSIX qw//; use Tie::IxHash qw//; -use Perl6::Slurp qw/slurp/; +use Fatal qw/open/; use base 'Term::Shell'; my $conf = $main::conf; @@ -716,7 +716,7 @@ } elsif($conf->{'pass'}) { $conf->{'bindpass'} = $conf->{'pass'} } elsif($conf->{'passfile'}) { - chomp( $conf->{'bindpass'} = slurp $conf->{'passfile'} ); + chomp( $conf->{'bindpass'} = slurp($conf->{'passfile'})); } } @@ -869,7 +869,7 @@ my $file = shift or return; my $md5 = Digest::MD5->new(); - open F, $file or die "Unable to read file: $!\n"; + open F, $file; my $hash = $md5->addfile( *F )->hexdigest(); close F; @@ -2006,7 +2006,7 @@ } # load it into an array for potential comparison - open LDIF, "$self->{'ldif_fname'}" or return; + open LDIF, "$self->{'ldif_fname'}"; my @orig_ldif = ; close LDIF; @@ -2056,7 +2056,7 @@ # load changes into a new array for comparison # - open LDIF, "$self->{'ldif_fname'}" or return; + open LDIF, "$self->{'ldif_fname'}"; my @new_ldif = ; close LDIF; @@ -2754,7 +2754,7 @@ } $confpath or return undef; - open YAML, $confpath or return undef; + open YAML, $confpath; do { local $/ = undef; $data = ; # slurp! @@ -2795,5 +2795,14 @@ return 1; } +sub slurp +{ + open my $fh, '<:encoding(UTF-8)', $_[0]; + local $/; + my $ret = <$fh>; + close $fh; + return $ret; +}; + ### EOF