[Pdx-pm] Pointer.pm

Ovid curtis_ovid_poe at yahoo.com
Thu Mar 11 15:10:18 CST 2004


I've been playing with Pointer.pm and am trying to figure out what I
*think* should be simple.  Let's say I have a scalar with an integer:

  my $x = "foo";
  $x = 42;

Getting the string is simple:

  print pointer->of_scalar($x)->get_pointer->get_pointer->get_string;

I can't figure out how to get the 42 back, though.  The internals are
straightforward:

                sv     xpviv
  +---------------+   +-----+
  | ANY           |-->| PVX |-->(the array with the string)
  +---------------+   +-----+
  | REFCOUNT      |   | CUR |
  +---------------+   +-----+
  | FLAGS  | TYPE |   | LEN |
  +---------------+   +-----+
                      | IVX |
                      +-----+

In short, how do I get the second struct's IVX value with Pointer.pm?

Cheers,
Ovid  

=====
Silence is Evil            http://users.easystreet.com/ovid/philosophy/indexdecency.htm
Ovid                       http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/



More information about the Pdx-pm-list mailing list