note
dws
Have you considered making properties first-class Objects? This could lead to greatly simplified code. Consider
<code> package EmmisiveColor;
sub new {
my $pkg = shift;
return bless [ @_ ], $pkg;
}
sub as_string {
my $self = shift;
"emmisiveColor @$self"
}
</code>
And so on for the other properties.
Properties become easier to enumerate. You can do away with the switch entirely. Assuming you're doing so within the context of an object that holds properties,
your snippet reduces to something like:
<code> sub simple_properties {
my $self = shift;
my @propstrings = map { $_->as_string() } $self->properties();
return
"appearance Appearance {\n" .
" material Material {\n" .
" ", join("\n ", @propstrings), "\n" .
" }\n" .
"}\n";
}
</code>
79629
79629