All pastes #515405 Raw Edit

Miscellany

public text v1 · immutable
#515405 ·published 2007-05-28 05:17 UTC
rendered paste body
sub wget {
$wget_outfile = 'sted.txt';
$ua = LWP::UserAgent->new;
$ua->timeout($timeout);
$ua->env_proxy;
$response = $ua->get('$_[0]');
if ($response->is_success) {
  open OUT, "> $wget_outfile" or die &nprint("E","Can't open $wget_outfile : $!");
      print OUT $response->content;
      close OUT;
      $status = "S";
                    }
else {

   &nprint("E","Something wrong happened while processing $_[0].");
   &nprint("E",$response->status_line);
   $status = "N";

                                }

return $status;
}

sub fetch {
#ACA DEBERIA IR TODAS LAS FUNCIONES QUE APLICARA EL  SOGTWARE
$downloaded = &wget("$_[0]");
# VALUE RETURNED SHOULD INDICATE: N = NOT SUCCESSFUL OPERATION, S = SUCCESSFUL OPERATION.
if ($downloaded eq "N") {
&nprint("E","Error!");
  }
}

&fetch("http://www.mit.edu/index.html");