From b6c8428ab46c09323dca5f9ed3af21519e9feb2a Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20A=2E=20Holm?= Date: Wed, 19 May 2010 23:56:00 +0200 Subject: [PATCH] GPST.pm: Move pgtab stuff out of trackpoint() into the new gen_pgtab_entry() 72e9a4e2-6391-11df-989f-90e6ba3022ac --- GPST.pm | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/GPST.pm b/GPST.pm index dbc103d..f61aa1e 100644 --- a/GPST.pm +++ b/GPST.pm @@ -77,19 +77,7 @@ sub trackpoint { $Retval .= "$Dat{'lon'} $Dat{'lat'}\n"; } } elsif ($Dat{'format'} eq "pgtab") { - $Retval .= join("\t", - $Dat{'year'} - ? "$Dat{'year'}-$Dat{'month'}-$Dat{'day'}T" . - "$Dat{'hour'}:$Dat{'min'}:$Dat{'sec'}Z" - : '\N', # date - (length($Dat{'lat'}) && length($Dat{'lon'})) - ? "($Dat{'lat'},$Dat{'lon'})" - : '\N', # coor - length($Dat{'ele'}) ? $Dat{'ele'} : '\N', # ele - '\N', # name - '\N', # dist - '\N' # description - ) . "\n"; + $Retval .= gen_pgtab_entry(%Dat); } elsif ($Dat{'format'} eq "gpstrans") { # {{{ my ($gpt_lat, $gpt_lon) = @@ -188,6 +176,26 @@ sub gen_gpsml_entry { # }}} } # gen_gpsml_entry() +sub gen_pgtab_entry { + # {{{ + my %Dat = @_; + my $Retval = join("\t", + $Dat{'year'} + ? "$Dat{'year'}-$Dat{'month'}-$Dat{'day'}T" . + "$Dat{'hour'}:$Dat{'min'}:$Dat{'sec'}Z" + : '\N', # date + (length($Dat{'lat'}) && length($Dat{'lon'})) + ? "($Dat{'lat'},$Dat{'lon'})" + : '\N', # coor + length($Dat{'ele'}) ? $Dat{'ele'} : '\N', # ele + '\N', # name + '\N', # dist + '\N' # description + ) . "\n"; + return($Retval); + # }}} +} # gen_pgtab_entry() + sub postgresql_copy_safe { # {{{ my $Str = shift; -- 2.11.4.GIT