Right now I can name the subroutine printargs as follows to get the dump.
perl -MO=Concise,printargs,-main,-terse Hello.pl
Assuming I have several subroutines, how can I build a generic module to dump details for all subroutines?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To dump a single subroutine you can use
where $sub is the reference to a sub.
If you know the list of the subs in advance,
you are done, just do the above for each of them.
Otherwise, to get the list of existing subroutine names
in a specific package, you can always walk the symbol
table for that package:
Update: my first line contained a mistake, which is fixed
now. And here is the complete example script: