Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Quickly changing a function under test in Test::More

by fizbin (Chaplain)
on Mar 09, 2006 at 14:52 UTC ( #535399=note: print w/replies, xml ) Need Help??

in reply to Quickly changing a function under test in Test::More

Others have already pointed you at the appropriate references (which you should now go read), but the basic reason is that this:
is really (for some values of "really") this:
It's just that perl allows you to omit the -> bit when you have two adjacent sets of parentheses, braces, or brackets. This phenomenon can be seen be using Deparse:
$ perl -MO=Deparse -e 'print $a{funclist}[0](4);' print $a{'funclist'}[0](4); -e syntax OK $ perl -MO=Deparse -e 'print $a{funclist}->[0]->(4);' print $a{'funclist'}[0](4); -e syntax OK
See how the output code is the identical? That means that the input code was parsed identically. (or that you've stumbled onto one of the obscure bugs in Deparse)

However, in you test code you don't have two adjacent sets of delimiters, so you aren't allowed to omit the -> bit. Use $func->($param), as other posters have already said.

@/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://535399]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2022-08-10 05:49 GMT
Find Nodes?
    Voting Booth?

    No recent polls found