Skip to contentSkip to conversation

GrabWeather Error

DISCUSSION Peter 2 participants 3 messages Jul 13, 2006 – Jul 14, 2006

lore
Share & tools
lore

Peter

author
#0 lore raw

Hi,

If I invoke GrabWeather I get the following error:

Use of uninitialized value in concatenation (.) or string at /usr/local/bin/GrabWeather line 200.

Line 200 reads:

print TmpFile "$SkyConditions\n";

before that there are lines referring to sky condition:

-----------
my ($StationInfo, $UpdateTime, $SkyConditions, $CodedMETAR);

while (<TmpFile>)

{
		chop;
			
		if ($Flag == 0) { $StationInfo = $_; };
		if ($Flag == 1) { $UpdateTime = $_; };
		if (/^Sky conditions:/)
		{ 
				$SkyConditions = $_; 
				$SkyConditions =~ s/Sky conditions: (.*)/$1/; 
		}

------------

Does anyone know how to fix this?

In the meantime I just uncommended line 200.

GrabWeather works just the same.

Thanks & regards

Signature · 7 lines
Peter

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
#1 lore raw

Peter -- Since the error is from an unitialized variable, the obvious thing to try is to initialize it with a harmless default value. Add a line something like this one:

Quoted 1 line

my ($StationInfo, $UpdateTime, $SkyConditions, $CodedMETAR);

$SkyConditions = " " ;

Quoted 1 line

while (<TmpFile>)

I'm assuming this is Perl code; it looks like Perl.

Quoted 29 lines · Peter

Hi,

If I invoke GrabWeather I get the following error:

Use of uninitialized value in concatenation (.) or string at /usr/local/bin/GrabWeather line 200.

Line 200 reads:

print TmpFile "$SkyConditions\n";

before that there are lines referring to sky condition:

-----------
my ($StationInfo, $UpdateTime, $SkyConditions, $CodedMETAR);

while (<TmpFile>)

{
		chop;
			
		if ($Flag == 0) { $StationInfo = $_; };
		if ($Flag == 1) { $UpdateTime = $_; };
		if (/^Sky conditions:/)
		{ 
				$SkyConditions = $_; 
				$SkyConditions =~ s/Sky conditions: (.*)/$1/; 
		}

------------

Quoted 7 lines

Does anyone know how to fix this?

In the meantime I just uncommended line 200.

GrabWeather works just the same.

Thanks & regards

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

author
#2 lore raw
Quoted 4 lines · [email protected] said:

Add a line something like this one:

Quoted 1 line

my ($StationInfo, $UpdateTime, $SkyConditions, $CodedMETAR);

$SkyConditions = " " ;

Thanks! That did it.

Signature · 7 lines
Peter

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs