Skip to content

Commit

Permalink
Code tidy: avoid Boolean grep.
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Apr 7, 2018
1 parent c01eb42 commit da0fca4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/AudioFile/Info/Ogg/Vorbis/Header.pm
Expand Up @@ -53,7 +53,8 @@ sub AUTOLOAD {
croak "Invalid attribute '$sub'" unless $data{$sub};

if ($_[1]) {
if (grep { $_ eq $data{$sub} } $_[0]->{obj}->comment_tags) {
my @matches = grep { $_ eq $data{$sub} } $_[0]->{obj}->comment_tags;
if (@matches) {
$_[0]->{obj}->edit_comment($data{$sub}, $_[1]);
} else {
$_[0]->{obj}->add_comments($data{$sub}, $_[1]);
Expand Down

0 comments on commit da0fca4

Please sign in to comment.