Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there an equivalent to the perl debugger 'x' in pdl2 (or Devel::REPL)?
    text
    copied!<p>I am using <code>pdl2</code> (the <a href="http://p3rl.org/PDL" rel="nofollow"><code>PDL</code></a> shell) also as a my default Perl interactive shell (it loads all the nice plugins for <a href="http://search.cpan.org/perldoc/Devel%3a%3aREPL" rel="nofollow"><code>Devel::REPL</code></a>). But I am missing the <code>x</code> dumper-printing alias. <code>p</code> is nice for piddles but it does not work for a normal array ref or hash ref. I have loaded <a href="http://p3rl.org/Data%3a%3aDumper" rel="nofollow"><code>Data::Dumper</code></a> but it lacks an easy way of controlling depth and I like the way you can quickly set depth limits with <code>x</code>, e.g. <code>x 2 $deep_datastruct</code> for complex data structures. But with <code>Data::Dumper</code> the process is more cumbersome:</p> <pre><code>pdl&gt; say $c HASH(0x53b0b60) pdl&gt; p $c HASH(0x12b14018) pdl&gt; use Data::Dumper pdl&gt; p Dumper $c $VAR1 = { 'c' =&gt; { 'c' =&gt; 3, 'a' =&gt; 1, 'b' =&gt; { 'c' =&gt; '3', 'a' =&gt; '1', 'b' =&gt; '2' } }, 'a' =&gt; 1, 'b' =&gt; 4 }; pdl&gt; $Data::Dumper::Maxdepth = 1; pdl&gt; p Dumper $c $VAR1 = { 'c' =&gt; 'HASH(0x97fba70)', 'a' =&gt; 1, 'b' =&gt; 4 }; </code></pre> <p>In the Perl <a href="http://p3rl.org/debug" rel="nofollow">debugger</a> you can achieve the same thing with <code>x 1 $c</code> directly. Does <code>pdl2</code> have something similar and so concise?</p> <p><strong>[update]</strong> And related with this question: does <code>pdl2</code> or <code>Devel::REPL</code> have convenience functions like the Perl debugger commands <code>m</code> or <code>y</code>? Or should one create a module with <a href="http://search.cpan.org/perldoc/PadWalker" rel="nofollow"><code>PadWalker</code></a> and export them? I would like to use a real REPL instead of the Perl debugger as an interactive shell, but still the Perl debugger has some important things that I don't know how to do with <code>Devel::REPL</code> or <code>pdl2</code>.</p> <p>For example to see all variables (<code>pdl2</code> only show piddles):</p> <pre><code>pdl&gt; help vars PDL variables in package main:: Name Type Dimension Flow State Mem ---------------------------------------------------------------- no PDL objects in package main:: </code></pre> <p>By the way, does someone know a <code>Devel::REPL</code> plugin for listing all the variables in use (like <code>y</code> in the debugger, but only the names, not the values) and then have a <code>x</code>-like to dump the wanted one?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload