Subject: | Bareword to ::Function conversion is too eager |
Hi there,
The http://perltricks.com/article/60/2014/1/13/Display-beautiful-Perl-code-in-HTML-without-JavaScript example looks great, but it demonstrates an issue with the built-in function detection being too aggressive: the 'length' hashkey (length => ... and {length}) are incorrectly highlighted as keywords rather than regular words.
The current implementation upgrades all PPI::Token::Word instances to ::Function without checking for context - suspect it's not trivial to fix:
->{length} # bareword
->{length($x)} # function
->{length $x} # function
->{length 'abc'} # function
->{length length} # both functions
LOOP: {length} # function
Maybe worth a switch to disable the function conversion? This would at least give consistent output in the example.
cheers,
Tom