dakedesu has asked for the wisdom of the Perl Monks concerning the following question:

Hullo,

I know this has been ask so much that you will flog me for just refering to it.

Anyways, as an Idea, I thought, "hey, what would happen, if in some forum software, it would check if what the person posted for an avatar, or link is a 404 or 403?" Basically, all that it would do, is open a socket with the server, for atleast the image part, and then when it is processing the form data, will notify the user, if the other server spouts out 404 or 403.

So, where is there an article on this? What CPAN modules should I look at?

  • Comment on Looking for an FAQ... on sockets, http, and other fun stuff

Replies are listed 'Best First'.
(wil) Re: Looking for an FAQ... on sockets, http, and other fun stuff
by wil (Priest) on May 18, 2002 at 17:27 UTC
    If I was you I'd look into the module LWP::Simple. This should be more than capable of doing what you're trying to do.

    You will need to specifically look into the built-in is_error(); function which if true means that LWP::Simple was not able to retrieve your document or image. You can then call your sub to warn the user of his or her's error.

    I wouldn't really recommend doing this in a busy forum environment, though, as it is likely to be a slightly slow process and I would also consider making this optional for the user, as I know I would prefer to double-check by hand (if I was unsure) than having to wait that exrta second every time I post a message. Just my opinion...

    Hope this helps.

    - wil

      Well, atleast for their first little use, there will not really be that much traffic to the site, to make the extra time for this really that big of deal. I can add the option to disable this.

      As for double checking the links, not everybody does that.

      Thanks for the module. Thanks for not charing me until nothing remains nor sending me to karma hell.