Rev 5710 | Blame | Compare with Previous | Last modification | View Log | RSS feed
######################################################################### COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.## Module name : getDoc.pl# Module type : Makefile system# Compiler(s) : Perl# Environment(s): jats## Description :## Usage:## Version Who Date Description##......................................................................#require 5.008_002;use strict;use warnings;use Pod::Usage;use Getopt::Long;use JatsError;use JatsSystem;foreach my $docNum ( @ARGV ){my $pageURL="http://bms:80/docregister/docLinkTo.asp?docnum=$docNum";print "--- $pageURL\n";## Get the document data#my $tmp_file = 'wget.data';unlink $tmp_file;System ('wget','--http-user=vix\\dpurdie','--http-passwd=!stephaniec',"--output-document=$tmp_file",$pageURL );my $docURL;open ( my $fh, '<', $tmp_file ) || Error ("Cannot open file:$tmp_file: $!");while ( <$fh> ){print "$_\n";if ( m/self.location.href='(.*)'/ ){$docURL = $1;last;}}close $fh;unlink $tmp_file;Error ("Could not find doc ref: $docNum") unless $docURL;print "$docURL\n";## Extract file name#$docURL =~ m~.*/(.*)$~;my $fname = $1;$fname =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg;print "$fname\n";System ('wget','--http-user=vix\\dpurdie','--http-passwd=!stephaniec',"--output-document=$fname",$docURL );}