pdl2(3pm)
π¦ pdl2 β it's giving "simple shell (version 2) for PDL" π
okay bestie, listen. this is pdl2(3pm), a User Contributed Perl doc, and it's basically the group chat where you and PDL hang out interactively. let's get into it β¨
β¨ SYNOPSIS β¨
so like, you wanna use PDL interactively? say less:
%> 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;
look at her go. main character energy fr fr π
π DESCRIPTION π
The pdl2 program β also known as the Perldl2 shell, iykyk β is the second generation version of the original perldl interactive PDL shell. she's the glow-up version π. she tries to stay backward compatible in usage while bringing improved features, better support for Perl syntax, and a framework that's way easier to extend, built on top of the Devel::REPL shell.
here's the tea tho: if you have Devel::REPL version 1.003011 or later, then pdl2 starts up with full functionality, no cap π₯. but if Devel::REPL isn't installed or can't be found? pdl2 prints a warning and just runs the legacy perldl shell command instead. the show must go on π
now, by default, command lines that begin with the default prompt of either pdl2 or perldl β that's one of 'pdl> ', 'PDL> ', or 'perldl> ' β will have that prefix string and the surrounding whitespace stripped right off. why do we care? because it lets you easily cut-and-paste from sample PDL shell sessions or other examples straight into another PDL shell session. obsessed with the convenience honestly π«Ά
and for shell-like Ctrl-C handling? you need Sys::SigAction installed. that's the whole vibe check on that one.
πΈ FUNCTIONS πΈ
π do_print
Toggle print-by-default on and off (default value: off)
so here's why this matters, bestie: by default, pdl2 does not print the results of operations, because those results can be very large (like, a small 640x480 RGBA image is still more than 1_000_000 elements. yeah. a million. π). but when you're experimenting and debugging more complex structures, it genuinely helps to see the results of every single operation. the do_print routine lets you toggle between the default "quiet" operation and a full Read, Evaluate, Loop style. periodt β¨
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 the vibes shift? π
π VARIABLES π
$PDL::toolongtoprintβ the maximal size pdls to print (defaults to10000elements). and heads up, this is not just aperldlorpdl2variable β it's something that's usually needed in an interactive debugging session. so she's a whole independent icon π
β SEE ALSO β
perldlDevel::REPL
ngl bestie, that's the whole page. no missing pieces, no skipped sections, we kept every crumb π
and that's a wrap on pdl2(3pm) from the User Contributed Perl Documentation, sitting pretty at perl v5.38.2, dated 2024-04-10. mwah π
β¨π
π¦ where this page comes from
- ubuntu noble: pdl 1:2.085-1ubuntu1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms