NAME

Geo::Local::Server - Returns the configured coordinates of the local server

SYNOPSIS

  use Geo::Local::Server;
  my $gls=Geo::Local::Server->new;
  my ($lat, $lon)=$gls->latlon;

DESCRIPTION

Reads coordinates from either the user environment variable COORDINATES_WGS84_LON_LAT_HAE or the file /etc/local.coordinates or C:\Windows\local.coordinates.

USAGE

Scripts

Typical use is with the provided scripts

  is_nighttime && power-outlet WeMo on  host mylamp
  is_daytime   && power-outlet WeMo off host mylamp
  echo "task" | at `sunrise_time`
  echo "task" | at `sunset_time`

One Liner

  $ perl -MGeo::Local::Server -e 'printf "Lat: %s, Lon: %s\n", Geo::Local::Server->new->latlon'
  Lat: 38.780276, Lon: -77.386706

METHODS

latlon, latlong

Returns a list of latitude, longitude

lat

Returns the latitude.

lon

Returns the longitude

hae

Returns the configured height of above the ellipsoid

lonlathae

Returns a list of longitude, latitude and height above the ellipsoid

PROPERTIES

envname

Sets and returns the name of the environment variable.

  my $var=$gls->envname; #default COORDINATES_WGS84_LON_LAT_HAE
  $gls->envname("");     #disable environment lookup
  $gls->envname(undef);  #reset to default

configfile

Sets and returns the location of the local.coordinates filename.

  my $var=$gls->configfile; #default /etc/local.coordinates or C:\Windows\local.coordinates
  $gls->configfile("");     #disable file-based lookup
  $gls->configfile(undef);  #reset to default

CONFIGURATION

File

I recommend building and installing an RPM from the included SPEC file which installs /etc/local.coorindates.

  rpmbuild -ta Geo-Local-Server-?.??.tar.gz

Outerwise copy the example etc/local.coorindates file to either /etc/ or C:\Windows\ and then update the coordinates to match your server location.

Environment

I recommend building and installing an RPM with the included SPEC file which installs /etc/profile.d/local.coordinates.sh which correctly sets the COORDINATES_WGS84_LON_LAT_HAE environment variable.

Otherwise you can export the COORDINATES_WGS84_LON_LAT_HAE variable or add it to your .bashrc file.

  export COORDINATES_WGS84_LON_LAT_HAE="-77.386706 38.780276 63"

Format

The /etc/local.coordinates file is an INI file. The [wgs84] section is required for this package to function.

  [main]
  version=1

  [wgs84]
  latitude=38.780276
  longitude=-77.386706
  hae=63

OBJECT ACCESSORS

ci

Returns the Config::IniFiles object so that you can read additional information from the INI file.

  my $config=$gls->ci; #isa Config::IniFiles

Example

  my $version=$gls->ci->val("main", "version");

BUGS

Please log on RT and send an email to the author.

SUPPORT

DavisNetworks.com supports all Perl applications including this package.

AUTHOR

  Michael R. Davis
  CPAN ID: MRDVT
  Satellite Tracking of People, LLC
  mdavis@stopllc.com
  http://www.stopllc.com/

COPYRIGHT

This program is free software licensed under the...

  The BSD License

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

DateTime::Event::Sunrise, Power::Outlet, Geo::Point, URL::geo