I had the same question. I suspect the examples above are abstracted from a more complex real-world problem. In what situation is this useful? (Code-generating code? Code with major side effects?)
And for the record, I also think "code_is" or "code_eq" would be better. Or, if you're using B::Deparse, perhaps even "deparse_eq" as that's really the most descriptive of what you're doing (i.e. comparing the parse tree of two separate pieces of code) as opposed to seeing if two code_refs point to the same piece of code or anything along those lines.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In reply to Re^2: Test::Code
by xdg
in thread Test::Code
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |