=pod
=head1 NAME
OperaHotlistToHTML - Converts the Opera browser's hotlist to a portable HTML format.
=head1 SYNOPSIS
=head1 DESCRIPTION
Accepts as a parameter the pathname/filename to the Opera hotlist.
Default is C<"C:/Program Files/Opera/Opera5.adr">.
=head1 OPTIONS
None at this time (2001.05.09)
=head1 AUTHOR and CURRENT VERSION
C is written and maintained
by Glenn Wood, .
F.
=head1 COPYRIGHT
Copyright (c) 2001 Glenn Wood
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=cut
use strict;
my $VERSION = '2.00';
my $hotlistName = $ARGV[0];
$hotlistName = 'C:/Program Files/Opera/Opera5.adr' unless $hotlistName;
open TMP, "<$hotlistName" or die $!;
my $titleLine = ; chomp $titleLine;
print STDERR $titleLine;
print STDERR " may not be compatible with OperaHostListToHTML version $VERSION)" if $titleLine ne 'Opera Hotlist version 2.0';
print STDERR "\n";
my $folderDepth = 1;
my $rec;
print "\n\n";
while ( ) {
next unless $_; chomp;
m/^-$/ && do { $folderDepth -= 1; print "
\n"; next; };
m/^#FOLDER$/
&& do { $folderDepth += 1;
$rec = getRecord();
print "$$rec{'NAME'}\n";
next;
};
m/^#URL/
&& do {
$rec = getRecord();
my $desc = "
$$rec{'DESCRIPTION'}" if $$rec{'DESCRIPTION'};
print "- $$rec{'NAME'}$desc
\n";
next;
};
}
for ( 1..$folderDepth ) {
print '
';
}
print "\n";
sub getRecord {
my %rec;
while ( ) {
chomp;
last unless $_;
$rec{$1} = $2 if m/^\s+(\w+)=(.*)$/;
}
return \%rec;
}