Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: XML::XPath=HASH(0x10c4e230) is persistent

by kcott (Chancellor)
on Oct 02, 2012 at 00:09 UTC ( #996773=note: print w/replies, xml ) Need Help??

in reply to XML::XPath=HASH(0x10c4e230) is persistent

G'day medirecpr,

You don't show any code where you print $sesxp; however, this looks suspect:

my $sesxp = XML::XPath->new(otherfilename => $SESXML); print 'SESXML: ' . $xp . "\n";

Should that print statement contain $sesxp instead of $xp?

Aside: I might just also point out that print takes a list of arguments - there's no need to concatenate the arguments. This would be fine:

print 'SESXML: ', $xp, "\n";

Or, removing most of the punctuation noise, you could just write:

print "SESXML: $xp\n";

-- Ken

Replies are listed 'Best First'.
Re^2: XML::XPath=HASH(0x10c4e230) is persistent
by medirecpr (Novice) on Oct 02, 2012 at 11:26 UTC
    Thanks Ken, anything on the errors? Regards,
      "... anything on the errors?"

      You tell me. What have you investigated?

      • /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/ is on your computer. What's happening at line 474?
      • /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/XML/ is on your computer. What's happening at line 187?
      • /home/jramirez/PayerDownload/SES/backup/ is on your computer. What *xml files did you `find ...` there?
      • You've invoked find(...) methods. Was anything found? If so, was that data suitable for chaining to subsequent methods? Again, this is data on your computer.

      I also see that you've changed your OP without indicating an update. I don't actually know if I'm responding to the original or some later modification.

      -- Ken

        Yes Ken, I worked on it. I may be posting my progress wrong, appologies for that. I really do appreciate the forum and am working hard at learing perl. I fixed the XPATH construct, from your response I found that I was mixing my $xp with $sesxp.

        From there, I noticed that the errores were spurting something about "Use of uninitialized value in subroutine entry at..." Which sounded like a problem with the XML itself. Turns out that the problem was that the grep was returning two files. So I fixed that by modifying the construct to make sure only one possible result.

        I got past that, got a different error.. "Unsuccessful stat on filename containing newline at..", So I chomped it!

        I'm loving this! Going through the motions really does help. Really appreciate the help!

Re^2: XML::XPath=HASH(0x10c4e230) is persistent
by medirecpr (Novice) on Oct 02, 2012 at 21:31 UTC

    I noticed your point on the print $xp. I changed the code, and now I get a different hash. But I still get the same errors:

    Use of uninitialized value in subroutine entry at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/XML/Parser/ line 474.


    no element found at line 1, column 0, byte -1: 20^ 6985936 at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/XML/ line 187

    Is there a particular way to open a second XML file for XPATH?

Re^2: XML::XPath=HASH(0x10c4e230) is persistent
by medirecpr (Novice) on Oct 02, 2012 at 22:32 UTC
    Oh Ken, you are the best! Your silence made me look at my code with religious intent... I figured it out. I CHOMPED out the result from my grep and tada! I updated the code in case you care to see. In summation, this script can open up an XML, parse for info, save to variables... then it uses the variables to construct a search string. THEN, it uses that search string to bash grep another XML file in a diff directory with diff format and XPATH parse it at will. THANKS AGAIN MONKS!

      From your timezone, we appear to be on almost opposite sides of the planet: my "silence" was probably due to being asleep. :-)

      You'll learn a lot more by resolving issues yourself. In this instance, you were clearly capable of doing this; so let's hope you've gained something from the experience. At the very least, I detect happy feelings from achieving a positive outcome from the exercise.

      With regards to updating your code, that's at least two modifications to your OP without any indication (in your OP) of having done so. In future, please clearly show where you have made changes.

      -- Ken

        I agree. I am gaining, and have achieved outcomes. Will look into the OP. Thank you!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://996773]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2018-05-27 09:00 GMT
Find Nodes?
    Voting Booth?