in reply to redirection in perl

Among other things, you should print out the value of $homepageurl when reporting the error, so you can determine if your URL is correct/valid...