# HG changeset patch # User heiko # Date 1305275166 -7200 # Node ID 38a3e4aa59c009498ce141ee90e0d45e6f60533b # Parent 5a22524e72610db0a118974277646eb29ccd3170 Backed out changeset 5a22524e7261 - path detection does not work diff -r 5a22524e7261 -r 38a3e4aa59c0 upload.pl --- a/upload.pl Fri May 13 10:21:00 2011 +0200 +++ b/upload.pl Fri May 13 10:26:06 2011 +0200 @@ -26,12 +26,13 @@ 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 = url(-absolute => 1) . "/$DIR"; +my $DIR_URI = "/$DIR"; sub human($); @@ -67,8 +68,7 @@ print header(-charset => "UTF-8"), start_html(-title => "Up&Down"), - h1("Ansicht: $ENV{REMOTE_USER}"), - "dir: ", url(-absolute => 1); + h1 "Ansicht: $ENV{REMOTE_USER}"; # print Dump; @@ -89,16 +89,16 @@ my $dir = "$DIR/$uuid-$expires"; mkdir $dir, 0750 or die "Can't mkdir $dir: $!\n"; - open(my $outfh, ">", "$dir/$filename") + my $outfh = new IO::File ">$dir/$filename" or die "Can't create $dir/$filename: $!\n"; print {$outfh} <$file>; - if (open(my $atfh, "|-", "at now + $days days")) { + if (my $atfh = new IO::File("|at now + $days days")) { print {$atfh} "rm -f \"$dir/$filename\"\n", "rmdir \"$dir\"\n"; close $atfh; - #system("cat /tmp/log"); + system("cat /tmp/log"); } }