peterw;475696 Wrote: 
> I wouldn't think so. More Perlish, maybe. Better? *(!$command)* returns
> true for $command = undef, $command = 0, $command = "", and who knows
> what else. Maybe you simply need to initialize with *my $command =
> undef;* -- then your defined() would be crystal clear. *(!$command)* is
> the kind of foolishness I really dislike in loosely typed languages.
I agree about loosely typed languages.  But in this context, returning
true for $command = undef, $command = 0, $command = "", and who knows
what else is exactly what I want.  In SC 7.3.x, this worked:

Code:
--------------------
    
  $command = $g{prefs}->szOnWakeup_cmd;
  
  if (!defined($command)) {
        return -1;
  }
  
--------------------

More often than not, users don't have anything stored in the OnWakeup
pref.  So you'd think that this would be undef.  But for some reason,
with 7.4, I'm finding that it's turning up defined, but "".


-- 
gharris999
------------------------------------------------------------------------
gharris999's Profile: http://forums.slimdevices.com/member.php?userid=115
View this thread: http://forums.slimdevices.com/showthread.php?t=48521

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to