in reply to Re^5: Monkey patching all subs with a basic 'starting subname' message
in thread Monkey patching all subs with a basic 'starting subname' message

I thought the first case was a closure variable. i.e.

The thing is, I can only see how I might get the output of prototype into the string and not the closure. i.e.

Am I missing something obvious?

Replies are listed 'Best First'.
Re^7: Monkey patching all subs with a basic 'starting subname' message (trace  perldebugger)
by LanX (Saint) on Jul 18, 2017 at 13:44 UTC
    > sub HOW_DO_I_GET_$original_proto_IN_HERE? {

    AFAIK it's only possible via eval, if you think you've already delegated the maximum possible into closures, you should be fine.

    I'm sure if you dig long enough into CPAN you'll find some (semi-) official hack to change the prototype.

    YMMV.

    Good luck

    PS: Hope you're already aware of the trace options in perldebug

    frame Affects the printing of messages upon entry and exit from subroutines. + If frame & 2 is false, messages are printed on entry only. (Printing + on exit might be useful if interspersed with other messages.) If frame & 4 , arguments to functions are printed, plus context and ca +ller info. If frame & 8 , overloaded stringify and tied FETCH is enab +led on the printed arguments. If frame & 16 , the return value from t +he subroutine is printed. The length at which the argument list is truncated is governed by the +next option:

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      > Hope you're already aware of the trace options in perldebug

      I am now; and that, of course, is what I needed at the time!

      I am enlightened! Thanks.

Re^7: Monkey patching all subs with a basic 'starting subname' message
by Corion (Patriarch) on Jul 25, 2017 at 12:05 UTC

    I just now noticed Sub::Metadata, which allows you to retrieve (and manipulate) the prototype (but not the signature) of a subroutine. Maybe that one could help you here.

    The module claims to work even with Perl 5.6, so most Perl versions should be supported.