aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2015-02-14 06:43:43 +0100
committerMarius Halden <marius.h@lden.org>2015-02-14 06:43:43 +0100
commite4cc3f0733b59e1cb730a083ab60230f1739fed9 (patch)
tree2f6da961b2653df5e6c92a08db2e3593a7b41af7
parent83bafd752c4617e9c719dd76ccece81ff3843d50 (diff)
downloadappdrift-stats-e4cc3f0733b59e1cb730a083ab60230f1739fed9.tar.gz
appdrift-stats-e4cc3f0733b59e1cb730a083ab60230f1739fed9.tar.bz2
appdrift-stats-e4cc3f0733b59e1cb730a083ab60230f1739fed9.tar.xz
Better error handling
-rwxr-xr-xstats.pl24
1 files changed, 13 insertions, 11 deletions
diff --git a/stats.pl b/stats.pl
index 7bd118e..ce7ebbd 100755
--- a/stats.pl
+++ b/stats.pl
@@ -78,17 +78,19 @@ for my $group (@group_names) {
my $content = get("http://".$group_info->{'server'}->{$group});
- for my $line (split /\n/, $content) {
- last if (defined($users) && defined($posts) && defined($comments));
- last if ($line =~ /Last activity/i);
- next if (length $line < 1);
-
- if ($line =~ /Users:[^0-9]*(\d+)/i) {
- $users = $1;
- } elsif ($line =~ /Posts:[^0-9]*(\d+)/i) {
- $posts = $1;
- } elsif ($line =~ /Comments:[^0-9]*(\d+)/i) {
- $comments = $1;
+ if (length $content > 1) {
+ for my $line (split /\n/, $content) {
+ last if (defined($users) && defined($posts) && defined($comments));
+ last if ($line =~ /Last activity/i);
+ next if (length $line < 1);
+
+ if ($line =~ /Users:[^0-9]*(\d+)/i) {
+ $users = $1;
+ } elsif ($line =~ /Posts:[^0-9]*(\d+)/i) {
+ $posts = $1;
+ } elsif ($line =~ /Comments:[^0-9]*(\d+)/i) {
+ $comments = $1;
+ }
}
}