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:$commands{$cmd}{function}($param)
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:$commands{$cmd}->{function}->($param)
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)$ 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
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@/
In Section
Seekers of Perl Wisdom