paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit ef822c8a1f62983930676ca8cbff5e74721278c8
parent 65ccc4813af7ee273595789d13374a03eb0b6d54
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Sun, 31 May 2020 19:58:01 -0400

More gopherize progress

Diffstat:
Mgopherize | 20++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/gopherize b/gopherize @@ -29,30 +29,34 @@ our @Links; sub text { my ($self, $text) = @_; + print $text; } sub start { my ($self, $tag, $attr, $attrseq, $origtext) = @_; if ($tag eq 'a') { - print "URL: ", $attr->{ href }, "\n"; + push(@Links, $attr->{ href }); } } -sub end { - my ($self, $tag, $origtext) = @_; +sub print_links { + my (@Links) = @_; + } my $parser = new Gopherizer; my @files = @ARGV; +my $output_path="gopher/"; +mkdir($output_path) or die "Could not mkdir $output_path: $!"; foreach my $file (@files) { - print "Opening $file\n"; - open(my $fh, "<:encoding(UTF-8)", $file) - or do { - warn "Could not open $file: $!"; + print "Opening output $file...\n"; + open(our $fh, ">", "$file.gph") + or do { + warn "Could not open $file for writing: $!"; next; }; - print "Parsing $file\n"; + print "Parsing HTML $file...\n"; $parser->parse_file($file); close($fh); }