Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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 => '', plp_site => '', do_not_use => 'spamtrap' }

Comment on Re: use fields; # damnit
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2015-10-13 22:09 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (316 votes), past polls