$response = $ua->request($request, \&callback);
print "Storing file\n";
- open(FD, $filename);
+ mkdirs($filename);
+ open(FD, ">".$filename);
print FD $cont;
close(FD);
$response = $ua->request($request, \&callback);
print "Storing file for the annotation\n";
- open(FD, $filename);
+ mkdirs($filename);
+ open(FD, ">".$filename);
print FD $cont;
close(FD);
}
$response = $ua->request($request, \&callback);
print "Storing file for the file to annotate\n";
- open(FD, $filename_target);
+ mkdirs($filename_target);
+ open(FD, ">".$filename_target);
print FD $cont;
close(FD);
}
$response = $ua->request($request, \&callback);
print "Storing file for the types\n";
- open(FD, $filename);
+ mkdirs($filename);
+ open(FD, ">".$filename);
print FD $cont;
close(FD);
}
$response = $ua->request($request, \&callback);
print "Storing file for the file to type\n";
- open(FD, $filename_target);
+ mkdirs($filename_target);
+ open(FD, ">".$filename_target);
print FD $cont;
close(FD);
}
my ($data) = @_;
$cont .= $data;
}
+
+# Does not raise errors if could not create dirs/files
+
+# Too much powerful: creates even /home, /home/users/, ...
+sub mkdirs
+{
+ my ($pathname) = @_;
+ my @dirs = split /\//,$pathname;
+ my $tmp;
+ foreach $dir (@dirs) {
+ $tmp = ((defined($tmp)) ? $tmp = $tmp."\/".$dir : "");
+ print $tmp."\n";
+ mkdir($tmp,0777);
+ }
+ rmdir($tmp);
+}