PDL2(1)

πŸ“¦ version 2.78.0, in epel 9

πŸ’… PDL2 β€” the pdl2 page, but make it make sense πŸ’…

okay so real talk, this is the manual for pdl2, the simple shell (version 2) for PDL, and it lives in the User Contributed Perl Documentation corner of your man pages. bestie, it's giving "just let me poke at PDL in a REPL" energy and honestly? iconic. πŸŽ€


✨ SYNOPSIS ✨

use PDL interactively, that's the whole vibe:

%> pdl2

pdl> $x = sequence(10)  # or any other perl or PDL command

pdl> print "\$x = $x\n";
$x = [0 1 2 3 4 5 6 7 8 9]

pdl> with_time { print +($A->matmult($B))->info, "\n" } for 1..5;

like, you just type perl and PDL stuff at the prompt and it does the thing. slay. πŸ’…


🌸 DESCRIPTION 🌸

so the pdl2 program β€” also known as the Perldl2 shell β€” is a second generation version of the original perldl interactive PDL shell. it's trying to be backward compatible in usage while also serving improved features, better support for Perl syntax, and a more easily extended framework built on the Devel::REPL shell. glow-up fr fr. ✨

if you have Devel::REPL version 1.003011 or later, then pdl2 will start with full functionality. if Devel::REPL is not installed or not found, then pdl2 will print a warning and run the legacy perldl shell command instead. no cap, that's the fallback. 🫢

by default, command lines beginning with the default prompt of either pdl2 or perldl (one of 'pdl> ', 'PDL> ', or 'perldl> ') will have the prefix string and surrounding whitespace stripped. this is lowkey the best part: it means you can easily cut-and-paste from sample PDL shell sessions or other examples straight into another PDL shell session. chef's kiss. πŸ˜­πŸ’–

for shell-like Ctrl+C handling, you need Sys::SigAction installed. that's the requirement, don't come for me. πŸ’€


πŸ”₯ FUNCTIONS πŸ”₯

πŸŽ€ do_print πŸŽ€

toggle print-by-default on and off (default value: off).

by default, pdl2 does not print the results of operations, because the results can be very large β€” e.g., a small 640x480 RGBA image is still more than 1_000_000 elements. 😭 however, for experimenting and debugging more complex structures, it helps to see the results of every operation. the do_print routine lets you toggle between the default "quiet" operation and a full Read, Evaluate, Loop style. main character behaviour honestly. πŸ‘‘

pdl> $x = pdl(3,2)

pdl> do_print
1
pdl> $x = pdl(3,2)
$PDL1 = [3 2];
pdl> do_print

pdl> $x = pdl(3,2)

see how do_print returns 1 when you flip it on, then the assignment echoes $PDL1 = [3 2];, and flipping it back (with no output) makes the next assignment quiet again? yeah. that's the whole bit. ✨


πŸ¦‹ VARIABLES πŸ¦‹

  • $PDL::toolongtoprint β€” the maximal size pdls to print (defaults to 10000 elements). and listen, this is not just a perldl or pdl2 variable β€” it's something that is usually needed in an interactive debugging session. so don't sleep on it. πŸ’œ

🌈 SEE ALSO 🌈

  • perldl
  • Devel::REPL

ngl, go read perldl if you want the legacy lore, and Devel::REPL if you want to see the framework this whole thing rides on. iykyk. 🧚

that's the page, bestie πŸ’– this one's from perl v5.32.1, dated 2022-04-11 β€” so yeah, a lil vintage, but still eating. πŸ“πŸŒ·

πŸ“¦ where this page comes from