Goodday Fine Monks,

I am working on a script that uses LWP to submit a form via POST to a cgi and collect the results. I realize that this topic has been covered before, and many have suggested perldoc lwpcook, which I have read. Nevertheless, I feel I must be missing something, as my script still does not work. At the moment I am getting an error message that looks like this:

500 (Internal Server Error) Not a SCALAR reference Client-Date: Mon, 04 Mar 2002 20:42:13 GMT
I assume the not a SCALAR reference is coming straight from perl, as it is trying to print something that doesn't exist.

I am designing this to work on an internal server, but I changed my non working script to run against a similarly configured server at UCSF. Please don't everybody run this script against their server, as I haven't cleared it with them, so if 100 of us hit it all at once, it may go down.

Ok, here the script:

#!/usr/bin/perl -w use strict; use Getopt::Std; use LWP::UserAgent; use HTTP::Request::Common qw(POST); use vars qw($ua); my %opts; getopts('hp:d:i:o:e:v:b:F:', \%opts); my $PROGRAM = $opts{'p'}; my $DB = $opts{'d'}; my $INFILE = $opts{'i'}; my $OUTFILE = $opts{'o'}; my $ESCORE; my $V; my $B; my $F; if (defined $opts{'e'}) { $ESCORE=$opts{'e'}; } else { $ESCORE=0.01; } if (defined $opts{'v'}) { $V=$opts{'v'}; } else { $V=10; } if (defined $opts{'b'}) { $B=$opts{'b'}; } else { $B=10; } if (defined $opts{'F'}) { $F=$opts{'F'}; } else { $F='T'; } #-------------------------------------------------------------- my $seq="GCAGCAGGTCGGTAGGCGGGAAATGGCGACTGGCTGAAGGAGCTGGTTCTGTTGCTGCTGC +GGGGTAAGCGGGAAAGACACCACACA"; $DB = 'baygenomicsdb'; $ua = LWP::UserAgent->new; my $req = HTTP::Request->new(POST => 'http://baygenomics.ucsf.edu/db/c +gi-bin/blast/blast.cgi'); $req->content_type('form-data'); #also tried 'application/x-www-form-u +rlencoded' $req->content( [ PROGRAM => $PROGRAM, DATALIB => $DB, SEQUENCE => $seq, EXPECT => $ESCORE, DESCRIPTIONS => $V, ALIGNMENTS => $B ]); print $ua->request($req)->as_string;
The script get executed like this on the command line:
$ ./test-post.pl -p blastn -d hs_all.fa -i test.in -o test.out
Currently, the -d, -i and -o flags are not used even though they are specified.

Thanks for your time.
Scott


In reply to LWP/Post with several arguments by scain

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.