All pastes #2081678 Raw Edit

Miscellany

public text v1 · immutable
#2081678 ·published 2011-09-20 23:06 UTC
rendered paste body
--- SrSv/TOR.pm (revision 3569)
+++ SrSv/TOR.pm (working copy)
@@ -32,14 +32,15 @@
 sub openURI($) {
        my ($URI) = @_;
        my $fh;
+        use IO::File;
        if($URI =~ s/^file:\/\///i) {
-               use IO::File;
                $fh = IO::File->new($URI, 'r') or die;
        } else {
        # assume HTTP/FTP URI
-               use IO::Pipe;
-               $fh = IO::Pipe->new();
-               $fh->reader(qq(wget -q -O - $URI)) or die;
+                use WWW::Mechanize;
+                my $mech = WWW::Mechanize->new();
+               $mech->get($URI, ':content_file' => "tor.txt") or die;
+                $fh = IO::File->new("tor.txt", 'r') or die;
        }
        return $fh;
 }