in reply to Re: XML::Twig and oodraw
in thread XML::Twig and oodraw

Thanks. I was just about to update my query with the following: ;-)

sub getDrawInfo { my ($t, $data)= @_; my $name = $data->{'att'}->{'draw:name'}; print "DEBUG name: $name\n"; print "DEBUG " . $data->text . "\n"; }

Works fine.

Replies are listed 'Best First'.
Re^3: XML::Twig and oodraw
by mirod (Canon) on Oct 09, 2009 at 15:30 UTC

    It is cleaner to use the proper method instead of relying on the implementation of the object: $data->att( 'draw:name').

    This way if I ever decide to change the implementation, your code won't break. Not that it is likely at this point, but hey, you never know, there is no promise in the documentation that the attributes be stored in the att field.