Perl on Vacation

Well day two way out here very very far from anything and with my good old 34k line and my wife wants to watch the sunset over the Atlantic. Well I told here that is not going to happen here as the sun only rises over the ocean you will have to wait till our trip to B.C. in a few years.

I did tell here she could get up to watch the sunrise. Great what time is that. Well not having my copy of 'ADMIRALTY Sailing Directions' handy, and no GPS and really no Internet or phone connection or even T.V. All I had was a tide table from 6 years ago but at least I did have the lat and long from the table (well at least a close approximation)

47°01'45.1"N 60°23'52.5"W

and in my lap top I have perl and a little module I loaded about a year ago. 'Astro::Sunrise' so I think I was saved.

So I started up my Perl popped though the POD and realized my data was in Standard Notation not Decimal Notation which is required by my Mod. Well unfortunately did not load 'Geo::Coordinates::Transform' and I did not want to waste an hour of so for the download and install and anyway an old Tar like me knows how to do the conversion.

So after 10 mins of head scatching and number crunching I got

47.030,-60.400 and plugged them in like this

use Astro::Sunrise;

my ($sunrise, $sunset) = sunrise(2014,04,22,47.03,-60.4,-4,1,-18);

print "Sun up =".$sunrise;

and I got

Sun up =05:44

No I did ask for '-18' in my code which is 'astronomical twilight' or still dark outside to give me a little time to wake up the wife and get a pot of coffee going.

Lets see what happens in the morning.

Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations