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 #=======================================================================
31 $progname =~ s/^.*\/(.*?)$/$1/;
32 our $VERSION = "0.00";
34 Getopt
::Long
::Configure
("bundling");
37 "debug" => \
$Opt{'debug'},
38 "help|h" => \
$Opt{'help'},
39 "verbose|v+" => \
$Opt{'verbose'},
40 "version" => \
$Opt{'version'},
42 ) || die("$progname: Option error. Use -h for help.\n");
44 $Opt{'debug'} && ($Debug = 1);
45 $Opt{'help'} && usage
(0);
46 if ($Opt{'version'}) {
51 my $DIGIT = '0-9\.\-\+';
56 my ($Lat, $Lon, $Name, $Phone) = ("", "", "", "");
57 if (/^([$DIGIT]+),([$DIGIT]+),(.*) - (.*?)$/) {
58 ($Lon, $Lat, $Name, $Phone) =
59 (txt_to_xml
($1), txt_to_xml
($2), txt_to_xml
($3), txt_to_xml
($4));
61 <wpt lat="$Lat" lon="$Lon">
63 <cmt>$Name - $Phone</cmt>
67 warn(sprintf("%s: Unknown line: \"%s\"\n", $progname, chomp($_)));
74 # Convert plain text to XML {{{
86 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
89 creator="csv2gpx - http://svn.sunbase.org/repos/utils/trunk/csv2gpx"
90 xmlns="http://www.topografix.com/GPX/1/1"
91 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
92 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
99 # Print program version {{{
100 print("$progname v$VERSION\n");
105 # Send the help message to stdout {{{
108 if ($Opt{'verbose'}) {
114 Usage: $progname [options] [file [files [...]]]
121 Increase level of verbosity. Can be repeated.
123 Print version information.
125 Print debugging messages.
133 # Print a status message to stderr based on verbosity level {{{
134 my ($verbose_level, $Txt) = @_;
136 if ($Opt{'verbose'} >= $verbose_level) {
137 print(STDERR
"$progname: $Txt\n");
143 # Print a debugging message {{{
145 my @call_info = caller;
146 chomp(my $Txt = shift);
147 my $File = $call_info[1];
149 $File =~ s
#^.*/(.*?)$#$1#;
150 print(STDERR
"$File:$call_info[2] $$ $Txt\n");
157 # Plain Old Documentation (POD) {{{
167 [options] [file [files [...]]]
177 =item B<-h>, B<--help>
179 Print a brief help summary.
181 =item B<-v>, B<--verbose>
183 Increase level of verbosity. Can be repeated.
187 Print version information.
191 Print debugging messages.
201 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
205 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
206 This is free software; see the file F<COPYING> for legalese stuff.
210 This program is free software: you can redistribute it and/or modify it
211 under the terms of the GNU General Public License as published by the
212 Free Software Foundation, either version 3 of the License, or (at your
213 option) any later version.
215 This program is distributed in the hope that it will be useful, but
216 WITHOUT ANY WARRANTY; without even the implied warranty of
217 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
218 See the GNU General Public License for more details.
220 You should have received a copy of the GNU General Public License along
222 If not, see L<http://www.gnu.org/licenses/>.
230 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :