Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Bug with globals.txt and 'sub'

Quote Reply
Bug with globals.txt and 'sub'
It seems the 2.1.0 parser is quite particular that only one space be left between "sub" and the "{" in the globals area. 2 or more spaces, and rather than parsing out the sub, it prints the subroutine.

Code:
"sub {" works, but "sub {" will not.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Bug with globals.txt and 'sub' In reply to
The code uses index() which checks that the first 5 characters match sub { exactly.

Normally you only type sub - space - { so it shouldn't be a problem unless you accidentally type a few spaces.
Quote Reply
Re: [pugdog] Bug with globals.txt and 'sub' In reply to
Hi,

It was a performance trade off as index's are signifcantly faster then regex's, so we force you into an exact match.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Bug with globals.txt and 'sub' In reply to
Shouldn't that be something that the code checks when it stuffs it into the hash? ie: during edit mode? It has to escape the quotes, shouldn't it check that as well? That is done in "real time" and making sure that the 'sub {' string is set that way would eliminate a lot of errors and frustrations with no performance hit at run time.

That is a really obscure bug to try to catch!


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.