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

I'm trying to create a script that would change update a graphic with the current temperature and icon, according to the current conditions. This would be accomplished by accessing some sort of weather web service. This script will be installed on a web server that I don't have permission to install new modules on, but already has SOAP::Lite installed. What would be the general format for accessing a weather web service and storing the information as an object? If possible, I would like to use weather.com's information.

Replies are listed 'Best First'.
Re: Weather Script
by Art_XIV (Hermit) on Apr 15, 2004 at 15:21 UTC

    Not an exact answer, but...

    Geo::Weather, Geo::WeatherNOAA and a CPAN search should be able to provide you with much screen-scraping inspiration.

    You might want to google for a weather web service or look here if that's the route that you really want to take. The organization that provides the web service should have details on how to use it.

    Hanlon's Razor - "Never attribute to malice that which can be adequately explained by stupidity"
Re: Weather Script
by Abigail-II (Bishop) on Apr 15, 2004 at 15:08 UTC
    I bet it's harder to formulate a question that's less broad than writing the entire script from scratch. There's no "general format for accessing a weather web service". Nor to store that information in an object.

    First, you need to define for yourself what kind of information you want to display. Current temperature is your data, but do you just want to display a number? (In that case, no graphic is needed). A graph with the temperature of the past X days? Something else? Furthermore, where is your data coming from? An HTML document? Some other web service (since you mention SOAP::Lite)? I know weather.com has HTML documents with weather information. I would use LWP::Simple, or lynx to retrieve the information. As for the object, well, if all you care about is a temperature, I wouldn't bother with an object. A scalar will do fine.

    This script will be installed on a web server that I don't have permission to install new modules on
    Reaaaaaaaaaaaaaaaaaaaaaaaaaaaally? And you can install a program? How does whatever method you use to install a program know whether what you are installing is a program and not a module? What about a file that can be used both as a program and a module? If you install that, does the web server disappear in a time-space singularity?

    Abigail

      My goal is to display a different weather picture, depending on the weather conditions (rain, snow, sunny, cloudy, etc) and the temperature. Nothing more. What I meant by general format, was what is a general approach I could take. Not necessarily code, but what resource I could use.