#!/usr/local/bin/perl -w use POSIX; #use encoding "latin-1", STDOUT => "utf8"; my $DIR="/usr/local/www/data/munich.pm.org"; $now=time; my ($day,$mon,$yr,$wd)=(gmtime($now))[3..6]; $tr=POSIX::mktime(0, 0, 20, $day, $mon, $yr); # 20:00 Uhr $found=0; while (!$found){ $tr+=86400; my ($day,$mon,$yr,$wd)=(gmtime($tr))[3..6]; $found=1 if ($wd==3 && ($mon+1)%2 && $day>14 && $day<22); }; $diff=$tr-$now; $diff=int($diff / (60*60*24)); #print "$diff d\n"; $s="heute" if($diff == 0); $s="morgen" if($diff == 1); $s="übermorgen" if($diff == 2); $s="in $diff Tagen" if($diff >2); $s=add($diff%7,"in einer Woche") if($diff >= 7); $str="in ".(qw(null einer zwei drei vier fünf sechs sieben acht))[$diff/7]." Wochen"; $s=add($diff%7,$str) if($diff >= 14); $date= POSIX::strftime("%d.%m.%Y",localtime($tr)); my @lt=localtime($now+60*60*24);@lt[0,1,2]=(42,23,0); $edate= POSIX::strftime("%a, %d %b %Y %H:%M:%S %Z",@lt); sub add { my ($mod,$s)=@_; return $s if($mod==0); return "morgen $s" if($mod==1); return "übermorgen $s" if($mod==2); return "$s und $mod Tagen"; }; open(F,">:utf8",$DIR."/termin-rss.xml") || die "Couldn't write: $!"; print F < MPM Termine http://munich.pm.org/ Sehen, wann es soweit ist de 1440 haj\@oook.m.uunet.de $date ($s) http://munich.pm.org/activities.html Das nächste Munich Perl Mongers Treffen findet am $date statt EOM open(F,">:utf8",$DIR."/date-1.txt") || die "Couldn't write: $!"; print F "$date ($s)"; open(F,">:utf8",$DIR."/date-2.txt") || die "Couldn't write: $!"; print F "$date"; open(F,">:utf8",$DIR."/date-3.txt") || die "Couldn't write: $!"; print F "$s"; open(F,">",$DIR."/.htaccess") || die "Couldn't write: $!"; print F < AddDefaultCharset utf-8 Header add Expires: '$edate' EOM