Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

When numeric conversion overloading goes awry.

by dmitri (Priest)
on Jan 24, 2006 at 19:21 UTC ( #525293=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use overload ("0+" => 'value');
    sub value {
        my $self = shift;
        exists $self->{'-value'} ? $self->{'-value'} : undef;
    }
    
  2. or download this
    sub gen_id { sprintf "%U", $_[1] }
    
  3. or download this
    package My;
    
    ...
    package main;
    my $var = My->new;
    print int($var);
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://525293]
Approved by Corion
Front-paged by bart
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2016-07-28 23:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (259 votes). Check out past polls.