Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: use fields; # damnit

by Juerd (Abbot)
on Aug 21, 2004 at 12:57 UTC ( #384782=note: print w/replies, xml ) Need Help??


in reply to use fields; # damnit

My way of getting error messages when using the wrong property name is by using only the accessor methods. These are made lvalues, so they can be assigned to.

use Attribute::Property; package Dog; sub new : New; sub intelligence : Property { /^\d+\z/ } package main; my $dog = Dog->new(intelligence => 15); $dog->intelligence++; my $dog = Dog->new(inteligence => 15); # error $dog->inteligence++; # error
It saves a lot of typing (pun intended) too.

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://384782]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2017-07-27 21:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (422 votes). Check out past polls.