summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/hush/update-weather14
1 files changed, 12 insertions, 2 deletions
diff --git a/bin/hush/update-weather b/bin/hush/update-weather
index e3a6bc3..189929e 100755
--- a/bin/hush/update-weather
+++ b/bin/hush/update-weather
@@ -1,9 +1,19 @@
#!/usr/bin/env perl
use strict;
use warnings;
+use 5.020;
+use feature 'signatures';
+no warnings 'experimental::signatures';
-use Path::Class;
+use open ':encoding(UTF-8)', ':std';
if (my $weather = `weather`) {
- file("$ENV{HOME}/.cache/weather")->openw->print($weather);
+ spew("$ENV{HOME}/.cache/weather", $weather);
+}
+
+sub spew($filename, $contents) {
+ open my $fh, '>', $filename
+ or die "couldn't open $filename: $!";
+ print $fh $contents;
+ close $fh;
}