Hi PockMonk,

I'm in a very similar boat to yourself. I'm not able to run your code but just from reading it I think it looks fine. And if it works that surely must be a bonus. :-)

I would like to make a few points and ask a couple of questions.

The list of 23 regexes in fetchArticleCreator() to extract data from HTML could be replaced by using an HTML parser.

To add to f00li5h's very good point about taking the HTML 'guff' out of your script. You don't appear to be using CGI.pm for any output. I don't either so I moved over to using CGI::Simple. The docs discuss why you might consider doing the same.

Minor nits.

I find using all uppercase for globals helps make my scripts clearer. Why do you "our" instead of "my"?

imo I think CGI scripts in particular benefit from the 3 argument open. I also always use a lexical file handle to avoid the bareword.

For my own curiosity:

Why do your subs checkForUnexpectedArgs()? All the subs are called from within the script so I'm not sure how useful the user will find that message.

When would checkFileCanBeAccessed() return and a subsequent open die? Wouldn't or error("$msg $!") on the open be enough? I have some major rewriting to do if it isn't. :-)

Hope that helps.


In reply to Re: Could I get some feedback on my code please? by wfsp
in thread Could I get some feedback on my code please? by PockMonk

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.