in reply to Class::Struct question

No, but for reasons that have nothing to do with Class::Struct, and everything about Perl OO and operator precedence. Since '++' binds more tightly than '->', when you say:

$x->Counter++;

According to B::Deparse, Perl translates that to:

++$x->Counter;

Which should then be tokenized into something like:

(++$x) -> Counter

Which is probably not at all what you want.

Without knowing your specific situation, I would suggest looking more carefully at your object structure. What you're trying to do indicates to me that you're playing too closely to the object's internals.

Update: Forget I said anything. See ikegami's response below.

"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Replies are listed 'Best First'.
Re^2: Class::Struct question
by ikegami (Patriarch) on Sep 14, 2004 at 18:03 UTC
    ++' binds more tightly than '->'

    That's not true. '->' is just above '++' in precedence. ++$x->Counter; is the same as ++($x->Counter);. The problem is that Counter does not return an lvalue. See the other post I'm making in this thread for an example.