package BusyBee;

use strict;
use warnings;

sub new {
  my($pkg,$q)=(@_);
  my $self={};
  return unless UNIVERSAL::isa($q,'CGI');
  $self->{delay}=$q->param('delay') || 0;
  $self->{query}=$q;
  bless $self,$pkg;
}

sub run {
  my ($self)=(@_);
  my $q = $self->{query};
  if ($self->{delay}) {
    my $then=time();
    1 while ((time()-$then) < $self->{delay});
  }
  print STDOUT
    $q->header(-type=>'text/html'),
      $q->start_form(),
	'Delay:',
	$q->textfield(-name=>'delay'),
	  $q->submit(),
	    $q->end_form(),
	      $q->end_html();
}

1;
