Skip to content

Commit ebb9db0

Browse files
committed
Tidy - maybe
1 parent d2f0e63 commit ebb9db0

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

lib/MetaCPAN/Web/Controller/Feed.pm

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ sub recent : Private {
3535
$c->forward('/recent/index');
3636
die join "\n", @{ $c->error } if @{ $c->error };
3737

38-
my $changes
39-
= $c->model('API::Changes')
40-
->by_releases(
38+
my $changes =
39+
$c->model('API::Changes')
40+
->by_releases(
4141
[ map "$_->{author}/$_->{name}", @{ $c->stash->{recent} } ] )
42-
->get;
42+
->get;
4343

4444
for ( @{ $c->stash->{recent} } ) {
4545

@@ -58,7 +58,6 @@ sub recent : Private {
5858
);
5959
}
6060

61-
6261
sub author_rss : Chained('/author/root') PathPart('activity.rss') Args(0) {
6362
$_[1]->detach( 'author', ['rss'] );
6463
}
@@ -97,7 +96,7 @@ sub author : Private {
9796
title => "Recent CPAN activity of $author - MetaCPAN",
9897
entries => [
9998
sort { $b->{date} cmp $a->{date} }
100-
@{ $self->_format_release_entries( $releases->{releases} ) },
99+
@{ $self->_format_release_entries( $releases->{releases} ) },
101100
@{ $self->_format_favorite_entries( $author, $faves ) }
102101
],
103102
);
@@ -148,7 +147,7 @@ my $feed_check = validation_for(
148147
},
149148
format => {
150149
type => Enum( [qw(atom rdf rss)] )
151-
->plus_coercions( Undef, '"rdf"', Str, 'lc $_' ),
150+
->plus_coercions( Undef, '"rdf"', Str, 'lc $_' ),
152151
default => 'rdf'
153152
},
154153
},
@@ -161,7 +160,7 @@ sub build_entry {
161160

162161
my $link = $args{host}->clone;
163162
$link->path( $entry->{link}
164-
|| join( '/', 'release', $entry->{author}, $entry->{name} ) );
163+
|| join( '/', 'release', $entry->{author}, $entry->{name} ) );
165164
$link->fragment( $entry->{fragment} ) if $entry->{fragment}; # for news
166165
$e->link( $link->as_string );
167166

@@ -194,26 +193,28 @@ sub build_feed {
194193
my $self = shift;
195194
my %params = $feed_check->(@_);
196195

197-
my $feed_class
198-
= $params{format} eq 'rdf' ? XML::FeedPP::RDF::
199-
: $params{format} eq 'rss' ? XML::FeedPP::RSS::
200-
: $params{format} eq 'atom' ? XML::FeedPP::Atom::Atom10::
201-
: die 'invalid format';
196+
my $feed_class =
197+
$params{format} eq 'rdf' ? XML::FeedPP::RDF::
198+
: $params{format} eq 'rss' ? XML::FeedPP::RSS::
199+
: $params{format} eq 'atom' ? XML::FeedPP::Atom::Atom10::
200+
: die 'invalid format';
202201

203202
my $feed = $feed_class->new;
204203
$feed->title( $params{title} );
205204
$feed->link("$params{link}");
206205
$feed->pubDate( $params{date}->iso8601 )
207-
if $params{date};
206+
if $params{date};
208207
$feed->description( $params{description} )
209-
if $params{description};
208+
if $params{description};
210209

211210
foreach my $entry ( @{ $params{entries} } ) {
212-
$feed->add_item( $self->build_entry(
213-
class => $feed->item_class,
214-
entry => $entry,
215-
host => $params{host},
216-
) );
211+
$feed->add_item(
212+
$self->build_entry(
213+
class => $feed->item_class,
214+
entry => $entry,
215+
host => $params{host},
216+
)
217+
);
217218
}
218219
return $feed;
219220
}
@@ -222,8 +223,7 @@ sub _format_release_entries {
222223
my ( $self, $releases ) = @_;
223224
my @release_data;
224225
foreach my $item ( @{$releases} ) {
225-
$item->{link}
226-
= join( '/', 'release', $item->{author}, $item->{name} );
226+
$item->{link} = join( '/', 'release', $item->{author}, $item->{name} );
227227
$item->{name} = "$item->{author} has released $item->{name}";
228228
push( @release_data, $item );
229229
}
@@ -234,8 +234,8 @@ sub _format_favorite_entries {
234234
my ( $self, $author, $data ) = @_;
235235
my @fav_data;
236236
foreach my $fav ( @{$data} ) {
237-
$fav->{abstract}
238-
= "$author ++ed $fav->{distribution} from $fav->{author}";
237+
$fav->{abstract} =
238+
"$author ++ed $fav->{distribution} from $fav->{author}";
239239
$fav->{author} = $author;
240240
$fav->{link} = join( '/', 'release', $fav->{distribution} );
241241
$fav->{name} = "$author ++ed $fav->{distribution}";
@@ -248,18 +248,16 @@ sub end : Private {
248248
my ( $self, $c ) = @_;
249249
my $feed = $c->stash->{feed};
250250
$c->detach('/end')
251-
if !$feed;
251+
if !$feed;
252252

253-
254-
# This will only affect if `cdn_max_age` has been set.
255-
# https://www.fastly.com/documentation/guides/concepts/edge-state/cache/stale/
256-
# If it has then do revalidation in the background
253+
# This will only affect if `cdn_max_age` has been set.
254+
# https://www.fastly.com/documentation/guides/concepts/edge-state/cache/stale/
255+
# If it has then do revalidation in the background
257256
$c->cdn_stale_while_revalidate('1d');
258257

259258
# And if there is still an error serve from cache
260259
$c->cdn_stale_if_error('1y');
261260

262-
263261
$c->res->content_type(
264262
$feed->isa('XML::FeedPP::Atom')
265263
? 'application/atom+xml; charset=UTF-8'

0 commit comments

Comments
 (0)