path detection?
authorHeiko Schlittermann (MULI) <hs@schlittermann.de>
Fri, 13 May 2011 10:21:00 +0200
changeset 14 5a22524e7261
parent 13 0996f1a07114
child 15 38a3e4aa59c0
path detection?
upload.pl
--- a/upload.pl	Wed May 11 12:24:35 2011 +0200
+++ b/upload.pl	Fri May 13 10:21:00 2011 +0200
@@ -26,13 +26,12 @@
 use CGI qw(:all *table);
 use CGI::Carp qw(fatalsToBrowser);
 use CGI::Pretty;
-use IO::File;
 use File::Basename;
 use Digest::MD5 qw(md5_hex);
 use OSSP::uuid;
 
 my $DIR     = "d/{view}";
-my $DIR_URI = "/$DIR";
+my $DIR_URI = url(-absolute => 1) . "/$DIR";
 
 sub human($);
 
@@ -68,7 +67,8 @@
 
     print header(-charset => "UTF-8"),
       start_html(-title => "Up&Down"),
-      h1 "Ansicht: $ENV{REMOTE_USER}";
+      h1("Ansicht: $ENV{REMOTE_USER}"),
+	  "dir: ", url(-absolute => 1);
 
     # print Dump;
 
@@ -89,16 +89,16 @@
 
         my $dir = "$DIR/$uuid-$expires";
         mkdir $dir, 0750 or die "Can't mkdir $dir: $!\n";
-        my $outfh = new IO::File ">$dir/$filename"
+        open(my $outfh, ">", "$dir/$filename")
           or die "Can't create $dir/$filename: $!\n";
         print {$outfh} <$file>;
 
-        if (my $atfh = new IO::File("|at now + $days days")) {
+        if (open(my $atfh, "|-", "at now + $days days")) {
             print {$atfh}
               "rm -f \"$dir/$filename\"\n",
               "rmdir \"$dir\"\n";
             close $atfh;
-            system("cat /tmp/log");
+			#system("cat /tmp/log");
         }
 
     }