This is *great* for personal webpages, where instead of making a link list and having to constantly update it, this snippet will show visitors your favorites in real time.
You can, of course, change the windir to, for example, c:\\sitelinx , and put the links you want to be seen in the site there.
Update: I did change to Opera as OeufMayo suggested, and edited the code to reflect my Opera5 favorites:
simply add either &IEfav; or &operafav; respectively.
use CGI qw(:all);
use strict;
sub IEfav {
my $windir="C:\\windows\\favori~1";
my @FILELIST=glob ("$windir\\*.url");
my ($url, $file, @URLS);
foreach $file (@FILELIST) {
open (URLFILE, $file);
@URLS = <URLFILE>;
foreach (@URLS) {
/.*URL=(.*)/;
$url=$1;
}
$file=~/^C:\\windows\\favori~1\\(.+)\.url$/;
print "<A href=\"$url\"> $1 <\/A><BR>\n";
close URLFILE;
}
sub operafav {
my $operadir="C:\\Program Files\\Opera";
my $name="";
open (URLFILE, "$operadir\\opera5.adr");
foreach (<URLFILE>) {
if (/^\s*NAME=(.*)/) {
$name=$1; }
elsif (/^\s*URL=/) {
my $url=/^\s*URL=(.*)/;
print "<A href=\"$1\"> $name <\/A><P>\n";
}
}
close URLFILE;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.