Skip to content

Commit

Permalink
Update Policy.pm
Browse files Browse the repository at this point in the history
simplify string concatenation (and avoid cleanup at the end)
  • Loading branch information
msimerson authored Dec 10, 2024
1 parent d2a83e1 commit 620d161
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/Mail/DMARC/Policy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,15 @@ sub parse {
}

sub stringify {
my ( $self ) = @_;
my $self = shift;

my %dmarc_record = %{$self};
# "v" tag must be the first one
my $dmarc_txt = 'v=' . (delete $dmarc_record{v}) . '; ';
delete $dmarc_record{domain};

my $dmarc_txt = 'v=' . (delete $dmarc_record{v}); # "v" tag must be first
foreach my $key ( keys %dmarc_record ) {
next if $key eq 'domain';
$dmarc_txt .= "$key=$dmarc_record{$key}; ";
$dmarc_txt .= "; $key=$dmarc_record{$key}";
}
$dmarc_txt =~ s/;\s$//;
return $dmarc_txt;
}

Expand Down

0 comments on commit 620d161

Please sign in to comment.