Hi, Chris,
 
 Thanks for your code.   I have test in my computer and it works with
necessary modification to suit for my case.

Can you give me some brief ideas that why this code is much faster
than previous one.  thanks much!

--Frank

On 5/31/05, Chris Heiland <[EMAIL PROTECTED]> wrote:
> 
> 
> > -----Original Message-----
> > From: Bob Showalter [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, May 29, 2005 5:41 AM
> > To: Fei Li; beginners@perl.org
> > Subject: Re: please help me to check why this perl script
> > does not work!
> >
> > Fei Li wrote:
> > > I wish to submit some protein sequences via LWP:UserAgent  to the
> > > http://www.cbs.dtu.dk/services/ChloroP/
> > >
> > > The error message is given as follows:
> > >
> > > <HTML><HEAD><TITLE>Webface Error</TITLE></HEAD><font
> > > color=red><h1>Webface Error: </h1><h4>
> > > Read: Field not declared; 'seqpaste'</h4> <br> </font></HTML>
> >
> > [snip]
> >
> > >         my $response =
> > > $browser->post('http://www.cbs.dtu.dk/cgi-bin/nph-webface',
> > >                       [ "SEQPASTE" => "$item",
> > >                         "submit" => "Submit"]
> > >                         );
> >
> > Just, a guess, but you're passing "SEQPASTE" when perhaps you
> > should be passing "seqpaste"?
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > <http://learn.perl.org/> <http://learn.perl.org/first-response>
> >
> >
> Assuming that was the case, here is what should be a much faster version of
> the same code.
> 
> UNTESTED:
> 
> #!/usr/bin/perl
> 
> use warnings;
> use strict;
> 
> use HTTP::Request::Common;
> use LWP::UserAgent;
> 
> my $browser = LWP::UserAgent->new;
> 
> my $infile = "my_test_file"; #input my Fasta file
> 
> open( INPUT, "$infile" ) or die "can not open $infile: $!";
> my $total = <INPUT>;
> open( OUTPUT, ">>$infile.ChloroP.res" ) or die "Cannot create the output
> file: $!";
> 
> while (<INPUT>) {
>         chomp;
>         my $response =
> $browser->post('http://www.cbs.dtu.dk/cgi-bin/nph-webface',
>                 [ "seqpaste" => "$_", "submit" => "Submit"]
>         );
> 
>         if ($response->is_success) {
>                 print OUTPUT "$response->content\n";
>                 print OUTPUT "\n*********************************\n\n\n";
>         } else  {
>                 warn "WARN!: ", $response->status_line, "\n";
>         }
> 
>         print "$. of $total finished\n";
> }
> 
> close OUTPUT;
> close INPUT;
> 
> Chris
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 
> 


-- 
Do not guess who  I am.  I am not Bush in BlackHouse

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to