From 9b7a531c3596abb88b42f9eb06cbc7b1db1ead8b Mon Sep 17 00:00:00 2001 From: battilo Date: Sun, 13 May 2018 11:54:17 +0200 Subject: [PATCH] g201 --- UnitCsvReceiverSmart.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/UnitCsvReceiverSmart.pl b/UnitCsvReceiverSmart.pl index caacd80..37f35dd 100644 --- a/UnitCsvReceiverSmart.pl +++ b/UnitCsvReceiverSmart.pl @@ -26,6 +26,9 @@ sub getTimeStamp } sub getUnitName { # parm => file received ($trfile) + my ($filename) = @_; + my ( $fileDate, $fileTime ); + my ( $unittype, $unit ); if ( $filename = m/^(\d\d\d\d\d\d\d\d\d\d\d\d\d\d_)(G201_ID\d\d\d\d_DT\d\d\d\d)$/i ) { # GD201 my @strings = $filename =~ /(.{1,4})(.{1,2})(.{1,2})(.{1,2})(.{1,2})(.{1,2})_(.{1,4})_(.{1,6})_(.{1,6}).*/; $fileDate = $strings[0] . "/" . $strings[1] . "/" . $strings[2];; @@ -33,11 +36,10 @@ sub getUnitName { # parm => file received ($trfile) $unittype = $strings[6]; $unit = $strings[7]; } else { - my ($filename) = @_; open FILE, $filename or warn getTimeStamp("log") . " >> Error: opening input file $filename\n"; - my ( $fileDate, $fileTime ) = split( /\s/, ); - my ( $unittype, $unit ) = split( /\s/, uc ); + ( $fileDate, $fileTime ) = split( /\s/, ); + ( $unittype, $unit ) = split( /\s/, uc ); $unit =~ s/;+$//; close FILE; }