Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: XML compare with a key

by haukex (Bishop)
on Apr 02, 2019 at 12:40 UTC ( #1232002=note: print w/replies, xml ) Need Help??


in reply to Re: XML compare with a key
in thread XML compare with a key

XML::Simple

From its docs:

PLEASE DO NOT USE THIS MODULE IN NEW CODE.

See also XML::Simple needs to go!, among others.

Replies are listed 'Best First'.
Re^3: XML compare with a key
by hdb (Monsignor) on Apr 02, 2019 at 12:42 UTC

    I am getting tired by being pointed to this comment each and every time. For such simple stuff the module is still useful.

    And anyways, the OP will reply that (s)he does not want to install any module, see earlier questions... Re^4: XML file difference highlights

      For such simple stuff the module is still useful.

      I agree that the module can still be used for very simple cases, like reading simple config files in a known format (Update: although there are better modules available, such as XML::Rules). However, we don't know if the OP's actual XML really is as simple as the example shown in the root node, therefore whether it will work at all (see code below), and you also didn't mention any of the major caveats associated with that module, which is why I posted my comment.

      use warnings; use strict; use Data::Dump; use XML::Simple qw/:strict XMLin/; dd XMLin('<root><x><y>Foo</y></x></root>',ForceArray=>[],KeyAttr=>[]); dd XMLin('<root><x y="Foo"></x></root>', ForceArray=>[],KeyAttr=>[]); __END__ { x => { y => "Foo" } } { x => { y => "Foo" } }

        I am looking forward to your answer to the OP's question based on XML::Rules. In the meantime, I will see whether I can get it installed, a simple cpan install XML::Rules failed on my machine.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2021-06-16 01:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (74 votes). Check out past polls.

    Notices?