http://www.perlmonks.org?node_id=1008571


in reply to Perl allows you to change the definition of false to make it true. (And vice versa.)

Cool! But there is only one possible response :)

BEWARE: This module is DANGEROUS! ...

ANYTHING might happen! Hell might break loose! :-)

YOU HAVE BEEN WARNED!


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong

Replies are listed 'Best First'.
Re^2: Perl allows you to change the definition of false to make it true. (And vice versa.)
by tobyink (Canon) on Dec 12, 2012 at 20:38 UTC

    I discovered the trick perusing boolean which uses it to good effect. It makes boolean expressions such as "foo" eq "bar" return boolean objects (which in turn overload boolification). The net effect is to give Perl a boolean type.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
      boolean which uses it to good effect. It makes boolean expressions such as "foo" eq "bar" return boolean objects

      Sounds like a great way to burn cycles for no good reason.

      All someone needs to do now is wrap boolean over in a Moose wrapper and we can all compute like it was 1984 :)


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

      do &maybe if boolean($value)->isTrue;

      Surely he meant:

      do &maybe if boolean( true eq boolean($value)->isTrue() )->isTrue();

      (:

      - tye