#!/usr/bin/perl
#
# Print time of sunrise & sunset in Boroughbridge.
#
use strict;
use warnings;
use Astro::Sunrise;
use Time::localtime;
my $tm = localtime;
my $timezone;
my $sunup;
my $sunset;
my $the_year = $tm->year; # Year
my $the_month = $tm->mon; # Month
my $the_day = $tm->mday; # Day of Month
my $daylight_saving = $tm->isdst; # BST==1, GMT==0
$the_year = $the_year + 1900;
$the_month = $the_month + 1;
# For Boroughbridge: lat 54.09, long -1.4, UTC+0
($sunup, $sunset) = sunrise( $the_year, $the_month, $the_day, -1.4, 54.09, 0, $daylight_saving );
if ($daylight_saving == 1) {
$timezone = "BST";
}
else
{
$timezone = "GMT";
}
print "\nOn: $the_day/$the_month/$the_year in Boroughbridge\n\n";
print "Sunrise: $sunup AM $timezone\n";
print " Sunset: $sunset PM $timezone\n\n";