sub as_HTML {
# Bla bla bla
# Your typical subroutine initial stuff we don't care much about...
if ( ... ) {
# Some condition I don't really understand since I didn't bother to
# understand the initial stuff above. But it didn't seem to relevant.
# A whole lot of stuff happens here, seemingly all dealing with tags,
# not with text.
else { # it's a text segment
# Hey! Cool.
# One more line of bla bla bla, before...:
HTML::Entities::encode_entities( $node, $entities )
# Yeah, this sounds about right. Let's look at that.
# More stuff I didn't bother to look at...
}
####
# HTML::Entities
# First there's a whole lot of POD here, but since I already saw the HTML
# version of that (which wasn't very helpful) I don't really care.
# Hey, cool. The actual module begins here.
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
use vars qw(%entity2char %char2entity);
# Bla bla bla. Oh, wait, that last line looks promising.
# Some more stuff for Exporter happens next. I don't care.
%entity2char = (
# What follows is a long, long, long mapping of character names
# to actual characters.
# This list goes on and on and on... Never knew there were so many!
);
# Then, suddenly:
# Make the opposite mapping
while (my($entity, $char) = each(%entity2char)) {
$entity =~ s/;\z//;
$char2entity{$char} = "&$entity;";
}
delete $char2entity{"'"}; # only one-way decoding
####
%HTML::Entity::char2entity = (); # Bye bye.
open my $fh, ">", "out.html" or die $!;
print $fh ""
. join("\n", map { $_->as_HTML } ($tit, $sub, $aut, $art) )
. "";