in reply to XML Simple
You are executing (-e) an always-return-true mini Perl program (what is inside the doublequote) but loading some module (after the -M ) before runnig the code. You obviosly get:perl -MNot::Installed::Module -e "1"
You can install modules using the cpanp client (working in the strawberry Perl distro on which DWimPerl is built)Can't locate Not/Installed/Module.pm in @INC (@INC contains:...
Choose carefully module to install and use: XML::Simple is simply deprecated. Other modules are better but you need to learn how to use them: the following, working, code uses XML::Twig for xml parsing: anyway, even if you use a good module, xml parsing is a little triky and shaggy thing.cpanp -i Not::Installed::Module
#!perl use strict; use warnings; use XML::Twig; my $t= XML::Twig->new(pretty_print => 'indented', twig_handlers => { 'city/name'=>sub{ print $_[1]->text,"\n"; } +, 'city/population'=>sub{ print "Pop: ",$_[1] +->text,"\n"; }, } ); $t->parseurl('http://athome.myminicity.com/xml'); __OUTPUT__ AtHome Pop: 18998557
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: XML Simple
by karlgoethebier (Abbot) on Jun 07, 2015 at 07:47 UTC | |
Re^2: XML Simple
by Arenas (Novice) on Jun 01, 2015 at 20:23 UTC | |
Re^2: XML Simple
by Arenas (Novice) on Jun 05, 2015 at 08:38 UTC |