Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: XML::Twig output problem

by plockhart (Initiate)
on Jan 05, 2012 at 19:14 UTC ( #946458=note: print w/ replies, xml ) Need Help??


in reply to Re: XML::Twig output problem
in thread XML::Twig output problem

The output should have all ads - <nis:NISJob>...</nis:NISJob> that have a JobActiveDate of today. What I get in the output file is just the last ad - <nis:NISJob>...</nis:NISJob> in the file with today's JobActiveDate. Yup, forgot to take out some testing trash on the sub:

sub DumpOldAds { my ($twig,$nisNISJob)=@_; my $date = UnixDate("today", "%Y-%m-%d".'T00:00:00'); chomp $date; my $adate = $nisNISJob->findvalue('//JobActiveDate'); print "\n$adate -|- $date\n"; if( $adate ne $date) { $nisNISJob->delete; }; #else {$twig->flush;}; }


Comment on Re^2: XML::Twig output problem
Download Code
Re^3: XML::Twig output problem
by plockhart (Initiate) on Jan 05, 2012 at 19:54 UTC

    Make that the first ad not the last, sorry, long week. If I flush it, it deletes all the ads even though the comparison is valid to keep them!

      If I flush it, it deletes all the ads even though the comparison is valid to keep them!

      Sounds like nonsense. flush is used for printing the twig to output. If that isn't what you want, stop flushing

        I agree, it does, which is what brings me here. Not flushing I get the first ad, the remaining ads fail the comparison as the previous value of JobActiveDate is combined with it - the print $adate -|- $date proves this. Flushing nets me no ads at all. I do not understand what I have done to illicit this behavior.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://946458]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-08-22 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (145 votes), past polls