Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

When numeric conversion overloading goes awry.

by dmitri (Curate)
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 contemplating the Monastery: (20)
As of 2014-08-27 17:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (246 votes), past polls