|Perl Monk, Perl Meditation|
Compare CODEby PetaMem (Priest)
|on Dec 11, 2012 at 11:22 UTC||Need Help??|
PetaMem has asked for the
wisdom of the Perl Monks concerning the following question:
Given two coderefs. Is there an (elegant) way to compare the code they're pointing to?
No, I don't need any fancy stuff like solving the halting problem. ;-) I do not even need to know if the code is equivalent. It would be completely sufficient if these
Would be considered "same". Ideally with the whitespaces being irrelevant. All mutations, invariants etc. can safely be considered 'different'. i.e.
To sum up: It would be sufficient to have a function that - for two given coderefs (pointing to different addresses) - would just return "identic" if they'd be the same list of opcodes.
Howto? B:: something?
Thank you for your guidance.