#!/usr/local/bin/perl -w
###########################################
# http-get-nested
# Mike Schilli, 2014 (m@perlmeister.com)
###########################################
use strict;
use AnyEvent::HTTP;
use CountServer;

my $cs = CountServer->new();
$cs->start();

my $start_url = $cs->url() . "/test-1.txt";

http_get $start_url, sub { 
  my ($body, $hdr) = @_;

  print "Got: $body\n";
  http_get $body, sub { 
      my ($body, $hdr) = @_;

      print "Got: $body\n";
      http_get $body, sub { 
        my ($body, $hdr) = @_;

        print "Got: $body\n";
      }
  }
};

my $cv = AnyEvent->condvar();
$cv->recv();
