perl VS phpの決着を付ける時がやってきました。
http://myminicity.com というサイトがあって、http://tomyhero.myminicity.com という登録をした場合、そのサイトにアクセスが多いほど街が育つって仕組みなんだよ。
で、perl-jaとphp-jaという街をつくってお互い育てるあうことにより戦うんだよ!以下のサイト(MyMinicity Fight)で状態を見ることができるよ!Livedoor Clipを使ってる人がいたら、愛してる言語の方にクリップすると良いよ。そんなカンジだよ!
MyMinicty Fight - http://lazy-programmer.com/myminicity_fight.cgi?city=perl-jp&city=php-jp
追記
ちなみに、MyMinicity Fightは、他の街通しでも戦わせることができるよ。例えば以下
http://lazy-programmer.com/myminicity_fight.cgi?city=404-cityfound&city=nipotan
have fun!
#!/usr/bin/perl use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); use XML::Simple; use LWP::UserAgent; use Data::Dumper; use Template; use CGI; my @DATA = qw/perl-jp php-jp/; my $url = "http://%s.myminicity.com/xml"; my $ua = LWP::UserAgent->new() ; my $cities = (); my $cgi = new CGI; my @queries = $cgi->param('city'); if( scalar @queries == 2 ) { @DATA = @queries; } for my $item ( @DATA ) { my $res = $ua->get( sprintf( $url , $item ) ); die "LWP error for :" . $item unless $res->is_success ; my $ref = XMLin( $res->content ); # '#'がつく名前があるので、それはやめとく。 $ref->{name} = $item; push @{ $cities } , $ref ; } my $tt = Template->new(); $tt->process(\*DATA ,{ cities => $cities , ENV => \%ENV } ) || die $tt->error() ; __END__ Content-Type :text/html <html> <head> <title> [% cities.0.name %] VS [% cities.1.name %] ~ MyMinicity Fight ~ </title> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.4.1/build/reset-fonts-grids/reset-fonts-grids.css"> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.4.1/build/base/base-min.css"> <script type="text/javascript" src="http://clip.livedoor.com/js/utils.js"></script> <style> html , body { background:#E9EFCF; } h1 { text-align: center; font-size : 200%; margin : 0px; padding : 0px; } h2 { color : black; font-weight: normal; } h3 { background-color: skyblue; } pre { margin : 5px; background-color:#cccccc; padding : 5px; } div#sub-title { background-color:lightblue; } div#hd { background-color:#1f1f1f; color :#ffffff; } div#bd { background-color:#ffffff; } .big { font-size : 300%; } .super-big { font-size : 400%; color : red; } </style> </head> <body> <div id="doc2"> <div id="hd"> <h1> [% cities.0.name %] VS [% cities.1.name %] </h1> <div id="sub-title"> <h2><a target="_blank" href="http://myminicity.com">myminicity</a>を使って最後の決着2本勝負を提案する、今世紀最大の決戦を見守るサイト ~ MyMinicity Fight ~ </h2> </div> </div> <div id="bd"> [% cities.0.win = 0 %] [% cities.1.win = 0 %] <div id="result" class="yui-b"> <div class="yui-gd"> <div class="yui-u first"> <h3>知名度勝負!(人口)</h3> [% IF cities.0.population > cities.1.population %] [% cities.0.win = cities.0.win + 1 %] <span class="big"> 一本! [% cities.0.name %]</span> [% ELSIF cities.0.population < cities.1.population %] [% cities.1.win = cities.1.win + 1 %] <span class="big"> 一本! [% cities.1.name %] </span> [% ELSE %] <span class="big">引き分け!</span> [% END %] </div> <div class="yui-u"> [% ratio0 = cities.0.population / ( cities.0.population + cities.1.population ) * 100 %] <img src="http://chart.apis.google.com/chart?cht=p3&chd=t:[% ratio0 %],[% 100 - ratio0 %]&chs=400x200&chl=[% cities.0.name %]|[% cities.1.name %]"> </div> </div> <div class="yui-gd"> <div class="yui-u first"> <h3>お値打ち勝負!(収入)</h3> [% IF cities.0.incomes > cities.1.incomes %] [% cities.0.win = cities.0.win + 1 %] <span class="big"> 一本! [% cities.0.name %]</span> [% ELSIF cities.0.incomes < cities.1.incomes %] [% cities.1.win = cities.1.win + 1 %] <span class="big"> 一本! [% cities.1.name %] </span> [% ELSE %] <span class="big">引き分け!</span> [% END %] </div> <div class="yui-u"> [% ratio0 = cities.0.incomes / ( cities.0.incomes + cities.1.incomes ) * 100 %] <img src="http://chart.apis.google.com/chart?cht=p3&chd=t:[% ratio0 %],[% 100 - ratio0 %]&chs=400x200&chl=[% cities.0.name %]|[% cities.1.name %]"> </div> </div> <div class="yui-b"> <h3>勝負結果!</h3> <span class="super-big"> [% IF cities.0.win > cities.1.win %] [% cities.0.name %]の勝ち! [% ELSIF cities.0.win < cities.1.win %] [% cities.1.name %]の勝ち! [% ELSE %] 両者引き分け! [% END %] </span> </div> </div> <div class="yui-g"> [% server_name = 'http://' _ ENV.SERVER_NAME _ ENV.SCRIPT_NAME %] [% first = 1 %] [% FOREACH city = cities %] <div id="[% city.name %]" class="yui-u [% IF first %]first[% END ; first = 0 %]"> <h3><a target="_blank" href="http://[% city.name %].myminicity.com">[% city.name %]</a> [% clip_url = server_name _ '?city=' _ cities.0.name _ '&city=' _ cities.1.name _ '#' _ city.name %] <script type="text/javascript"> Livedoor.Clip.location = "[% clip_url %]"; Livedoor.Clip.linktarget = 1; Livedoor.Clip.image_counter("small"); </script> </h3> <span style="font-size:small;color:red">* 上記のcity名をクリックで街へ飛ぶよ</span> <br /> <br /> <a href="http://clip.livedoor.com/clip/add?link=[% clip_url | uri%]">応援表明クリップ!</a> <ul>詳細 <li>Ranking : [% city.ranking %]</li> <li>nextnuke : [% city.nextnuke %]</li> <li>population : [% city.population %]</li> <li>transport : [% city.transport %]</li> <li>unemployment : [% city.unemployment %]</li> <li>region : [% city.region.content %]</li> <li>incomes : [% city.incomes %]</li> <li>signatures : [% city.signatures %]</li> <li>criminality : [% city.criminality %]</li> <li>pollution" : [% city.pollution %]</li> <li>ind : [% city.bases.ind %]</li> <li>sec : [% city.bases.sec %]</li> <li>env : [% city.bases.env %]</li> <li>com : [% city.bases.com %]</li> <li>tra : [% city.bases.tra %]</li> </ul> </div> [% END %] </div> <div class="yui-b"> <h3>使用方法</h3> 戦かわせたい相手のcity名を引数に指定して、URLを実行するだけでOKだよ。例 <pre>http://lazy-programmer.com/myminicity_fight.cgi?city={町名1}&city={町名2}</pre> <h3>簡易フォーム</h3> <form method="get"> city1:<input type="text" name="city"> city2:<input type="text" name="city"><input type="submit" value="勝負!"> </form> </div> <div class="yui-b"> <h3>デザイン募集</h3> HTMLデザインを送っていただけると全裸で差し替えるよ! > <a href="mailto:tomohiro.teranishi@gmail.com?subject=ミニシティデザイン">tomohiro.teranishi@gmail.com</a> </div> </div> <div id="ft"> </div> </div> </body> </html>