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

fields-like module to facilitate arrayref objects

by davidnicol (Acolyte)
on Aug 21, 2004 at 22:52 UTC ( #384842=note: print w/ replies, xml ) Need Help??


in reply to Re: use fields; # damnit
in thread use fields; # damnit

Hell yeah stvn you can use fields functionality without the fields pragma.

Set up your object around an array instead of a hash, define a series of constants with the field names, and there you are.

I even set up a shortcut module that maps field names to small integers for this purpose (sort of like the "enum" statement in C)

TipJar::fields

see also: enum::fields which is oriented for OO inheritance but which doesn't provide accessors.


Comment on fields-like module to facilitate arrayref objects

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (18)
As of 2015-07-01 17:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (15 votes), past polls