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 6123145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:58:53+00:00 2026-05-23T15:58:53+00:00

combining Is there an equivalent to the perl debugger 'x' in pdl2 (or Devel::REPL)?

  • 0

combining

Is there an equivalent to the perl debugger 'x' in pdl2 (or Devel::REPL)?

and

How can I list all variables that are in a given scope?

I have created my perldlrc like

use feature ':5.10';
use Data::Dumper;
use PadWalker qw/peek_our peek_my/;


sub x {
  my $depth = shift||0;

  $Data::Dumper::Maxdepth = $depth;
  print Data::Dumper->Dump([@_])
}


sub lvars {
    my $vars = in_scope_variables();

    print Dumper [keys %$vars];
}

sub in_scope_variables {
    my %in_scope = %{peek_our(1)};
    my $lexical  = peek_my(1);
    for my $name (keys %main::) {
        my $glob = $main::{$name};
        if (defined ${$glob}) {
            $in_scope{'$' . $name} = ${$glob};
        }

        if ( @{$glob}) {
            $in_scope{'@' . $name} = [@{$glob}];
        }

        if (%{$glob}) {
            $in_scope{'%' . $name} = {%{$glob}};
        }
    }

    #lexicals hide package variables
    while (my ($var, $ref) = each %$lexical) {
        $in_scope{$var} = $ref;
    }
    return \%in_scope;
}

Then I start pdl2 but the methods do not work:

$ pdl2
pdl> $xx=in_scope_variables()
Runtime error: You can't FIRSTKEY with the %~ hash at (eval 254) line 38

pdl> lvars
Segmentation fault

If I commented the loop

# for my $name (keys %main::) {
#     [...]
# }

Then only lvars fail:

pdl> $xx=in_scope_variables()
pdl> lvars                   
Segmentation fault

But if I run the code directly in the pdl2 shell it works

pdl> $xx=in_scope_variables()
pdl> x 1, $xx        
$VAR1 = {
          '$_REPL' => 'REF(0x19999708)'
        };
pdl> print Dumper [keys %$xx];  
$VAR1 = [
          '$_REPL'
        ];

Do someone have any idea why this two errors happens?

Is that a pdl2 problem a Devel::REPL problem or me doing something stupid?

I am using perl 5.12 and Perldl2 Shell v0.005

  • 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-23T15:58:54+00:00Added an answer on May 23, 2026 at 3:58 pm
    • SOLVED the segmentation fault:

    I have updated my one year old PadWalker version and now with the
    PadWalker-1.92 it works ok.

    Unfortunately I didn’t write down my version before updating, so I can not report with which version I had problems.

    • Still pending the error in the capture of the %main:: variables:

      Runtime error: You can’t FIRSTKEY with the %~ hash at (eval 254) line 38

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a common method/best practice/any means for combining forms that span multiple related
Is there a FOSS batch compiling solution for Delphi that takes version as an
Is there a good way to write F# scripts that execute stand-alone without compiling?
Is there a Java equivalent to PHP's mysql_real_escape_string() ? This is to escape SQL
My Questions is Is there any regular expression engine that does Just-In-Time compiling during
Is there a use for combining **kwargs and keyword arguments in a method signature?
There is a example: Combining JQuery Form Validation and Ajax Submission with ASP.NET by
Hi Is there any elegant way of combining 'like' and 'or' when i'm using
Is there a library call that would allow for sending/receiving of variable sized messages
I have some ideas for software that can create HDR images or panoramas. I'd

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.