Parent Directory
|
Revision Log
Revision 1.1 - (view) (download) (as text)
1 : | disz | 1.1 | #!/usr/bin/perl -w |
2 : | use strict; | ||
3 : | use LWP::UserAgent; | ||
4 : | use HTTP::Request::Common; | ||
5 : | use Getopt::Long; | ||
6 : | use File::Basename; | ||
7 : | use Data::Dumper; | ||
8 : | |||
9 : | |||
10 : | my $ua = new LWP::UserAgent; | ||
11 : | $HTTP::Request::Common::DYNAMIC_FILE_UPLOAD=1; | ||
12 : | #my $url = "http://bio-macpro-1.mcs.anl.gov/~disz/FIG/test_server.cgi"; | ||
13 : | my $url = "http://bio-macpro-1.mcs.anl.gov/~disz/FIG/figfam_server_1.cgi"; | ||
14 : | |||
15 : | my $fname = $ARGV[0]; | ||
16 : | |||
17 : | my @form = (Content => [upfile => [$fname]]); | ||
18 : | |||
19 : | my $form = ">FQ8D8DZ01A01DU\nMALDVAAIRAHVPALKSGTARFDAPGGTQTPQPVIDAIAAALTAPLANRGRNTEGERNADRIVDEARSALADLLGTTPGTVVFGRSATQLAYDLSRTLAKGWGPGDEVVVTRLDHDSNIRPWVQAAEAAGADVRWADFDPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRLLTALGALER\n>FOO\nDPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRL\n>TEST\nMALDVAAIRAHVPALKSGTARFDAPGGTQTPQPVIDAIAAALTAPLANRGRNTEGERNADRIVDEARSALADLLGTTPGTVVFGRSATQLAYDLSRTLAKGWGPGDEVVVTRLDHDSNIRPWVQAAEAAGADVRWADFDPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRL\n>fig|83333.1.peg.4\nMKLYNLKDHNEQVSFAQAVTQGLGKNQGLFFPHDLPEFSLTEIDEMLKLDFVTRSAKILSAFIGDEIPQEILEERVRAAFAFPAPVANVESDVGCLELFHGPTLAFKDFGGRFMAQMLTHIAGDKPVTILTATSGDTGAAVAHAFYGLPNVKVVILYPRGKISPLQEKLFCTLGGNIETVAIDGDFDACQALVKQAFDDEELKVALGLNSANSINISRLLAQICYYFEAVAQLPQETRNQLVVSVPSGNFGDLTAGLLAKSLGLPVKRFIAATNVNDTVPRFLHDGQWSPKATQATLSNAMDVSQPNNWPRVEELFRRKIWQLKELGYAAVDDETTQQTMRELKELGYTSEPHAAVAYRALRDQLNPGEYGLFLGTAHPAKFKESVEAILGETLDLPKELAERADLPLLSHNLPADFAALRKLMMNHQ | ||
20 : | \n"; | ||
21 : | |||
22 : | # | ||
23 : | # The POST method also supports the `multi- | ||
24 : | # part/form-data' content used for Form-based File | ||
25 : | # Upload as specified in RFC 1867. You trigger this | ||
26 : | # content format by specifying a content type of | ||
27 : | # `'form-data'' as one of the request headers. If one | ||
28 : | # of the values in the $form_ref is an array reference, | ||
29 : | # then it is treated as a file part specification with | ||
30 : | # the following interpretation: | ||
31 : | # | ||
32 : | # [ $file, $filename, Header => Value... ] | ||
33 : | # | ||
34 : | # The first value in the array ($file) is the name of a | ||
35 : | # file to open. This file will be read and its content | ||
36 : | # placed in the request. The routine will croak if the | ||
37 : | # file can't be opened. Use an `undef' as $file value | ||
38 : | # if you want to specify the content directly. The | ||
39 : | # $filename is the filename to report in the request. | ||
40 : | # If this value is undefined, then the basename of the | ||
41 : | # $file will be used. You can specify an empty string | ||
42 : | # as $filename if you don't want any filename in the | ||
43 : | # request. | ||
44 : | my $res = $ua->post( $url."?function=assign_function_to_prot", Content_Type => 'multipart/form-data', | ||
45 : | 'Content' => [ 'subject' => 'Demand', | ||
46 : | #'upfile' => [$fname], | ||
47 : | # else send in line string | ||
48 : | 'upfile' => [ | ||
49 : | undef, | ||
50 : | 'inline', | ||
51 : | 'Content_Type' => 'application/fasta', | ||
52 : | 'Content' => "$form" | ||
53 : | ] | ||
54 : | ]); | ||
55 : | if ($res->is_success) { | ||
56 : | print $res->content; | ||
57 : | } else { | ||
58 : | print "Error ", $res->content; | ||
59 : | }; | ||
60 : | |||
61 : | exit; |
MCS Webmaster | ViewVC Help |
Powered by ViewVC 1.0.3 |