Display more crashs in the Atom feed than on the webpage
authorVincent Tondellier <tonton+hg@team1664.org>
Fri, 08 Aug 2014 23:05:03 +0200
changeset 41 f2292404519a
parent 40 373c7f784bc2
child 42 604ffca3aec1
Display more crashs in the Atom feed than on the webpage There is a better way to sniff content type, but it's only available in newer mojolicious versions
CrashTest.pl
--- a/CrashTest.pl	Fri Aug 08 23:02:44 2014 +0200
+++ b/CrashTest.pl	Fri Aug 08 23:05:03 2014 +0200
@@ -52,10 +52,16 @@
 get '/' => sub {
     my $self = shift;
     my $page = 1;
+    my $crashs_per_page = 25;
+
+    if($self->req->url =~ qr{.*\.atom$}) {
+        $crashs_per_page = 100;
+    }
+
     $self->validation->required('page')->like(qr/^[0-9]+$/);
     $page = scalar $self->validation->param("page") if $self->validation->is_valid('page');
 
-    my $result = $self->app->storage->index($page, 20);
+    my $result = $self->app->storage->index($page, $crashs_per_page);
 
     $self->stash(files => $result->{crashs});
     $self->stash(pager => $result->{pager});