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

ANNOUNCE: XML::Smart 1.0

by gmpassos (Priest)
on May 21, 2003 at 18:07 UTC ( #259824=perlnews: print w/ replies, xml ) Need Help??

XML::Smart is out!

It's a smart, easy and powerful way to access/create XML data/files.

You access/create your XML data with a HASH tree style, but any point in the tree can be a HASH, ARRAY or SCALAR at the same time, so you don't need to care about the different types in the tree, you just us the tree and XML::Smart change it, or make it works like it, for you.

Download at:


Here is an example of use:

use XML::Smart ; my $XML = XML::Smart->new('file.xml') ; ## Change the root: $XML = $XML->{hosts} ; ## Get the address [0] of server [0]: my $srv0_addr0 = $XML->{server}[0]{address}[0] ; ## Or just: my $srv0_addr0 = $XML->{server}{address} ; ## Get the server where the attibute 'type' eq 'suse': my $server = $XML->{server}('type','eq','suse') ; ## Add a new server node: my $newsrv = { os => 'Linux' , type => 'Mandrake' , version => 8.9 , address => [qw(] } ; push(@{$XML->{server}} , $newsrv) ; ## Get/rebuild the XML data: my $xmldata = $XML->data ; ## Save in some file: $XML->save('newfile.xml') ; ## Send through a socket: print $socket $XML->data(length => 1) ; ## show the 'length' in the XML header to the ## socket know the amount of data to read. __DATA__ <?xml version="1.0" encoding="iso-8859-1"?> <hosts> <server os="linux" type="redhat" version="8.0"> <address></address> <address></address> </server> <server os="linux" type="suse" version="7.0"> <address></address> <address></address> </server> <server address="" os="linux" type="conectiva" version= +"9.0"/> </hosts>

Graciliano M. P.
"The creativity is the expression of the liberty".

Replies are listed 'Best First'.
Re: ANNOUNCE: XML::Smart 1.0
by adrianh (Chancellor) on May 21, 2003 at 19:51 UTC

    I have to admit I would have found XML::MultiType a far better name than XML::Smart - since it has the same API as Object::MultiType.

    By naming it "Smart" you have all the problems of the ambiguity of "smart" as a word, and lose the people who have already figured out what Object::MultiType is.

    (sorry to be so boring :)

      And I wanted the name to reflect it as a riff on XPath. Ah well.

Re: ANNOUNCE: XML::Smart 1.0
by mirod (Canon) on May 22, 2003 at 15:45 UTC

    Your module looks very nice indeed, it is very compatible with XML::Simple, and very easy to use.

    I just have one comment: with warnings on, it keeps complaininig. That's a big problem, as it basically forces the user to turn them off.

    The 2 main kinds of warning:

    Scalar value @stat[3] better written as $stat[3] at /usr/lib/perl5/sit +e_perl/5.8.0/XML/ line 346-425 Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/si +te_perl/5.8.0/XML/Smart/ line 229.

    If you could get rid of those, that would be a great improvement.

      Thanks for the advice! Will fix in the next release...

      Graciliano M. P.
      "The creativity is the expression of the liberty".

Re: ANNOUNCE: XML::Smart 1.0
by tmharish (Friar) on Jan 18, 2013 at 08:20 UTC

    XML::Smart has not been maintained in a while now ( 8 years to be exact ).

    Please let me know if you have the time to maintain it - If not I could take over.

    I am on CPAN HERE

      Check gmpassos's page: he/she has not been here for 7 years. Try to contact him/her in a different way.
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

        Check gmpassos's page: he/she has not been here for 7 years. Try to contact him/her in a different way.

        :) It is procedure to try the most/many ways you know, although I don't hold out hope for gmpassos, he is M.I.A.

Re: ANNOUNCE: XML::Smart 1.0
by tmharish (Friar) on Jan 30, 2013 at 11:24 UTC

    Just as a note to anyone in the future who might come looking for this module:

    This module is now maintained and, as of now, bug free.

    You can contribute on GitHub

    You can use it through CPAN

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2016-06-30 23:44 GMT
Find Nodes?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...

    Results (405 votes). Check out past polls.