in reply to Inside Out Classes and the internal Hashes

Rolling your own inside-out objects is a great learning exercise (some would say it's a rite of passage, much like writing your own templating system:), but for any real usage I'd use a module such as Class::InsideOut

Replies are listed 'Best First'.
Re^2: Inside Out Classes and the internal Hashes
by KurtSchwind (Chaplain) on Dec 18, 2007 at 13:49 UTC

    So, this just brings up another question.

    There seems to be at least 3 major modules to do this. Object::InsideOut, Class::InsideOut and Class::Std. So which one do I use?

    I need a "production ready" solution which is why I was rolling my own. In the absence of information on those modules, I wasn't sure if they were really robust or not. Are they all pure perl? Is one of these going to be a core module soon?

    --
    I used to drive a Heisenbergmobile, but every time I looked at the speedometer, I got lost.

      I don't have a definitive answer for you, but perhaps this will help.

      • Class::Std is written by TheDamian, referenced by PBP, and it's the only one I've actually used. From what I hear, it has trouble with threading, but I haven't done any threading, so I haven't cared.
      • Object::InsideOut seems to be the kitchen sink version, written after Class::Std, in an effort to address its drawbacks. It may be slow.
      • Class::InsideOut is the small and simple version. I don't know anything about it.
        Three of my modules on CPAN use Object::InsideOut. When I get home this evening, I will run prove on the source code tests on jcwren's server and post the results as well as the actual tests themselves. This will at least provide a very rough idea for a benchmark

        Update: I got home late last night and went straight to bed. I will be doing the testing and posting of results this evening. shmem also asked me to test the Alter package as well.

        Update: And as promised, the results. I did the testing on my laptop (P3,2.2Ghz,512MB) running Strawberry Perl (Perl 5.8.8)
        C:\Documents and Settings\Thomas Stanley\My Documents\WORK-GQT>prove t +\*.t t\01load..........ok t\02generate......ok t\03exceptions....ok t\04exceptions....ok t\04pod...........ok t\05pod...........ok All tests successful. Files=6, Tests=18, 3 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 +CPU) C:\Documents and Settings\Thomas Stanley\My Documents\WORK-Config-Yacp +>prove t\*.t t\01load.......ok t\02getset.....ok t\03add........ok t\04delete.....ok t\05newinit....ok t\06pod........ok All tests successful. Files=6, Tests=25, 3 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 +CPU) C:\Documents And Settings\Thomas Stanley\My Documents\WORK-Logger-Simp +le>prove t\*.t t\01load.........ok t\02readwrite....ok t\03lock.........skipped all skipped: File Locking not working on MS Windows t\04pod..........ok All tests successful, 1 test skipped. Files=4, Tests=6, 4 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 C +PU) C:\Documents And Settings\Thomas Stanley\My Documents\Work-Alter\Alter +-0.07>prove t\*.t t\01_load........ok t\02_function....ok t\03_class.......ok All tests successful. Files=3, Tests=91, 2 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 +CPU)

        TStanley
        --------
        People sleep peaceably in their beds at night only because rough men stand ready to do violence on their behalf. -- George Orwell

      Good question.

      And, actually, I'd just figured everyone was using Moose these days.