Skip to content

Commit

Permalink
- FileHandle.slurp() no longer uses sysread() as it's deprecated on h…
Browse files Browse the repository at this point in the history
…andles that have the `:utf8` layer (since perl=5.23.2)
  • Loading branch information
trizen committed Sep 18, 2015
1 parent 80db2df commit f46fe9b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/Sidef/Types/Glob/FileHandle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,12 @@ package Sidef::Types::Glob::FileHandle {

sub slurp {
my ($self) = @_;

my $size = (-s $self->{fh});
if (not defined($size) or ($size == 0)) {
local $/;
return Sidef::Types::String::String->new(CORE::readline($self->{fh}));
}

CORE::sysread($self->{fh}, (my $content), $size);
Sidef::Types::String::String->new($content);
Sidef::Types::String::String->new(
do {
local $/;
CORE::readline($self->{fh});
}
);
}

sub readline {
Expand Down

0 comments on commit f46fe9b

Please sign in to comment.