Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactoring clean_entries method.

  • Loading branch information...
commit 38a83da2b8a3b41bb47441468b05808da2006fd0 1 parent 62f245f
@davorg authored
Showing with 17 additions and 5 deletions.
  1. +17 −5 lib/Perlanet.pm
View
22 lib/Perlanet.pm
@@ -319,11 +319,23 @@ cleaned entries.
sub clean_entries {
my ($self, @entries) = @_;
- return map {
- $_->content->body($self->clean_html($_->content->body));
- $_->summary($self->clean_html($_->summary));
- $_;
- } @entries;
+ my @clean_entries;
+
+ foreach (@entries) {
+ if (my $body = $_->content->body) {
+ my $cleaned = $self->clean_html($body);
+ $_->content->body($cleaned);
+ }
+
+ if (my $summary = $_->summary->body) {
+ my $cleaned = $self->clean_html($summary);
+ $_->summary->body($cleaned);
+ }
+
+ push @clean_entries, $_;
+ }
+
+ return @clean_entries;
}
=head2 render
Please sign in to comment.
Something went wrong with that request. Please try again.