• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item6794: duplicate unless statement

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine configure Normal No Action Required   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

It seems to be duplicate define in "twiki/bin/configure" line 288-294:

unless ( $TWiki::cfg{DetailedOS} ) { 
  $TWiki::cfg{DetailedOS} = $^O; 
  unless ( $TWiki::cfg{DetailedOS} ) { 
    require Config; 
    $TWiki::cfg{DetailedOS} = $Config::Config{osname}; 
  } 
}

First, one "unless" statement is enough to this case; second, " $^O" is identical to $Config{'osname'}, I don't think need another $Config::Config{osname}. And according to the CPAN Config page, perhaps use $Config{'osname'} is better than "$Config::Config{osname}" though they will return the same resule. Here is my suggestion:

unless ( $TWiki::cfg{DetailedOS} ) { 
  $TWiki::cfg{DetailedOS} = $^O; 
}

Thanks,

Phillip

-- TWiki:Main/PhillipHuang - 2011-08-16

Not sure if we can drop the second check. TWiki (and Perl) runs on many different platforms and versions. There was probably a reason to have the double check with fallback.

-- TWiki:Main.PeterThoeny - 2011-08-19

The only case where this can happen is if Perls $^O returns undef, a null string, or 0. If Perl is properly built and ported, it cant happen. This seems unlikely (and I wouldn't code it this way). But it's harmless - and not worth the trouble of making the edit and testing.

I'm closing 'no action required'.

-- Timothe Litt - 2014-01-25

ItemTemplate
Summary duplicate unless statement
ReportedBy TWiki:Main.PhillipHuang
Codebase 5.0.1
SVN Range TWiki-5.1.0, Sun, 14 Aug 2011, build 22046
AppliesTo Engine
Component configure
Priority Normal
CurrentState No Action Required
WaitingFor

Checkins

TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2014-01-25 - TimotheLitt
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback