Cindy,
I was having this same issue when I was also trying to run the setData() method against the XML::LibXML::Element object. As you can see from the XML::LibXML::Element and XML::LibXML::Text documentation, the setData() method only exists in the latter.
There is, however, a wrapper method for the Element class called appendTextNode( $string ) that appends the argument $string to the end of the existing text for that element. Why there is no replaceTextNode() method escapes me. But, in the meantime, it seems that in order to replace instead of append, you need to be working with a Text object--not a Element object. This is accomplished by amending your xpath expression.