#!/usr/bin/perl -w
# demo_valuering - show tie class
use strict;
use ValueRing;
my $color;
# Creates a TIESCALAR object that is a ValueRing
print "Setting up tie with values: ";
my $ref = tie $color, "ValueRing", qw(red blue);
# Can reference the object as an array of values
foreach my $value (@$ref) { print "$value "; }
print "\n";
# Can invoke a FETCH to use the ValueRing object
# red blue red blue red blue
print "$color $color $color $color $color $color\n";
# Can invoke a STORE to add to the ValueRing
print "Setting color to green : ", $color = "green";
print "\n";
# Now FETCH again on the ValueRing object, verify it has changed
print "$color $color $color $color $color $color\n";
# green red blue green red blue
exit(0);