develooper Front page | perl.perl5.porters | Postings from September 2010

warn always returns true

Thread Next
From:
Dr.Ruud
Date:
September 19, 2010 21:20
Subject:
warn always returns true
Message ID:
20100919224017.14957.qmail@lists-nntp.develooper.com
I think it should be documented that warn() always returns true.
(and die() too?)


perl -wle '
   $SIG{__WARN__} = sub { warn "Foo: ", @_; return };
   my $x = 0;
   eval { 1 / $x } or warn( "1:", $@ ) and warn "2";
'
Foo: 1:Illegal division by zero at -e line 4.
Foo: 2 at -e line 4.


perl -wle '
  close STDERR;
  print "print-test:", print STDERR "foo";
  print "warn-test:", warn "bar";
'
print-test:
warn-test:1



http://www.google.com/codesearch?hl=en&lr=&q=\sor\swarn\s.*and\sreturn&sbtn=Search

http://www.google.com/codesearch?hl=en&lr=&q=\swarn\s.*and\snext&sbtn=Search

-- 
Ruud

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About