summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-11-03 14:50:39 -0400
committerJesse Luehrs <doy@tozt.net>2018-11-03 14:50:39 -0400
commitc7bff573215a461a2ac9d6d03dc86ef0fc9d2101 (patch)
treea55e3e656ecfe9a031e96bfc402cb51c4e43482f
parent4c85267c6c499734b7398eaa2bef61d3459dbe2f (diff)
downloadconf-c7bff573215a461a2ac9d6d03dc86ef0fc9d2101.tar.gz
conf-c7bff573215a461a2ac9d6d03dc86ef0fc9d2101.zip
make update-weather not depend on non-core modules
-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;
}