=head1 VERSION
-Version 1.001
+Version 1.002
=cut
-our $VERSION = '1.001';
+our $VERSION = '1.002';
=head1 SYNOPSIS
$self->mods('fieldname')
-If there are no modifiers, C<undef> will be returned. Else a listref
+If there are no modifiers, C<undef> will be returned. Else a hashref
will be returned.
=cut
sub mods {
my ($self, $field) = @_;
return undef unless $self->has($field);
+ return undef unless (%{ $self->{fields}{$field}{mods} });
return $self->{fields}{$field}{mods};
}
my ($self, $map) = @_;
# trim the mods and filters
- my $mods = []; my %mods = ();
+ my $mods = {};
my $filt = []; my %filt = ();
for my $m (@{$map->{mods}}) {
- die "Modifier collision '$m' at line $." if $mods{$m};
+ die "Modifier collision '$m' at line $." if $mods->{$m};
$m =~ s/^m://;
- push @{$mods}, $m; $mods{$m} = 1;
+ $mods->{$m} = 1;
}
for my $f (@{$map->{filt}}) {
die "Modifier collision '$f' at line $." if $filt{$f};
# test mod names if we have a set to check against
if (defined $self->{conf}{mods}) {
- for my $mod ( @{$map->{mods}} ) {
+ for my $mod ( keys %{$map->{mods}} ) {
die "Modifier '$mod' not allowed\n"
unless $self->{conf}{mods}{$mod};
}