results in$next_emitter = $current_emitter->transition(); print $next_emitter->emit() . "\n";
Indeed,Can't locate object method "emit" via package "Emitter=HASH(0x1016c9c0)" (perhaps you forgot to load "Emitter=HASH(0x1016c9c0)"?) at HMM/ODCRollGenerator.pm line 100.
results in Emitter=HASH(0x1016c9c0) whereasref($an_emitter->transition());
gives Emitter as expected.ref($an_emitter)
Within an Emitter, the transition table is stored as a hash, with the other Emitter instances as the keys, and the transition probabilities as the values. i.e. the setter method looks like this:
and it might be called like this:sub transitions { my $self = shift; if (@_) { $self->{TRANSITIONS} = shift; &_build_prob_table($self); } return $self->{TRANSITIONS}; }
$self->{START} = Emitter->new(); $self->{FAIR} = Emitter->new(); $self->{LOADED} = Emitter->new(); ... $self->{START}->transitions( { $self->{FAIR} => 0.5, $self->{LOADED} => 0.5 } );
Now, I can make things work by re-blessing the reference returned by transition(), but this seems awfully kludgy, and I suspect there is a better way to do this. Besides, as I understand it, it's the underlying thingy, not the reference, that is blessed. Anyone know what's going on here? Is there some magic I need to add to the class to keep the blessing attached to objects?
In reply to objects becoming unblessed? by omnibus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |