#!/usr/bin/perl -w
#-------------------------------------------------------
# sample_http1
#
# Here we demonstrate walker_http.pl. 
#
# As an example, we set up a simple data structure.
# Using the function walk_via_HTTP_daemon(), we can
# walk the object from a Web browser. 
#
# This script requires that you have the LWP and the HTTP
# bundles installed.  
#-------------------------------------------------------

use Data::Walker;
use Getopt::Std;
use Sys::Hostname;

require 'walker_http.pl';

use strict;

use vars qw( $opt_p $opt_t );
getopts('p:t:');

my $PORT      = (defined $opt_p ? $opt_p :    0 );
my $TIMEOUT   = (defined $opt_t ? $opt_t :  180 );
my $HOST      = hostname(); 



#---------------------------------------
# Simple data structure
#
my $s = {

	a => [ 10, 20, "thirty" ],
	b => { 
		"w" => "forty", 
		"x" => "fifty", 
		"y" => 60,
		"z" => \70,
	},
	c => sub { print "I'm a data structure!\n"; },
	d => 80,
};

$s->{e}      = \$s->{d};


#---------------------------------------
# Now we set up the Data::Walker object,
# and then launch the HTTP daemon. 
#
my $w = new Data::Walker;
$w->warning(0);    # Disable warnings
$w->walk( $s );

walk_via_HTTP_daemon( $w, $TIMEOUT, $PORT, $HOST );


