State(3pm)
π NAME π
State β a package to keep track of plotting commands. That's it, that's the whole vibe. β¨
π SYNOPSIS π
use PDL::Graphics::State;
π¦ DESCRIPTION π¦
Okay bestie, so this is a very simple package β like, at present it's almost trivial β and its whole job is keeping track of the current set of plotting commands. That's the assignment. It's giving humble. π
πΈ USAGE πΈ
β¨ making a whole new state object β¨
You create a new object by calling the new operator:
$state = PDL::Graphics::State->new();
Slay. You have a state now. π
π« adding commands π«
Then, for each new command, you call add on this object. So like, for a call to line that looks like this:
line $x, $y, $opt;
your call to add would look like this:
$state->add(\&line, 'line', [$x, $y], $opt);
and that gets stored internally as:
[\&line, 'line', [$x, $y], $opt]
Not me getting emotional over an anonymous array. π
π«Ά getting the state back out π«Ά
The state can later be extracted using get, which returns the state object. And that state object is an array of anonymous arrays β just like the one above β where:
- the first object is a reference to the function,
- the second is an anonymous array of arguments to the function,
- and finally an anonymous hash with options to the command.
π§ removing stuff (but only if you remember the order) π§
If you know the order in which you inserted commands, they can be removed by calling remove with the number in the stack. iykyk β the order is literally the whole key here. π
β that's genuinely all, no cap β
No further interaction is implemented except:
clearβ clears the stack π§Ήcopyβ returns a "deep" copy of the state πͺ
That's the entire menu. Iconic minimalism, honestly. π
π AUTHOR π
Jarle Brinchmann (jarle@astro.ox.ac.uk) after some prodding by Karl Glazebrook. π
All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file.
okay that's the whole page, bestie β this was State(3pm) from perl v5.38.2, dated 2024-04-10. go forth and keep track of those plotting commands, main character. πβ¨π
π¦ 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