# package ArrayRef2HTMLTree; use strict; use warnings; our $HTML; sub new{ my $class=shift; my %args=@_; $args{line_height}='10px' if(! exists $args{line_height}); $args{font_size}='8pt' if(! exists $args{font_size}); return bless \%args ,$class; } sub to_html{ my $self=shift; my $t=shift; my $tree=join('', '', "\n"); my $html=$HTML; $html =~ s/#TREE#/$tree/s; $html =~ s/#LINE-HEIGHT#/$self->{line_height}/s; $html =~ s/#FONT-SIZE#/$self->{font_size}/s; return $html; } sub traverse { my ($t,$depth)=@_; my $tab="\t"x$depth; if (ref($t) eq 'ARRAY'){ return $tab , "
  • ($depth)
  • " , "\n"; } else { return "$tab
  • $t
  • \n"; } } $HTML=<<'HTML'; #TREE# HTML 1;