I've got a simple perl subroutine that checks to see if google is still hosting a copy of jquery 1.6 before deciding whether to print a script linking to it or to our locally hosted copy.
This is a copy of the code I'm using.
my $jquery_host = "http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js";
my $header = LWP::Simple::head($jquery_host);
if(defined $header) {
return qq{<script type="text/javascript" src="$jquery_host"></script>};
}
else {
return qq{<script type="text/javascript" src="$localPath"></script>};
}
When I run this code on this command line, I have no problem retrieving a response, and it properly prints out a script tag linking to google's copy of jquery. However, when I actually call it from a perl script that is building an html page, it finds nothing every time and prints out a script tag linking to our own copy.
What permissions or other type of barrier could be halting this connection?
Thanks for your help.
NOTE: This has only run on our local test server so far. The command line is also running on the test server.