aocinit

Perl utility to initialize directories and files for the Advent of Code
git clone git://git.samirparikh.com/aocinit
Log | Files | Refs | README

commit 1b70b28c96ac23ec0f37e9c4b8ef0658b74e586d
parent 96d13f871076a65c6580ee6cf9f1e6aadb593a39
Author: Samir Parikh <noreply@samirparikh.com>
Date:   Tue, 20 Dec 2022 17:01:23 +0000

make minor updates

Diffstat:
Maocinit | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/aocinit b/aocinit @@ -19,10 +19,12 @@ my $HOME = File::HomeDir->my_home; my $DOMAIN = 'adventofcode.com'; # -# User-defined constants ##################################################### +# User-defined constants: +############################################################################## my $PATH_FROM_HOME = "programs"; -my $DIR_PREFIX = "zaoc_20"; -# store your browser cookie session ID in the environment variable `SESSIONID`: +my $DIR_PREFIX = "aoc_20"; +# store your browser cookie session ID in the environment variable +# `$SESSIONID`: # $ export SESSIONID="8374....907d" ############################################################################## # @@ -80,8 +82,8 @@ sub read_boilerplate { \@ARGV = "input" unless \@ARGV; chomp( my \$input = do { local \$/; <> } ); - ] ) =~ s/^ {8}//mg; - $boilerplate =~ s/\A\n//; + ] ) =~ s/^ {8}//mg; # remove leading 8 spaces + $boilerplate =~ s/\A\n//; # remove leading line break return $boilerplate; } @@ -107,9 +109,9 @@ sub download_input { ) ); + say "downloading input file..."; my $res = $ua->get( $url )->result; if ($res->is_success) { - say "downloading input file..."; my $filename = catfile( $day_subdir, 'input' ); open my $input_fh, '>', $filename; say $input_fh $res->body;