If you're intent on rolling your own, this is a reasonably good start. A couple of suggestions:

1. Add a Configuration section. Stuff like DB connect strings belong there.

    my $odbcDSN = "PageData"
    my $dbConnectString = "dbi:ODBC:DSN=$odbcDSN";
This way, if someone wants to retarget your code to some other DBMS, they may be able to get by with only changes to the Configuration section.

2. By embedding the "usage" message so far down in the code, you increase the risk that when you add a new option, you forget to change the message. Better to either have a usage() routine at the top (where it also serves as documentation, or as part of the POD documentation. I've seen a couple of scripts that open themselves and extract the usage message from their own POD.

3. gethtml() is rather large. Look at the casually-related things that're done there, and consider ways to break them out into separate subroutines.

4. Note that many sites take defensive measures against being sucked dry by robots. At the very least, it is considered polite to stagger successive requests to the same site by 60 seconds.


In reply to Re: ChilliBot Web Crawler by dws
in thread ChilliBot Web Crawler by ChilliHead

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.