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

Re^2: variables as classes

by nmerriweather (Friar)
on Sep 04, 2006 at 06:07 UTC ( [id://571009]=note: print w/replies, xml ) Need Help??


in reply to Re: variables as classes
in thread variables as classes

thanks a ton! that did it
package Email; use overload '""'=> \&ADDRESS , fallback=> 1; my $RE_EMAIL= qr/^[\w\-\+\._]+\@[a-zA-Z0-9][-a-zA-Z0-9\.]*\.[a-zA- +Z]+$/ ; sub new { my $proto= $_[0]; my $class= ref($proto) || $proto; my $self= bless( {} , $class ); $self->{ADDRESS}= undef; $self->ADDRESS( $_[1] ); return $self; } sub ADDRESS { my $self= shift; if ( @_ ) { my $email= shift; $email=~ $RE_EMAIL or die "Not a valid email address"; $self->{ADDRESS}= $email; } return $self->{ADDRESS}; } sub _as_str { my ( $self )= @_; return $self->ADDRESS; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-23 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found