Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

unite the earlier_events and the events files and display them accord…

…ing to the timestamp
  • Loading branch information...
commit 8a3b2d581b8462cf7185a75183c625229e9fee70 1 parent f65cc3b
@szabgab authored
View
1  Makefile.PL
@@ -17,6 +17,7 @@ WriteMakefile(
'Dancer' => 1.2003,
'Template' => 0,
'XML::RSS' => 0,
+ 'DateTime' => 0,
'Encode' => 0,
'Test::NoWarnings' => 0,
},
View
51 data/earlier_events.yml
@@ -1,51 +0,0 @@
----
- - date: 2010.02.6-7
- title: FOSDEM
- address: Brussels, Belgium
- - date: 2010.03.2-6
- title: CeBIT
- address: Hannover, Germany
- - date: 2010.06.7-9
- title: German Perl Workshop
- address: Schorndorf (near Stuttgart), Germany
- - date: 2010.06.9-12
- title: LinuxTag
- address: Berlin, Germany
- - date: 2010.06.21-23
- title: YAPC::NA
- address: Columbus, Ohio, USA
- - date: 2010.06.26
- title: Belgian Perl Workshop
- address: Brussels, Belgium
- - date: 2010.08.4-6
- title: YAPC::EU
- address: Pisa, Italy
- - date: 2010.08.21-22
- title: FrOSCon
- address: St Augustin, Germany
- - date: 2010.09.17-18
- title: FrOSCamp
- address: Zurich, Switzerland
- - date: 2010.10.20
- title: The establishment of the Perl Ecosystem Group
- address:
- - date: 2010.11.6-7
- title: T-Does
- address: Eindhoven, The Netherlands
- - date: 2011.01.18-19
- title: Plat_forms contest
- address: Nurnberg, Germany
- details: plat_forms_2011
- - date: 2011.02.5-6
- title: FOSDEM
- address: Brussels, Belgium
- details: fosdem_2011
- - date: 2011.02.12
- title: Linux Informationstag
- address: Oldenburg, Germany
- - date: 2011.02.25-27
- title: SCALE - Annual Southern California Linux Expo
- address: Los Angeles, USA, California
- - date: 2011.03.1-5
- title: CeBIT 2011
- address: Hannover, Germany
View
85 data/events.yml
@@ -1,19 +1,92 @@
---
- - date: 2011.03.19-20
+ - date: 2010.02.06
+ days: 2
+ title: FOSDEM
+ address: Brussels, Belgium
+ - date: 2010.03.02
+ days: 5
+ title: CeBIT
+ address: Hannover, Germany
+ - date: 2010.06.07
+ days: 3
+ title: German Perl Workshop
+ address: Schorndorf (near Stuttgart), Germany
+ - date: 2010.06.9
+ days: 4
+ title: LinuxTag
+ address: Berlin, Germany
+ - date: 2010.06.21
+ days: 3
+ title: YAPC::NA
+ address: Columbus, Ohio, USA
+ - date: 2010.06.26
+ days: 1
+ title: Belgian Perl Workshop
+ address: Brussels, Belgium
+ - date: 2010.08.4
+ days: 3
+ title: YAPC::EU
+ address: Pisa, Italy
+ - date: 2010.08.21
+ days: 2
+ title: FrOSCon
+ address: St Augustin, Germany
+ - date: 2010.09.17
+ days: 2
+ title: FrOSCamp
+ address: Zurich, Switzerland
+ - date: 2010.10.20
+ days: 1
+ title: The establishment of the Perl Ecosystem Group
+ address:
+ - date: 2010.11.6
+ days: 2
+ title: T-Does
+ address: Eindhoven, The Netherlands
+ - date: 2011.01.18
+ days: 2
+ title: Plat_forms contest
+ address: Nurnberg, Germany
+ details: plat_forms_2011
+ - date: 2011.02.5
+ days: 2
+ title: FOSDEM
+ address: Brussels, Belgium
+ details: fosdem_2011
+ - date: 2011.02.12
+ days: 1
+ title: Linux Informationstag
+ address: Oldenburg, Germany
+ - date: 2011.02.25
+ days: 3
+ title: SCALE - Annual Southern California Linux Expo
+ address: Los Angeles, USA, California
+ - date: 2011.03.01
+ days: 5
+ title: CeBIT 2011
+ address: Hannover, Germany
+ - date: 2011.03.19
+ days: 2
title: Chemnitzer Linux-Tage
address: Chemnitz, Germany
- - date: 2011.03.22-24
+ - date: 2011.03.22
+ days: 3
title: UKUUG
address: Leeds, UK
- - date: 2011.03.23-25
+ - date: 2011.03.23
+ days: 3
title: POSCON
address: Columbia, South Carolina, USA
- - date: 2011.04.9
+ - date: 2011.04.09
+ days: 1
title: Grazer LinuxTag
address: Graz, Austria
- - date: 2011.04.30-05.1
+ - date: 2011.04.30
+ days: 2
title: Linuxfest Northwest
address: Bellingham, Washington, USA
- - date: 2011.05.11-14
+ - date: 2011.05.11
+ days: 4
title: LinuxTag
address: Berlin, Germany
+
View
11 lib/PEG.pm
@@ -2,6 +2,7 @@ package PEG;
use Dancer ':syntax';
use Encode qw(decode);
use XML::RSS;
+use DateTime;
our $VERSION = '0.1';
@@ -10,12 +11,16 @@ my %content = (
src => {
news => 'news.yml',
events => 'events.yml',
- earlier_events => 'earlier_events.yml',
+ earlier_events => 'events.yml',
},
);
sub _read_file {
my $name = shift;
+
+ my $now = DateTime->now->ymd; # YYYY-MM-DD
+ $now =~ s/-/./g;
+
my $file = path config->{appdir}, 'data', $content{src}{$name};
my $current_stamp = (stat($file))[9];
@@ -25,9 +30,9 @@ sub _read_file {
if ($name eq 'news') {
$content{data}{$name}{$sub} = $data;
} elsif ($name eq 'events') {
- $content{data}{$name}{$sub} = $data;
+ $content{data}{$name}{$sub} = [ grep {$_->{date} ge $now} @$data ];
} elsif ($name eq 'earlier_events') {
- $content{data}{$name}{$sub} = [ reverse @$data ];
+ $content{data}{$name}{$sub} = [ reverse grep {$_->{date} lt $now } @$data ];
}
$content{stamp}{$name} = $current_stamp;
}
Please sign in to comment.
Something went wrong with that request. Please try again.