in reply to Mock+ object with recording?

Ideas: (edited to include AUTOLOAD)

A reasonable strategy for the key might be to shift $self from @_ and convert the array to canonical JSON (adding object serialization TO_JSON calls as needed). The value could be handled similarly.

AUTOLOAD seems like the right hook for simplifying the interposition. Basically make both the record and replay objects have only AUTOLOAD methods, which then dispatch to the sub-object in the record case and only convert the key and look for the stored value.

"Impersonation" might be as simple as overloading isa()?

.

Maybe I have enough pieces to play around with this, but any advice is still greatly appreciated.

Replies are listed 'Best First'.
Re^2: Mock+ object with recording?
by choroba (Cardinal) on Nov 30, 2017 at 11:13 UTC
    > should be possible with MOP

    Or maybe just AUTOLOAD?

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,