in reply to XML::Smart - Development in final stage. (beta is out)

By an astonishing coincidence, in the last 24 hours Aaron Swartz released a Python module that works in almost the same way - and his module name is almost an anagram of yours. :)

I was looking around because I was wondering about implementing a Perl equivalent. Glad to see I don't have to! The thing that threw me the most, though, was how to have an object that you can access as both a hash and an array (and anything else) - how'd you do that?

-- Yoz

  • Comment on Re: XML::Smart - Development in final stage. (beta is out)

Replies are listed 'Best First'.
Re: Re: XML::Smart - Development in final stage. (beta is out)
by gmpassos (Priest) on May 13, 2003 at 15:42 UTC
    how'd you do that?

    See the module Object::MultiType (link in the main node). To make it work I have used overload, where you can use methods to return the value of an object when it's accessed as ${}, @{}, %{}, &{}, *{}, and other ways (see the overload POD).

    I have used a Saver object inside the main object too, where the different data types are saved. And other cool thing, is that all the different objects that are returned from XML::Smart, share the same XML tree, soo, when an object comes from another (clone), it's the same obj, but that points to a different part in the tree, what use less memory.

    Than I linked the overload resource with a tied HASH and ARRAY that work togetther to work Smart with the XML tree. ;-P

    See the source of the module, it's at least educational, but I think it cool too. ;)

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