You create a new object by calling the "new" operator
$state = PDL::Graphics::State->new();
Then for each new command you call "add" on this object so that for a call to "line" of the form
line $x, $y, $opt;
the call to "add" would be like
$state->add(\&line, 'line', [$x, $y], $opt);
which is stored internally as:
[\&line, 'line', [$x, $y], $opt]
The state can later be extracted using "get" which returns the state object which is an array of
anonymous arrays like the one above where the first object is a reference to the function, the second an
anomymous array of arguments to the function and finally an anonymous hash with options to the command.
If you know the order in which you inserted commands they can be removed by calling "remove" with the
number in the stack. No further interaction is implemented except "clear" which clears the stack and
"copy" which returns a "deep" copy of the state.