diff options
| author | Jari Matilainen | 2015-11-24 16:06:16 +0100 | 
|---|---|---|
| committer | Jari Matilainen | 2015-11-24 16:06:16 +0100 | 
| commit | 4775c0a652fab0608acc57788a060f390dacea60 (patch) | |
| tree | dde5002e5903f1fc49aff1dcec27049dc76554b7 /scripts/timezones.pl | |
| parent | 1d85c4160eb53dfe2293dbc09926679d9b9d4b19 (diff) | |
| download | scripts.irssi.org-4775c0a652fab0608acc57788a060f390dacea60.tar.bz2 | |
Initial commit
Diffstat (limited to 'scripts/timezones.pl')
| -rw-r--r-- | scripts/timezones.pl | 23 | 
1 files changed, 16 insertions, 7 deletions
| diff --git a/scripts/timezones.pl b/scripts/timezones.pl index 9b383d8..65e9ebe 100644 --- a/scripts/timezones.pl +++ b/scripts/timezones.pl @@ -8,18 +8,18 @@  # or add it to an existing one with  # /statusbar window add timezones (window is an exaple, see /statusbar and /help statusbar for comprehensive help) -use strict; -use vars qw($VERSION %IRSSI); -$VERSION = "0.1"; +$VERSION = "0.2";  %IRSSI = (      authors     => "Jari Matilainen", -    contact     => "irc: vague`\@freenode", +    contact     => 'vague!#irssi@freenode on irc',      name        => "timezones",      description => "timezones displayer",      license     => "Public Domain", -    url         => "http://vague.se" +    url         => "http://gplus.to/vague", +    changed     => "Tue 24 November 16:00:00 CET 2015",  ); +use strict;  use Irssi::TextUI;  use DateTime; @@ -36,8 +36,17 @@ sub timezones {    foreach(@timezones) {      if(length($result)) { $result .= $div; }      my ($nick, $timezone) = split /:/, $_; -    my $now = DateTime->now(time_zone => $timezone); -    $result .= $nick . ": " . $now->strftime("$datetime"); +    my $now; +    eval { +      $now = DateTime->now(time_zone => "$timezone") or die $!; +    }; + +    if($@) { +      $result .= $nick . ": INVALID"; +    } +    else { +      $result .= $nick . ": " . $now->strftime("$datetime"); +    }    }    $item->default_handler($get_size_only, undef, $result, 1); | 
