sub load_commodmap() {
undef %commodmap;
- my $c= new IO::File "#commodmap#.tsv";
+ my $c= new IO::File "_commodmap.tsv";
if (!$c) { $!==&ENOENT or die $!; return; }
while (<$c>) {
m/^(\S.*\S)\t(\d+)\n$/ or die "$_";
my $incommodmap=0;
my $intag='';
my %got;
- my $o= new IO::File "#commodmap#.tsv.new",'w' or die $!;
+ my $o= new IO::File "_commodmap.tsv.tmp",'w' or die $!;
undef %commodmap;
my $xp= new XML::Parser
# print STDERR "[[[$content]]]\n";
$xp->parse($content);
close $o or die $!;
- rename "#commodmap#.tsv.new","#commodmap#.tsv" or die $!;
+ rename "_commodmap.tsv.tmp","_commodmap.tsv" or die $!;
}
our %newcommods;
my $rsync= $ENV{'YPPSC_PCTB_RSYNC'};
$rsync= 'rsync' if !defined $rsync;
- my $local= "#master-newcommods#.txt";
+ my $local= "_master-newcommods.txt";
my $src= $ENV{'YPPSC_PCTB_DICT_UPDATE'};
if ($src) {
my $remote= "$src/master-newcommods.txt";
die "$? $!" if $! or $?;
}
read_newcommods($local);
- read_newcommods('#local-newcommods#.txt');
+ read_newcommods('_local-newcommods.txt');
}
our (%stallmap, @stallmap);
sub save_upload_html ($$) {
my ($which, $resptxt) = @_;
- open R, ">./#upload-$which#.html" or die $!;
+ open R, ">./_upload-$which.html" or die $!;
print R $resptxt or die $!;
close R or die $!;
}
]
};
- print STDERR "Uploading data to server...\n";
+ print STDERR "Uploading data to $pctb...\n";
my $resp= $ua->post("$url", Content => $content,
Content_Type => 'form-data');
my $resptxt= $resp->content();
save_upload_html('1', $resptxt);
- open R, ">./#upload-1#.html" or die $!;
+ open R, ">./_upload-1.html" or die $!;
print R $resptxt or die $!;
close R or die $!;
die "@forcerls ?" if grep { $_ ne $forcerl } @forcerls;
my $setisland= {
- 'action' => 'setisland',
- 'filename' => $filename,
- 'forcereload' => $forcerl,
- 'ocean' => $oceanids[0],
- 'island' => $islandid,
};
print STDERR "Setting ocean and island...\n";
- $resp= $ua->post("${url}IWJTEST", $setisland);
+ my $siurl= ($url . "?action=setisland".
+ "&filename=$filename".
+ "&forcereload=$forcerl".
+ "&ocean=$oceanids[0]".
+ "&island=$islandid");
+ $resp= $ua->get($siurl);
+
die $resp->status_line unless $resp->is_success;
$resptxt= $resp->content();
save_upload_html('2', $resptxt);
-
-
-#
-#http://pctb.ilk.org/upload.php?&ocean=2&island=48&action=setisland&forcereload=1244748679&filename=PFayDW' >v.html
-#
-# print ">$filename|$forcerl|@oceanids|$islandid<\n";
+ die unless $resptxt =~ m/your uploaded data has been processed/i;
+ die unless $resptxt =~ m/your data has been integrated into the database/i;
+
+ $resptxt =~ s/\<a href=\"about:\w+\"\>[^<>]+\<\/a\>//g;
+ save_upload_html('3', $resptxt);
- system 'printenv|grep YPP|sort';
+ print "\n" or die $!;
+ system('w3m -T text/html -dump < _upload-3.html');
+
+ print "\n" or die $!;
}