in reply to Re: Why XML::Smart model can't work
in thread Why XML::Smart module can't work
Yes, after inserting print Dumper $XML_1, i got the ojbect, but why i can't print $ref?
My really intention is to parse the result of get request and print the result i wanted into a .csv file.the result i got is#!/usr/bin/perl use XML::Smart; use Data::Dumper; use warnings; use strict; my @array = (); my %data = (); open OUTFILE, '>result2.csv' or die $!; open FILE, 'fund.txt' or die $!; while (<FILE>) { chomp; my $XML = XML::Smart->new("http://cmsbeta.morningstar.com/api/v2 +/2008428323/securities/$_"."/documents?colids=590&fields=*"); print Dumper $XML; eval{ %data = %{$XML->{Document}->{Content}->{People}}; }; for my $li (keys %data){ print "$li:$data{$li}"."\n"; push (@array,$data{$li}); } print OUTFILE ("$_,","@array"."\n"); @array = (); } close(OUTFILE); close(FILE); exit;
I still got nowhere.I can use XML::Simple to finish the similar task, but i think XML::Smart is more cool so i want to try it.C:\Users\rchen4\Desktop\Perl_XML>perl parse_prepare.pl Use of uninitialized value $data in pattern match (m//) at C:/Dwimperl +/perl/site /lib/XML/Smart/Tree.pm line 169, <FILE> line 1. $VAR1 = bless( do{\(my $o = bless( { 'tree' => {}, 'a' => [], 'TIEONUSE' => { 'h' => 'XML::Smart::Tie::Has +h', 'a' => 'XML::Smart::Tie::Arr +ay' }, 'parser' => '', 's' => \sub { "DUMMY" }, 'c' => sub { "DUMMY" }, 'point' => ${$VAR1}->{'tree'}, 'h' => {}, 'g' => \*Object::MultiType::Saver::NULL, 'b' => \sub { "DUMMY" } }, 'Object::MultiType::Saver' ))}, 'XML::Smart +' );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Why XML::Smart model can't work
by Anonymous Monk on Dec 18, 2013 at 02:59 UTC | |
Re^3: Why XML::Smart module can't work
by Random_Walk (Prior) on Dec 18, 2013 at 09:09 UTC | |
by sanguine_perl (Initiate) on Dec 19, 2013 at 05:05 UTC |
In Section
Seekers of Perl Wisdom