3 #=======================================================================
5 # File ID: 9867d624-f742-11dd-910a-000475e441b9
9 # ©opyleft 2006– Ø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'}) {
52 my $DIGIT = '0-9\.\-\+';
57 my ($Lat, $Lon, $Name, $Phone) = ("", "", "", "");
58 if (/^([$DIGIT]+),([$DIGIT]+),(.*) - (.*?)$/) {
59 ($Lon, $Lat, $Name, $Phone) =
60 (txt_to_xml
($1), txt_to_xml
($2), txt_to_xml
($3), txt_to_xml
($4));
62 <wpt lat="$Lat" lon="$Lon">
64 <cmt>$Name - $Phone</cmt>
68 warn(sprintf("%s: Unknown line: \"%s\"\n", $progname, chomp($_)));
75 # Convert plain text to XML {{{
87 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
90 creator="csv2gpx - http://sunny256.github.com/gpstools/"
91 xmlns="http://www.topografix.com/GPX/1/1"
92 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
93 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
100 # Print program version {{{
101 print("$progname v$VERSION\n");
106 # Send the help message to stdout {{{
109 if ($Opt{'verbose'}) {
115 Usage: $progname [options] [file [files [...]]]
122 Increase level of verbosity. Can be repeated.
124 Print version information.
126 Print debugging messages.
134 # Print a status message to stderr based on verbosity level {{{
135 my ($verbose_level, $Txt) = @_;
137 if ($Opt{'verbose'} >= $verbose_level) {
138 print(STDERR
"$progname: $Txt\n");
144 # Print a debugging message {{{
146 my @call_info = caller;
147 chomp(my $Txt = shift);
148 my $File = $call_info[1];
150 $File =~ s
#^.*/(.*?)$#$1#;
151 print(STDERR
"$File:$call_info[2] $$ $Txt\n");
158 # Plain Old Documentation (POD) {{{
168 [options] [file [files [...]]]
178 =item B<-h>, B<--help>
180 Print a brief help summary.
182 =item B<-v>, B<--verbose>
184 Increase level of verbosity. Can be repeated.
188 Print version information.
192 Print debugging messages.
202 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
206 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
207 This is free software; see the file F<COPYING> for legalese stuff.
211 This program is free software: you can redistribute it and/or modify it
212 under the terms of the GNU General Public License as published by the
213 Free Software Foundation, either version 3 of the License, or (at your
214 option) any later version.
216 This program is distributed in the hope that it will be useful, but
217 WITHOUT ANY WARRANTY; without even the implied warranty of
218 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
219 See the GNU General Public License for more details.
221 You should have received a copy of the GNU General Public License along
223 If not, see L<http://www.gnu.org/licenses/>.
231 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :