3 #=======================================================================
8 # ©opyleft 2006– Øyvind A. Holm <sunny@sunbase.org>
9 # License: GNU General Public License version 2 or later, see end of
10 # file for legal stuff.
11 #=======================================================================
34 $progname =~ s/^.*\/(.*?)$/$1/;
37 my $id_date = $rcs_id;
38 $id_date =~ s/^.*?\d+ (\d\d\d\d-.*?\d\d:\d\d:\d\d\S+).*/$1/;
40 push(@main::version_array
, $rcs_id);
42 Getopt
::Long
::Configure
("bundling");
45 "debug" => \
$Opt{'debug'},
46 "help|h" => \
$Opt{'help'},
47 "verbose|v+" => \
$Opt{'verbose'},
48 "version" => \
$Opt{'version'},
50 ) || die("$progname: Option error. Use -h for help.\n");
52 $Opt{'debug'} && ($Debug = 1);
53 $Opt{'help'} && usage
(0);
54 if ($Opt{'version'}) {
59 my $DIGIT = '0-9\.\-\+';
64 my ($Lat, $Lon, $Name, $Phone) = ("", "", "", "");
65 if (/^([$DIGIT]+),([$DIGIT]+),(.*) - (.*?)$/) {
66 ($Lon, $Lat, $Name, $Phone) =
67 (txt_to_xml
($1), txt_to_xml
($2), txt_to_xml
($3), txt_to_xml
($4));
69 <wpt lat="$Lat" lon="$Lon">
71 <cmt>$Name - $Phone</cmt>
75 warn(sprintf("%s: Unknown line: \"%s\"\n", $progname, chomp($_)));
82 # Convert plain text to XML {{{
94 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
98 creator="csv2gpx - http://svn.sunbase.org/repos/utils/trunk/csv2gpx"
99 xmlns="http://www.topografix.com/GPX/1/1"
100 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
101 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
108 # Print program version {{{
109 for (@main::version_array
) {
116 # Send the help message to stdout {{{
119 if ($Opt{'verbose'}) {
125 Usage: $progname [options] [file [files [...]]]
132 Increase level of verbosity. Can be repeated.
134 Print version information.
136 Print debugging messages.
144 # Print a status message to stderr based on verbosity level {{{
145 my ($verbose_level, $Txt) = @_;
147 if ($Opt{'verbose'} >= $verbose_level) {
148 print(STDERR
"$progname: $Txt\n");
154 # Print a debugging message {{{
156 my @call_info = caller;
157 chomp(my $Txt = shift);
158 my $File = $call_info[1];
160 $File =~ s
#^.*/(.*?)$#$1#;
161 print(STDERR
"$File:$call_info[2] $$ $Txt\n");
168 # Plain Old Documentation (POD) {{{
182 [options] [file [files [...]]]
192 =item B<-h>, B<--help>
194 Print a brief help summary.
196 =item B<-v>, B<--verbose>
198 Increase level of verbosity. Can be repeated.
202 Print version information.
206 Print debugging messages.
216 Made by Øyvind A. Holm S<E<lt>sunny@sunbase.orgE<gt>>.
220 Copyleft © Øyvind A. Holm E<lt>sunny@sunbase.orgE<gt>
221 This is free software; see the file F<COPYING> for legalese stuff.
225 This program is free software; you can redistribute it and/or modify it
226 under the terms of the GNU General Public License as published by the
227 Free Software Foundation; either version 2 of the License, or (at your
228 option) any later version.
230 This program is distributed in the hope that it will be useful, but
231 WITHOUT ANY WARRANTY; without even the implied warranty of
232 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
233 See the GNU General Public License for more details.
235 You should have received a copy of the GNU General Public License along
236 with this program; if not, write to the Free Software Foundation, Inc.,
237 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
245 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :