Ok, so following on from my previous posts...
Rather than explicitly adding a new field for every tag, I wondered if it would be possible to create the fields dynamically based on a list of fields in an array or hash?
So, I tried this:
my %known_tags = (
album => 1,
albumartist => 1,
artist => 1,
};
sub create_fields {
my $self = $_[0];
my $class = ref($self) || $self;
foreach my $field ( keys %::known_fields ) {
$class->create_field('@'.$field, ":Acc($field)");
}
}
sub init :Init {
my ( $self, $args ) = @_;
$self->create_fields;
...
}
However, this doesn't seem to work. Is this approach likely to work? What am I doing wrong?
Thanks,
R.