Skip to content

Commit

Permalink
slurp a little faster
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 18, 2015
1 parent ec6fc90 commit 683f4a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,7 +1,8 @@

6.16 2015-08-16
6.16 2015-08-18
- Improved check_box, radio_button and select_field tag helpers to handle the
attributes "checked" and "selected" correctly.
- Improved performance of slurp function in Mojo::Util slightly.

6.15 2015-08-13
- Removed deprecated build_body and build_headers methods from Mojo::Content.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Util.pm
Expand Up @@ -233,9 +233,9 @@ sub sha1_sum { sha1_hex @_ }

sub slurp {
my $path = shift;
croak qq{Can't open file "$path": $!} unless open my $file, '<', $path;
croak qq{Can't open file "$path": $!} unless open my $file, '<:unix', $path;
my $content = '';
while ($file->sysread(my $buffer, 131072, 0)) { $content .= $buffer }
while (read $file, my $buffer, 131072, 0) { $content .= $buffer }
return $content;
}

Expand Down

0 comments on commit 683f4a2

Please sign in to comment.