szabgab has asked for the wisdom of the Perl Monks concerning the following question:
Given a function using signatures like this:
I am looking for a way to list the variables it is expecting during run time. Using the solution from this post usinguse strict; use warnings; use 5.020; use feature 'signatures'; no warnings 'experimental::signatures'; sub hello($name, $age) { print "$name\n"; }
I managed to write some code that works for me that I can turn into a CPAN module, but I wonder if there is already one that does that and I missed it?B::Deparse->new->coderef2text(\&hello);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Introspecting function signatures
by LanX (Saint) on Mar 05, 2021 at 15:53 UTC | |
Re: Introspecting function signatures
by dave_the_m (Monsignor) on Mar 05, 2021 at 20:31 UTC | |
by szabgab (Priest) on Mar 05, 2021 at 21:29 UTC | |
by dave_the_m (Monsignor) on Mar 05, 2021 at 22:03 UTC | |
by szabgab (Priest) on Mar 06, 2021 at 13:57 UTC | |
by Corion (Patriarch) on Mar 06, 2021 at 14:51 UTC | |
| |
by LanX (Saint) on Mar 06, 2021 at 15:09 UTC | |
| |
Re: Introspecting function signatures
by Bod (Parson) on Mar 06, 2021 at 22:55 UTC | |
by szabgab (Priest) on Mar 07, 2021 at 05:43 UTC |
Back to
Seekers of Perl Wisdom