#!/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://www77.ncifcrf.gov:7747/cgi-bin/123D+face'; 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("name=PerlScript+Protein&seq=$protein&altype=fit&matrix=gonnet&showal=yes&mdd=yes&gapeo=10&gape=1.0&email=$em"); my $res = $ua->request($req); print OUTPUT $res->as_string ; print "123D+ 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 $_; } }