[Moscow.pm] unless

Andrew Shitov andy на shitov.ru
Вт Май 5 01:18:26 PDT 2009


Интересно смотреть на то, как обстоят дела с использованием if и
unless на спане :-) Особый ступор - когда unless стоит сразу после if.


Syslog.pm - perl5.00402-bindist04-msvcAlpha/perl/lib/Sys

    unless (send(SYSLOG,"<$sum>$whoami: $message\0",0)) {
        if ($lo_cons) {
            if ($pid = fork) {
                unless ($lo_nowait) {
                    $died = waitpid($pid, 0);
                }


test1.t - Device-SerialPort-1.002/t

unless (Device::SerialPort->debug(T))     { print "$e T\n";     $fault++; }
if     (Device::SerialPort->debug(F))     { print "$e F\n";     $fault++; }
unless (Device::SerialPort->debug(Y))     { print "$e Y\n";     $fault++; }
if     (Device::SerialPort->debug(N))     { print "$e N\n";     $fault++; }
unless (Device::SerialPort->debug(ON))    { print "$e ON\n";    $fault++; }
if     (Device::SerialPort->debug(OFF))   { print "$e OFF\n";   $fault++; }
unless (Device::SerialPort->debug(TRUE))  { print "$e TRUE\n";  $fault++; }
if     (Device::SerialPort->debug(FALSE)) { print "$e FALSE\n"; $fault++; }
unless (Device::SerialPort->debug(Yes))   { print "$e Yes\n";   $fault++; }
if     (Device::SerialPort->debug(No))    { print "$e No\n";    $fault++; }
unless (Device::SerialPort->debug("yes")) { print "$e \"yes\"\n"; $fault++; }
if     (Device::SerialPort->debug("f"))   { print "$e \"f\"\n";   $fault++; }


TEST - perl-5.9.3/t

if ($ENV{PERL_3LOG}) { # Tru64 third(1) tool, see perlhack
    unless (-x 'perl.third') {
        unless (-x '../perl.third') {
            die "You need to run \"make perl.third first.\n";
        }


SelfLoader.pm - deps/third_party/cygwin/lib/perl5/5.10

    if (defined($line) && $line =~ /^__END__/) { # __END__
        unless ($line =~ /^__END__\s*DATA/) {
            if ($endlines) {


-- 
Andrew Shitov
______________________________________________________________________
andy на shitov.ru | http://shitov.ru


Подробная информация о списке рассылки Moscow-pm