shemp has asked for the wisdom of the Perl Monks concerning the following question:
I was wondering if there is any way built-in to Class::Struct generated objects that would allow incrementing (and decrementing) in an overloaded sort of way, as opposed to building my own operator overloads. What i mean is, i'd like to be able to do something like:
Is what i want to do directly possible (built-in)? I suppose i'd also like to be able to:use strict; use warnings; use Class::Struct; struct MyStruct => { 'Counter' => '$', ... } my $x = MyStruct('Counter', 0); $x->Counter++; # of course i could always do the following: $x->Counter( $x->Counter + 1 );
will i need to build my own overloads?... $x->Counter += 7;
Back to
Seekers of Perl Wisdom