gpst: %Cmd: Remove it, unused
[gpstools.git] / Patch / gpst.xmlsimple.patch
blob80b3b42a0ea081bcfca168e4710a39f8c3078fea
1 Index: gpst
2 ===================================================================
3 --- gpst (revision 1761)
4 +++ gpst (working copy)
5 @@ -12,6 +12,8 @@
6 use strict;
7 use Getopt::Long;
8 use Time::Local qw { timegm_nocheck };
9 +use XML::Simple;
10 +use Data::Dumper;
12 $| = 1;
14 @@ -447,10 +449,31 @@
16 sub read_xmlfile {
17 # {{{
18 - my $Txt = join("", @_);
19 + D("Inn i read_xmlfile()");
20 + my $Txt = XMLin(@_);
21 + D("Etter XMLin()");
22 + # print(Dumper($Txt->{trk}->{trkseg}->{trkpt}->[0]->{time}));
23 + D(Dumper($Txt));
24 + D("Etter Dumper");
25 + my $Loop = 1;
26 + for (my $a = 0; $Loop; $a++) {
27 + D("a = $a");
28 + my $Date = $Txt->{trk}->{trkseg}->{trkpt}->[$a]->{time};
29 + $Dat{'lat'} = $Txt->{trk}->{trkseg}->{trkpt}->[$a]->{lat};
30 + $Dat{'lon'} = $Txt->{trk}->{trkseg}->{trkpt}->[$a]->{lon};
31 + $Dat{'ele'} = $Txt->{trk}->{trkseg}->{trkpt}->[$a]->{ele};
32 + if ($Date =~ m#(\d\d\d\d)-?(\d\d)-?(\d\d)T(\d\d):?(\d\d):?(\d\d)\.?(\d*?)Z#) {
33 + ($Dat{'year'}, $Dat{'mon'}, $Dat{'day'},
34 + $Dat{'hour'}, $Dat{'min'}, $Dat{'sec'}, $Dat{'secfrac'}) =
35 + ( $1, $2, $3,
36 + $4, $5, $6, $7);
37 + }
38 + print_entry(%Dat);
39 + # print($Txt->{trk}->{trkseg}->{trkpt}->{time}->[$a]);
40 + }
41 # FIXME: The sequential stuff here is probably bad, but easy.
42 - $Txt =~ s#(<gpx\b.*?>.*?</gpx>)#print_gpx($1)#gse;
43 - $Txt =~ s#(<gps\b.*?>.*?</gps>)#print_xml_gps($1)#gse;
44 + # $Txt =~ s#(<gpx\b.*?>.*?</gpx>)#print_gpx($1)#gse;
45 + # $Txt =~ s#(<gps\b.*?>.*?</gps>)#print_xml_gps($1)#gse;
46 # }}}