[% PERL %] # Get the incoming values. my @types = @{$stash->get('types')}; my @colors = @{$stash->get('colors')}; my %hex = %{$stash->get('defaults')}; # Overlay the default values with the rgb2hex data, if available. %hex = %{$stash->get('hex')} if $stash->get('hex'); my @headings = ('Attribute', @colors, "Hex"); my ($attributes, %values); # Set up the body attributes. foreach my $type (@types) { $attributes .= qq!$type="#$hex{$type}"!; # Create the RGB chooser table elements my @rgb = map{hex} unpack "a2a2a2", $hex{$type}; foreach my $index (0 .. 2) { $values{$type . $colors[$index]} = $rgb[$index]; } } # Make the variables available to the other template tags $stash->set(attributes => $attributes); $stash->set(values => \%values); $stash->set(headings => \@headings); [% END %]