paola82 has asked for the wisdom of the Perl Monks concerning the following question:
I was trying to download a file from a web site http://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsum/GetPage.pl?pdbcode=$pdb"
where $pdb is my var....and then I want to download a file postscript from a link...but when you try manually it ask if you want to save or see the file, so I cannot use wget command of linux...but using LWP::Simple and the mirror function it runs and below I give my codeuse LWP::Simple; print "write the name of the folder where you wanna save your file: "; my $Dir= <STDIN>; chomp ($Dir); if(!-e $Dir) { system "mkdir $Dir"; } if(!-w $Dir or !-d $Dir) { die "ERROR: Cannot access directory: '$Dir'. Exiting\n"; } print "write name of the path of that directory: "; my $path= <STDIN>; chomp ($path); my $pdb = <STDIN>; #if you wanna try use 1xmj... chomp ($pdb); my @files = (["http://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdb +sum/RunLigplot.pl?pdb=1xmj&file=ligplot01_01", "/$path/$Dir/name_ +file.pl"]); for my $duplet (@files) { mirror($duplet->[0], $duplet->[1]); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: download a file from a web
by ig (Vicar) on Apr 17, 2009 at 11:11 UTC | |
by paola82 (Sexton) on Apr 17, 2009 at 11:26 UTC | |
by paola82 (Sexton) on Apr 17, 2009 at 11:50 UTC | |
|
Re: download a file from a web
by apl (Monsignor) on Apr 17, 2009 at 12:01 UTC | |
by Your Mother (Archbishop) on Apr 17, 2009 at 19:01 UTC | |
by afoken (Chancellor) on Apr 17, 2009 at 22:12 UTC | |
by apl (Monsignor) on Apr 18, 2009 at 00:09 UTC |