[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Struct-like Classes in Perl (longish)



Brian McNett wrote:
>Okay, so I've decided to turn the starmapping code into a module. This
>means (among other things) encapsulating the (rather hairy) data
>structure in a class.  I think that it would be nice if I could do
>something like struct() in C (below).
>
>I'm looking for examples using Class::Struct, beyond those in the pod.
>Any help here anyone?
>
>I think my question is, how do I emulate this in Perl?  We don't care
>about the
>different datatypes in C, there all scalars to Perl.  An array is fine
>within a script, but what I really want to export from a module is not
>the array, but the structure of it.


 This isn't advice on how to use Cass::struct, but rather a suggestion of a
different path to get to where you want to go - you should get a copy of
"Advanced Perl Programming" by Sriram Srinivasan (the Panther book) and
look up

Chapter 2      Implementing Complex Data Structures
Chapter 7     Object Orientated Programming
Chapter 11   Object Persistence

These chapters will explain ways of creating complex structs (beyond those
of Chapter 4 in the Camel), making templates for data structs through
objects, and finally how to save/read them.

HTH
Robin



from them.

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org