in reply to Re^2: Class::Struct - Not a CODE referemce
in thread Class::Struct - Not a CODE referemce

# Lots more, but not the value of $key

Where do you set the hash entry (in case you expect it to be set)?

Anyhow, as you can tell from the $VAR1 = undef in

print Dumper $self->{TT}->call_category($key) $VAR1 = undef;

when you try to fetch non-existent entries, you just get undef (not too surprising, actually).  However, it's not the accessor that causes the "Not a CODE reference" issue, but something later in code you haven't shown (otherwise the error would be thrown before Dumper gets the undef).  In other words, it might not have anything to do with Class::Struct.

Replies are listed 'Best First'.
Re^4: Class::Struct - Not a CODE referemce
by ungerma (Initiate) on Jun 08, 2010 at 16:17 UTC
    You are right, it happens after the accessor. Thank you - problem solved! The n-command is not intuitive in if/elsif/else constructs - at least not for me. Reading the documentation helped ;-) In case someone struggles with the same error - you probably did this:
    $ref->a->($key);
    but meant this:
    $ref->a($key);
    Cheers, Martin