Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: hash, a troublemaker?

by TilRMan (Friar)
on May 12, 2004 at 04:07 UTC ( #352642=note: print w/replies, xml ) Need Help??


in reply to hash, a troublemaker?

You might find fields useful, although you'd have to create an object instead of a plain hash, and you'd need a different class for each hash.

{ package FooBar; use fields qw( foo bar ); sub new { fields::new(shift) } } my $ref = new FooBar; $ref->{foo} = 1; # Okay $ref->{quv} = 2; # Kablooie!

I'd guess that with Symbol one could create a class factory that would return a singleton object with the fields you request.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2023-09-25 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?