#!/usr/local/bin/perl -w use LWP::UserAgent; use HTTP::Request::Common qw(POST); $em = &promptUser("Enter the email address to send the results to "); open (PSTRINGS, "pstrings.txt") || die "Protein string file missing!"; @proteins=; close (PSTRINGS); my $url = 'http://insulin.brunel.ac.uk/cgi-bin/psipred/psipred.cgi'; my $ua = LWP::UserAgent->new(); my $req = HTTP::Request->new(POST => $url); open (OUTPUT, ">output.htm"); foreach $protein (@proteins) { chomp($protein); print "$protein\n"; $req->content_type('application/x-www-form-urlencoded'); $req->content("Email=$em&Sequence=$protein&Subject=PerlScript+Protein&Program=mgenthreader"); my $res = $ua->request($req); print OUTPUT $res->as_string ; print "GenTHREADER Query Submitted\n" } sub promptUser { local($promptString,$defaultValue) = @_; if ($defaultValue) { print $promptString, "[", $defaultValue, "]: "; } else { print $promptString, ": "; } $| = 1; # force a flush after our print $_ = ; # get the input from STDIN (presumably the keyboard) chomp; if ("$defaultValue") { return $_ ? $_ : $defaultValue; # return $_ if it has a value } else { return $_; } }