|Subject:||Devel::Declare occasionally corrupts __LINE__|
|Date:||Mon, 16 Apr 2012 17:19:12 -0700|
|To:||"bug-Devel-Declare [...] rt.cpan.org" <bug-Devel-Declare [...] rt.cpan.org>|
|From:||Philip Thomas <pthomas [...] juniper.net>|
The attached example creates a Devel::Declare keyword 'fun', which does nothing in the callback, and a sub called 'fun' that simply returns its argument. A closure is created inside a single-iteration for-loop, which is executed immediately, and prints its __LINE__ correctly. Finally, an identical (modulo the suffix) closure is created, and is passed through fun before being executed. This produces incorrect output, indicating that __LINE__ moved back to the line with the for loop. If the call to Devel::Declare->setup_for(...) is commented out, then both closures print the correct line number. If the for-loop is commented out (leaving the body intact), then both closures print the correct line number. Tested with Devel::Declare 0.006011 and perl v5.14.1 built for x86_64-linux-thread-multi. Phil
Message body is not shown because sender requested not to inline it.