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;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Class::Struct question
by ikegami (Patriarch) on Sep 14, 2004 at 18:17 UTC | |
Re: Class::Struct question
by hardburn (Abbot) on Sep 14, 2004 at 16:36 UTC | |
by ikegami (Patriarch) on Sep 14, 2004 at 18:03 UTC |
Back to
Seekers of Perl Wisdom