in reply to freaky deaky plus sign usage

This is to get around Perl's 'indirect object syntax'.

Otherwise
   ok Mock::Basic->update(...);
looks like
   Mock::Basic->ok->update(...);
which is probably not what is intended.

ok(Mock::Basic->update(...)); works as well.

Replies are listed 'Best First'.
Re^2: freaky deaky plus sign usage
by metaperl (Curate) on Jul 31, 2009 at 18:37 UTC
    ok, and how does + "get around" it? What exactly is syntactically happening? Is "ok" being added to "Mock::Basic->update(...)"
        The search terms above don't seem to match any node. Anyone got a clue?

        unary-plus does NOT numify. 0+ does not get called.

        - ikegami

      perl -MCGI -MTest::More -e " ok 1; ok +CGI->new, +CGI->new; ok scalar +CGI->new; ok( CGI->new ); ok CGI->new; " ok 1 ok 2 - CGI=HASH(0x1a08a30) ok 3 ok 4 Undefined subroutine CGI::ok at -e line 1 # Tests were run but no plan was declared and done_testing() was not s +een.