say "Downloading $url to $dest";
my $data = Y::AoC::UA::request($url, { body => 1 });
-Mojo::File->new($dest)->spurt($data);
+Mojo::File->new($dest)->spew($data);
say grey('==================================================');
print $data;
say grey('==================================================');
my $tst = Y::AoC::UA::request($url, { cache_to => "task-$year-$day.html" })
->find('main > article > pre > code')->first->all_text;
-Mojo::File->new($dest)->spurt($tst);
+Mojo::File->new($dest)->spew($tst);
say "\n", grey("also downloaded $dest"), "\n";
use Mojo::Base -signatures;
use Mojo::UserAgent;
use Mojo::DOM;
-use Y::AoC qw(white);
+use Y::AoC qw(white red);
our $user_agent = 'kas@yenya.net https://www.fi.muni.cz/~kas/git/aoc.git';
our $cache_dir = '/home/kas/aoc/cache';
}
if ($cache) {
- $cache->spurt($res->body);
+ $cache->spew($res->body);
# say "Stored response to $cachefile";
}
return $args->{body} ? $res->body : $res->dom;