3 #=======================================================================
5 # File ID: 8e329af6-42a0-11e2-bef5-fefdb24f8e10
9 # ©opyleft 2012– Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 3 or later, see end of
11 # file for legal stuff.
12 #=======================================================================
32 $progname =~ s/^.*\/(.*?)$/$1/;
33 our $VERSION = '0.00';
35 Getopt
::Long
::Configure
('bundling');
38 'debug' => \
$Opt{'debug'},
39 'help|h' => \
$Opt{'help'},
40 'verbose|v+' => \
$Opt{'verbose'},
41 'version' => \
$Opt{'version'},
43 ) || die("$progname: Option error. Use -h for help.\n");
45 $Opt{'debug'} && ($Debug = 1);
46 $Opt{'help'} && usage
(0);
47 if ($Opt{'version'}) {
58 defined($ARGV[0]) || (warn("$progname: Name not specified\n"), return 1);
60 my $dist = defined($ARGV[1]) ?
$ARGV[1] : '0.00050';
61 msg
(0, "name = '$name'");
62 msg
(0, "dist = '$dist'");
64 system(sprintf("psql gps -c \"%s\" | less", <<END));
65 SELECT date, coor, name, dist
70 WHERE name LIKE '$name'
72 )::point <-> coor <= $dist
81 # Print program version {{{
82 print("$progname v$VERSION\n");
88 # Send the help message to stdout {{{
91 if ($Opt{'verbose'}) {
97 Usage: $progname [options] name [dist]
104 Increase level of verbosity. Can be repeated.
106 Print version information.
108 Print debugging messages.
116 # Print a status message to stderr based on verbosity level {{{
117 my ($verbose_level, $Txt) = @_;
119 if ($Opt{'verbose'} >= $verbose_level) {
120 print(STDERR
"$progname: $Txt\n");
127 # Print a debugging message {{{
129 my @call_info = caller;
130 chomp(my $Txt = shift);
131 my $File = $call_info[1];
133 $File =~ s
#^.*/(.*?)$#$1#;
134 print(STDERR
"$File:$call_info[2] $$ $Txt\n");
141 # Plain Old Documentation (POD) {{{
151 [options] [file [files [...]]]
161 =item B<-h>, B<--help>
163 Print a brief help summary.
165 =item B<-v>, B<--verbose>
167 Increase level of verbosity. Can be repeated.
171 Print version information.
175 Print debugging messages.
185 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
189 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
190 This is free software; see the file F<COPYING> for legalese stuff.
194 This program is free software: you can redistribute it and/or modify it
195 under the terms of the GNU General Public License as published by the
196 Free Software Foundation, either version 3 of the License, or (at your
197 option) any later version.
199 This program is distributed in the hope that it will be useful, but
200 WITHOUT ANY WARRANTY; without even the implied warranty of
201 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
202 See the GNU General Public License for more details.
204 You should have received a copy of the GNU General Public License along
206 If not, see L<http://www.gnu.org/licenses/>.
214 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :