NAME

Astro::MoonPhase::Simple - Calculate the phase of the Moon on a given time without too much blah blah

VERSION

Version 0.01

SYNOPSIS

This package provides a single subroutine to calculate the phase of the moon on a given time. The results are returned as a hash.

The heavy lifting is done by Astro::MoonPhase. All this package does is to wrap the functionality of Astro::MoonPhase adding some parameter checking.

use Astro::MoonPhase::Simple;

my $res = calculate_moon_phase({
  'date' => '1974-07-14',
  'timezone' => 'Asia/Nicosia',
});
print "moon is ".$res->{'MoonPhase%'}."% full\n";
print "moon is illuminated by ".$res->{'MoonIllum%'}."%\n";

print $res->{'asString'};

# alternatively provide a location instead of a timezone
# to deduce the timezone
my $res = calculate_moon_phase({
  'date' => '1974-07-14',
  'time' => '04:00',
  'location' => {lat=>49.180000, lon=>-0.370000}
});

...

EXPORT

SUBROUTINES

calculate_moon_phase

This is the main and only subroutine which is exported by default. It expects a HASH reference as its input parameter containing date, in the form "YYYY-MM-DD", and optionally time, in the form "hh:mm:ss". The timezone the date is pertaining to can be specified using key "timezone", in the form of a TZ identifier, e.g. "Africa/Abidjan". Alternatively, specify the location, as a HASHref of {lon, lat}, the moon is observed from and this will deduce the timezone, albeit not always as accurately as with specifying a "timezone" explicitly.

On failure it returns undef. On success it returns a HASHref with keys:

SCRIPT

The script moon-phase-calculator.pl is provided for doing the calculations via the command line.

Example usage: moon-phase-calculator.pl --date 1974-07-14 --timezone 'Asia/Nicosia'

SEE ALSO

This package summarises https://perlmonks.org/?node_id=11137299 over at PerlMonks.org

There are some more goodies in that post e.g. PerlMonk Aldebaran does the same for planets.

I can't iterate enough that this module wraps the functionality of Astro::MoonPhase. Astro::MoonPhase does all the heavy lifting.

AUTHOR

Andreas Hadjiprocopis, <bliako at cpan.org>

DEDICATIONS

Marathon Almaz

BUGS

Please report any bugs or feature requests to bug-astro-moonphase-simple at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Astro-MoonPhase-Simple. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Astro::MoonPhase::Simple

You can also look for information at:

ACKNOWLEDGEMENTS

The authors of Astro::MoonPhase takes all the credit.

LICENSE AND COPYRIGHT

This software is Copyright (c) 2024 by Andreas Hadjiprocopis.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

POD ERRORS

Hey! The above document had some coding errors, which are explained below: