Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1003211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:56:42+00:00 2026-05-16T07:56:42+00:00

Right now I can name the subroutine printargs as follows to get the dump.

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:56:42+00:00Added an answer on May 16, 2026 at 7:56 am

    To dump a single subroutine you can use

    B::Concise::compile($sub)->()
    

    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:

    no strict 'refs';
    for my $k (keys %{"$pkgname\::"}) {
        if (*{${"$pkgname\::"}{$k}}{CODE}) {
            print "$k\n"; # sub name
        }
    }
    

    Update: my first line contained a mistake, which is fixed
    now. And here is the complete example script:

    package Blah;
    
    sub x { return "x"; }
    sub hehe { print 2*2, "\n"; }
    sub meme { die "ouch" }
    
    our $varvar; # to illustrate the {CODE} thingy
    
    package main;
    use warnings;
    use strict;
    use B::Concise;
    
    my $pkgname = "Blah";
    no strict 'refs';
    for my $k (keys %{"$pkgname\::"}) {
        if (*{${"$pkgname\::"}{$k}}{CODE}) {
            my $sub = \&{${"$pkgname\::"}{$k}};
            print "Dump of $pkgname\::$k():\n";
            B::Concise::compile($sub)->();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get multipass texturing work for me but right now i can
My app is using htmlagility pack. As of right now I can get all
Right now the library can translate this operation Select * from List where name
Right now I can use this URL to request a Google Static Maps image
Right now I can run a PHP script from my Mac terminal like echoing
I have a website and right now users can just open a directory and
This has probably something to do with my transformations, but right now I can't
I'm playing around with associative arrays right now and I can't seem to figure
I'm pretty much at wits end right about now and can't seem to figure
right_now = datetime.datetime.now() one_hour_before = ????? How can I use right_now to get one_hour_before?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.