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

  • Home
  • SEARCH
  • 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 8424611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:02:36+00:00 2026-06-10T04:02:36+00:00

Currently, during debugging, I tend to insert carp Dumper \@foo, \%bar; statements into my

  • 0

Currently, during debugging, I tend to insert

carp Dumper \@foo, \%bar;

statements into my code, and regularly run into the problem that Carp and Data::Dumper are not imported in the current package. To avoid this problem, I defined the following sub in a central file that’s always included:

sub main::bla {
    use Carp; use Data::Dumper;
    carp Dumper @_;
}

So now I can do

main::bla \@foo, \%bar;

everywhere, but the main:: annoys me. Is there something like a global package that’s always imported, in any package, automatically (just like built-ins practically are imported everywhere)?

  • 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-06-10T04:02:38+00:00Added an answer on June 10, 2026 at 4:02 am

    You could just call it

    ::bla( \@foo, \%bar );
    

    In earlier days, I used to put util functions in a Ut package. And that was fine, but I noticed that my code wasn’t really as modular as I thought of it. Each module that depended on Ut functions being there could only succeed if somebody took the trouble to build that namespace.

    In the end, I considered use and require statements as simply documenting dependencies. There are more flexible ways to change what code is called by library modules, rather than changing their implementation in main.

    For example, you could do this in a single use statement.

    use Ut blah => sub { 
        use Carp; 
        use Data::Dumper;
        carp Dumper @_;
    };
    

    And define the import:

    sub import { 
        shift; # It's just me
        my ( $name, $impl ) = @_;
        if ( $name eq 'blah' && ref( $impl ) eq 'CODE' ) { 
            *blah = $_[1];
        }
        ...
    }
    

    I still use the ut pattern, when I’m developing a lot of code at once. But I don’t mind writing

    ut:dump_var( $var )
    

    as opposed to saving 3-4 characters (because sometimes I call it U::).

    Now, it appears that you don’t want to do this long term, and dumping out your variables is a useful thing for development. If you really want to do this, Smart::Comments does it like so:

    ### @foo
    ### %bar
    

    All it takes is one use statement.

    use Smart::Comments;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am doing the profiling to a piece of code. During the profiling,
Somewhere in our Ruby code, there are three lines that (currently, for debugging purposes)
here is my code SqlCommand insert_user = new SqlCommand(insert into dbo.users (username,password,firstname,lastname,address,country,city,phonenumber,gender,email) VALUES ('
I'm currently learning after a book about how to convert xaml code into objects
Newbie in C# This is my code. and during debugging i get to this
I have a problem. The current code works fine when I run it through
PhoneGap Build provides a service (currently free during beta) where they take your HTML+JS+CSS
How can I know during parsing which rule is currently matched? I'd like to
I am currently working on a simulator and encountered the following error during debug
I'm currently doing a project in C# working with windows forms. During the course

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.