+ my $resptxt= $resp->content();
+ save_upload_html('1', $resptxt);
+
+ open R, ">./#upload-1#.html" or die $!;
+ print R $resptxt or die $!;
+ close R or die $!;
+
+ my @filenames= $resptxt =~
+ m/input\s+type="hidden"\s+name="filename"\s+value=\"([_.0-9a-z]+)\"/ig;
+ @filenames or die;
+
+ my @forcerls= $resptxt =~
+ m/input\s+type="hidden"\s+name="forcereload"\s+value=\"([1-9]\d+)\"/ig;
+ @forcerls or die;
+
+ my $filename= $filenames[0];
+ my $forcerl= $forcerls[0];
+
+ $ocean= ucfirst lc $ocean;
+ my @oceanids= $resptxt =~
+ m/\<option value\=\"(\d+)\"\>$ocean\<\/option\>/;
+ @oceanids==1 or die "@oceanids ?";
+
+ my $islandid;
+ while ($resptxt =~
+ m/^islands\[\d+\]\[\d+\]\=new\s+option\(\"(.*)\"\,(\d+)\)\s*$/mig
+ ) {
+ next unless $1 eq $island;
+ $islandid= $2;
+ }
+ defined $islandid or die;
+
+ die "@filenames ?" if grep { $_ ne $filename } @filenames;
+ die "@forcerls ?" if grep { $_ ne $forcerl } @forcerls;
+
+ my $setisland= {
+ };
+
+ print STDERR "Setting ocean and island...\n";
+
+ 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);
+
+ 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);
+
+ print "\n" or die $!;
+ system('w3m -T text/html -dump < \#upload-3#.html');
+
+ print "\n" or die $!;