in reply to piggy back infos on a string scalar

There is perhaps Variable::Magic? It even has an example "useful for passing user data through limited APIs".

Caveat: "Magic is not copied on assignment." So whether this technique works for you depends on what your third party module does with the string.

  • Comment on Re: piggy back infos on a string scalar

Replies are listed 'Best First'.
Re^2: piggy back infos on a string scalar
by LanX (Saint) on Feb 23, 2023 at 22:57 UTC
    Thanks, I already tested the overload approach and it works fine ... at least for the time being.

    The third party module is DBI and it's the statement string with attached debug infos.

    When inspecting $sth->{Statement} I can see the original object while $sth = $dbh->prepare($stmt_obj) processed the stringification.

    (Alas it's a bit more complicated since DBI depends on driver implementations which may differ, I already stumbled over things which are different for MySQL than documented, so testing and adjusting might be needed.)

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery