Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

RE: Confusion ,XML::SIMPLE with DATA:DUMPER

by ultibuzz (Monk)
on Nov 24, 2006 at 08:11 UTC ( #585832=note: print w/ replies, xml ) Need Help??


in reply to Confusion ,XML::SIMPLE with DATA:DUMPER

i want a third value to be printed out, so i set it up in the root

use strict; use warnings; use XML::Twig; use File::Spec; use POSIX qw(strftime); my $spec_text = qr/^SLD/; my $path_tmp = $0; (my $volume,my $directories,my $file) = File::Spec->splitpath( $path_t +mp ); my $path = $volume . $directories; opendir (DIRREN, $path) || die ; my @RENDIR = readdir (DIRREN); close (DIRREN); shift(@RENDIR); shift(@RENDIR); open(OUT,'>','out.txt'); foreach my $file (@RENDIR) { if ($file =~ $spec_text){ my $mode = (stat($file))[9]; my $file_date = strftime "%Y%m%d", (localtime($mode)); my $file_date_ref = \$file_date; my $file_ref = \$file; XML::Twig->new( # the twig will only contain PHONENO/ENTRY and + REASON/ENTRY elements # (plus the root or it would not be a tree) twig_roots => { 'BL_USER/PHONENO/ENTRY' => 1, 'BL_DPLI_RECORD/REASON/ENTRY' +=> \&reason, 'BL_DPLI_RECORD/BL_DP_DUNNED/M +ONETARYVALUE/V' => 2, } ) ->parsefile($file); sub reason { my( $t, $reason)= @_; foreach my $phone_no ($reason->prev_siblings) { print OUT $phone_no->text , ";" , $reason->text , "; +" , $$file_ref , ";" , $$file_date_ref ,";",$reason->next_siblings, " +\n"; } $t->purge; } } } close(OUT);

with next_siblings i want to access the value but didn't work
when i set the root tu => 1 its printet out like an element of phone number
so whats wrong in my mind, whats screwed up ?

kd ultibuzz


Comment on RE: Confusion ,XML::SIMPLE with DATA:DUMPER
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2014-11-27 02:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (178 votes), past polls