Permalink
Browse files

use slurp instead of lines to avoid a rakudo hang

  • Loading branch information...
1 parent 0e1a7a5 commit 304e368270b7197049b2e76b7115fa0451e14218 @moritz moritz committed Mar 30, 2012
Showing with 4 additions and 13 deletions.
  1. +1 −1 lib/LWP/Simple.pm
  2. +3 −12 t/getstore.t
View
@@ -72,7 +72,7 @@ method request_shell (RequestType $rt, Str $url, %headers = {}, Any $content?) {
# Follow redirects. Shall we?
if $status ~~ m/ 30 <[12]> / {
- my %resp_headers = $resp_headers;
+ my %resp_headers = $resp_headers.hash;
my $new_url = %resp_headers<Location>;
if ! $new_url {
say "Redirect $status without a new URL?";
View
@@ -3,6 +3,8 @@ use Test;
use LWP::Simple;
+plan 4;
+
my $fname = "./tmp-getstore-$*PID";
unlink $fname;
@@ -14,17 +16,6 @@ ok(
my $fh = open($fname);
ok($fh, 'Opened file handle written by getstore()');
-my $found = 0;
-for $fh.lines {
- when /Opera \s+ browser/ {
- $found = 1;
- last;
- }
-}
-
-ok($found, 'Found pattern in downloaded file');
+ok $fh.slurp ~~ /Opera \s+ browser/, 'Found pattern in downloaded file';
ok(unlink($fname), 'Delete the temporary file');
-
-done;
-

0 comments on commit 304e368

Please sign in to comment.