package SynopsisTable; sub new{ return bless {names=>'', info=>{}, file=>''}; } sub declare{ my($self,$name,$key,$type) = @_; if ($self->{names}) { $self->{names} .= ",$name"; } else { $self->{names} .= "$name"; } $self->{info}{$name} = "$key,$type,"; } # The 'file' attribute is used to store the filename of the node in which # the table will be presented; this assumes that each table will be presented # only once, which works for the current use of this object. sub set_file{ my($self, $filename) = @_; $self->{file} = "$filename"; } sub get_file{ my $self = shift; return $self->{file}; } sub set_synopsis{ my($self,$name,$synopsis) = @_; my($key,$type,$unused) = split ',', $self->{info}{$name}, 3; $self->{info}{$name} = "$key,$type,$synopsis"; } sub get{ my($self,$name) = @_; return split /,/, $self->{info}{$name}, 3; } sub show{ my $self = shift; my $name; print "names: ", $self->{names}, "\n\n"; foreach $name (split /,/, $self->{names}) { my($key,$type,$synopsis) = $self->get($name); print "$name($key) is $type: $synopsis\n"; } } sub tohtml{ my $self = shift; my $data = "
$link$name | \n" . "$synopsis |