Want true instantiated objects from XML

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I've had a need for this at points in the past, but was always able to
code around it (and still could even now), but I'd really like to be
able to do this, and I can't find anything out there that does this
exactly as I want.  (Which tends to make me believe what I want
wouldn't be as immediately useful as maybe I would think it to be,

Given an object defined as this:

package Person;

use strict;
use warnings qw( all );

sub new {
   my $proto = shift;
   my $class = ref $proto || $proto;
   my %attrs = @_;
   my $self = {};

   # Nevermind the error checking for attributes right now.

   $self-> = $attrs;
   $self-> = $attrs;

   bless $class, $self;

   return $self;

# RW attributes.

sub name { $s = shift; $s-> = shift if @_; return $s-
Quoted text here. Click to load it
sub age { $s = shift; $s-> = shift if @_; return $s-> }

# Methods.

sub sayName { print "My name is: " . shift-> . "\n" }
sub sayAge { print "I am " . shift-> . " years old.\n" }


I want to be able to read the following XML and create instances of
Person from each instance in the XML:

   <Person name="John Doe" age="22" />
   <Person name="Jane Doe" age="23" />
   <Person name="Maxx Doogan" age="10" />

So I get an array of Person objects which I can then write:

my @people; # Hold the array of Person object created from the XML

for my $person (@people) {

I've looked through SOAP::Lite (and SOAP::Serialize and
SOAP::Deserialize).  I'm a fairly frequent user of XML::Simple, but
Simple doesn't do the above (AFAIK).  SURELY *something* like this is
"out there" (read "CPAN") but I can't seem to find it; only things
close to it (like SOAP::SOM objects that require an xpath of sorts and
my methods are still not available through an instantiated method of
just the data [object attributes] in XML.)


Site Timeline