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

Thanks for the response, lots to get my teeth into there:

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

Could you explain this in more detail please?

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

I've just revised the script to take account of HTML::Template as suggested, I should look into CGI::Simple shortly as advised.

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

I'm guessing probably because I don't truly understand globalsand aren't using them properly! :-P

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

Thanks, I'll look into that on the link provided.

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

The script isn't complete yet and I find it helpful while debugging etc to catch anything I've passed accidentally when I'm chopping and changing what gets passed to what.

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. :-)

I'm sure that you're right, actually. I guess that bit is a bit redundant...

Thanks!
  • Comment on Re^2: Could I get some feedback on my code please?