#!/usr/bin/perl
use LWP::Simple;


$myKey = "xxx";
$zip = 20742;
$file = get "http://api.openweathermap.org/data/2.5/weather?zip=$zip,us&APPID=$myKey&mode=xml";

if($file =~ /sun rise="([^"]+)" set="([^"]+)"/) {


	($sunRiseDate,$sunRiseTime)=split(/T/,$1);
	($h,$m,$s)=split(/:/,$sunRiseTime);

	($sunSetDate,$sunSetTime)=split(/T/,$2);
	($hs,$ms,$ss)=split(/:/,$sunSetTime);

	$h = $h - 5;
	$hs = $hs - 17;


	$text = "The sunrise today in College Park, MD is at $h:$m am and sunset is at $hs:$ms pm";

}

print qq^

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Info windows</title>
    <style>
      /* Always set the map height explicitly to define the size of the div
       * element that contains the map. */
      #map {
        height: 100%;
      }
      /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>

      // This example displays a marker at the center of Australia.
      // When the user clicks the marker, an info window opens.

      function initMap() {
        var uluru = {lat: 38.9897, lng: -76.9378};
        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 4,
          center: uluru
        });

        var contentString = '<div id="content">'+
            '<div id="siteNotice">'+
            '</div>'+
            '<h1 id="firstHeading" class="firstHeading">Sunrise and Sunset in College Park</h1>'+
            '<div id="bodyContent">'+
            '<p>$text</p>'+
            '</div>'+
            '</div>';

        var infowindow = new google.maps.InfoWindow({
          content: contentString
        });

        var marker = new google.maps.Marker({
          position: uluru,
          map: map,
          title: 'Sunrise and Sunset in College Park'
        });
        marker.addListener('click', function() {
          infowindow.open(map, marker);
        });
      }
    </script>
    <script async defer
    src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCteZ-kqsCDd3UYHoEnH-upnv6-vuWhSTg&callback=initMap">
    </script>
  </body>
</html>

^;
