#!/usr/bin/perl -w
use warnings;
use strict;

package where_am_i
{
    sub new
    {
        my $class = shift;
        my $self = {};
        bless($self, $class);
        return $self;
    }

    sub doupstart
    {
        return 0;
    }

    sub command
    {
        return "WhERe Am i";
    }

    sub help
    {
        return "show the current GPS location";
    }

    sub do
    {
        my $gps = $main::settings{'gps'};
        if (defined($gps) && $gps->hasgps)
        {
            my $mylocation = $gps->location;
            print $main::socket "You are at: ", $mylocation, "\n";
        }
        else
        {
            print $main::socket "No Location service was found at program start.\n";
        }
    }
    
    sub defaultsettings
    {
        return undef;
    }

1;
}
