use v5.36;
use Exporter ('import');
+use IO::Handle;
+
our @EXPORT = qw(t asay bsay);
use Y::AoC qw(red white grey yellow day year);
say STDERR $msg;
};
+STDOUT->autoflush(1);
+STDERR->autoflush(1);
+
our $in_test;
sub t($subtest = ()) {
$subtest //= '';
- $ARGV[0] =~ s/in\.txt/test$subtest.txt/;
+ $ARGV[0] =~ s/in\.txt/test$subtest.txt/ if defined $ARGV[0];
$in_test = 1;
}
}
1;
-__END__
-package Y::AoC::UA;
-
-sub new($class, $year, $day) {
- eval 'require
-}
-
-sub get($ua) {
-1;
$cachefile = $cache_dir . '/' . $args->{cache_to};
$cache = Mojo::File->new("$cachefile");
- if ($args->{max_age}) {
+ if (defined $args->{max_age}) {
$cache->remove
if $cache->stat
&& time - $cache->stat->mtime
if ($cache->stat) {
say "\n", white('cached'),
" response from $cachefile";
- return Mojo::DOM->new($cache->slurp);
+ return $args->{body}
+ ? $cache->slurp
+ : Mojo::DOM->new($cache->slurp);
}
}