The basename + substitution business doesn't seem to make any sense. The doc says basename quotes any metacharacters in the suffix(es), so that line is looking for a literal dot star at the end of the filename - rather unlikely, even if we have a URL to begin with. The substitution will replace the first repeated sequence of one dot followed by any number of word characters by .url (whose dot needs no quoting since it's on the right hand side of the substitution anyway). That sequence does not necessarily have to be what terminates the string. Taking a ponderous guess at the purpose of the hooha, I bid URI.

And for some more Perlishness, use the diamond operator instead of explicitly opening a file. With lots fewer temporaries:

use strict; use warnings; use URI; use URI::Find; use Config::IniHash; use File::Basename; use File::Spec::Functions qw(catfile); my $dir = 'Links'; unless (-d $dir) { mkdir $dir or die "can't mkdir($dir): $!"; } URI::Find->new(\do {local $/; <> })->find(sub { my($uri, $orig_uri) = @_; WriteINI(catfile($dir, uc URI->new($uri)->host), { DEFAULT => { BASEURL => $uri }, InternetShortcut => { URL => $uri, Modified => 0 }, }); });

Makeshifts last the longest.


In reply to Re^2: url2link by Aristotle
in thread Url2Link 0.1 GUI/TK by m_dv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.