<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,37 +1,7 @@
 #!/usr/local/bin/perl6
-use HTTP::Daemon;
 use Web::Nibbler;
+use Web::Handler::HTTPDaemon;
 
-# Serve one page
-sub request($c) {
-    my $r = $c.get_request;
-    if $r.req_method eq 'GET' {
-        # log request info to the standard error stream
-        warn &quot;{hhmm} GET {$r.url.path} {$r.header('User-Agent')}&quot;;
-        my $qs = $r.url.path ~~ / '?' (.*) $/
-                    ?? $0
-                    !! '';
-        $c.send_response(
-            ~([~] Web::Nibbler.call({&quot;QUERY_STRING&quot; =&gt; $qs}).[2])
-        );
-    }
-    else {
-        warn &quot;{hhmm} rejected {$r.req_method} {$r.url.path}&quot;;
-        $c.send_error('RC_FORBIDDEN');
-    }
-    warn ' '; # blank line
-}
-
-# give the current time in hh:mm format
-sub hhmm {
-    my $t = int(time);
-    my $m = int( $t / 60 ) % 60;
-    my $h = int( $t / 3600 ) % 24;
-    my $hhmm = &quot;{$h.fmt('%02d')}:{$m.fmt('%02d')}&quot;;
-    return $hhmm;
-}
-
-my HTTP::Daemon $d .= new( host=&gt; '127.0.0.1', port=&gt; 8888 );
-say &quot;Browse this Perl 6 (Rakudo) web server at {$d.url}&quot;;
-$d.daemon();
-
+my $port = 8888;
+say &quot;Try out the Nibbler on http://127.0.0.1:$port/&quot;;
+Web::Handler::HTTPDaemon.run( Web::Nibbler.new );</diff>
      <filename>bin/run-nibbler</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@ use v6;
 use Web::Request;
 use Web::Response;
 
-class Web::Nibbler {
+class Web::Nibbler does Callable {
     # Somewhat less cool than the Ruby solution, we have to include the
     # lobster verbatim, for lack of a zlib module (hint, hint).
     my $nibbler-string = q[
@@ -39,9 +39,7 @@ Z         =MM,,:MMMMMI,:MMM     . .D.
      . .Z+,::.+::,,,,,,,,,,:M M
         . ..I~::,:,,,,,,,,8..];
 
-    # RAKUDO: Should really be 'method postcircumfix:&lt;( )&gt;($env)' once this
-    #         is supported.
-    method call($env) {
+    method postcircumfix:&lt;( )&gt;($env) {
         my Web::Request $req .= new($env);
         my Str ($nibbler, $href);
         given $req.GET&lt;flip&gt; // '' {</diff>
      <filename>lib/Web/Nibbler.pm</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>98be7b2de6eb4e187aa6908ed4e87588c4f247c2</id>
    </parent>
  </parents>
  <author>
    <name>Carl Masak</name>
    <email>cmasak@gmail.com</email>
  </author>
  <url>http://github.com/masak/web/commit/cabb8710d5252902c9a1e1fbb10808f1f995c197</url>
  <id>cabb8710d5252902c9a1e1fbb10808f1f995c197</id>
  <committed-date>2009-08-16T09:41:28-07:00</committed-date>
  <authored-date>2009-08-16T09:41:28-07:00</authored-date>
  <message>[Web::Nibbler] adapted to use Web::Handler::HTTPDaemon</message>
  <tree>221eb4c2f522518e5690e075a588f7a271685de2</tree>
  <committer>
    <name>Carl Masak</name>
    <email>cmasak@gmail.com</email>
  </committer>
</commit>
