Skip to contentSkip to conversation

fix Perl syntax errors in fancontrol.pl

PATCH New Sergey Vlasov 2 participants 2 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix Perl syntax errors in fancontrol.pl

Hello!

The prog/pwm/fancontrol.pl script has some obvious syntax errors:

$ perl -cT fancontrol.pl 
"my" variable $file masks earlier declaration in same scope at fancontrol.pl line 165.
"my" variable $file masks earlier declaration in same scope at fancontrol.pl line 167.
"my" variable $file masks earlier declaration in same statement at fancontrol.pl line 167.
"my" variable $file masks earlier declaration in same scope at fancontrol.pl line 168.
"our" variable $interval masks earlier declaration in same scope at fancontrol.pl line 172.
"my" variable $fcvcount masks earlier declaration in same scope at fancontrol.pl line 193.
syntax error at fancontrol.pl line 162, near "$)
sub loadconfig($)
"
Can't use global $! in "my" at fancontrol.pl line 168, near "$file: $!"
syntax error at fancontrol.pl line 214, near "}"
fancontrol.pl had compilation errors.

Looks like this is caused by some strange lines before "sub ..." declarations, which apparently have been added in the last update at 2004/06/23 (hmm, if these errors are still there, probably nobody uses this script).

The patch below is untested due to lack of hardware supporting PWM, but at least "perl -cwT fancontrol.pl" passes now.

prog/pwm/fancontrol.pl renamed from prog/pwm/fancontrol.pl.alt-fix-fancontrol +0 -5
@@ -157,7 +157,6 @@ while(1)
 1;
 
 ################################################################ 
-loadconfig($)
 sub loadconfig($)
 {
    my $file = shift;
@@ -215,7 +214,6 @@ $minstop);
 
 
 ################################################################ 
-pwmdisable($)
 sub pwmdisable($)
 {
    my $p = shift;
@@ -257,7 +255,6 @@ sub pwmdisable($)
 
 
 ################################################################# 
-pwmenable($)
 sub pwmenable($)
 {
    my $p = shift;
@@ -291,7 +288,6 @@ sub pwmenable($)
 
 
 ################################################################ 
-restorefans()
 sub restorefans()
 {
    $SIG{TERM} = 'IGNORE';
@@ -314,7 +310,6 @@ sub restorefans()
 
 
 ############################################################ 
-UpdateFanSpeeds()
 sub UpdateFanSpeeds()
 {
    my $fcvcount = 0;
Signature · 8 lines
Sergey Vlasov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20050501/48e27bff/attachment.bin
#1 lore raw

PATCH 1/1 fix Perl syntax errors in fancontrol.pl

checked in to CVS
thanks
mds

Quoted 69 lines · Sergey Vlasov

Hello!

The prog/pwm/fancontrol.pl script has some obvious syntax errors:

$ perl -cT fancontrol.pl 
"my" variable $file masks earlier declaration in same scope at fancontrol.pl line 165.
"my" variable $file masks earlier declaration in same scope at fancontrol.pl line 167.
"my" variable $file masks earlier declaration in same statement at fancontrol.pl line 167.
"my" variable $file masks earlier declaration in same scope at fancontrol.pl line 168.
"our" variable $interval masks earlier declaration in same scope at fancontrol.pl line 172.
"my" variable $fcvcount masks earlier declaration in same scope at fancontrol.pl line 193.
syntax error at fancontrol.pl line 162, near "$)
sub loadconfig($)
"
Can't use global $! in "my" at fancontrol.pl line 168, near "$file: $!"
syntax error at fancontrol.pl line 214, near "}"
fancontrol.pl had compilation errors.

Looks like this is caused by some strange lines before "sub ..." declarations, which apparently have been added in the last update at 2004/06/23 (hmm, if these errors are still there, probably nobody uses this script).

The patch below is untested due to lack of hardware supporting PWM, but at least "perl -cwT fancontrol.pl" passes now.

prog/pwm/fancontrol.pl renamed from prog/pwm/fancontrol.pl.alt-fix-fancontrol +0 -5
@@ -157,7 +157,6 @@ while(1)
 1;
 
 ################################################################ 
-loadconfig($)
 sub loadconfig($)
 {
    my $file = shift;
@@ -215,7 +214,6 @@ $minstop);
 
 
 ################################################################ 
-pwmdisable($)
 sub pwmdisable($)
 {
    my $p = shift;
@@ -257,7 +255,6 @@ sub pwmdisable($)
 
 
 ################################################################# 
-pwmenable($)
 sub pwmenable($)
 {
    my $p = shift;
@@ -291,7 +288,6 @@ sub pwmenable($)
 
 
 ################################################################ 
-restorefans()
 sub restorefans()
 {
    $SIG{TERM} = 'IGNORE';
@@ -314,7 +310,6 @@ sub restorefans()
 
 
 ############################################################ 
-UpdateFanSpeeds()
 sub UpdateFanSpeeds()
 {
    my $fcvcount = 0;