in reply to Weird syntax. What does this goto statement do?
Short answer , the author is implementing a state machine.
The "weird" code ...
... could be translated to a more explicit version:
my ($self,...) = @_; ... my $c_next = $self->{state} = \&stateReadLit; # keep track goto &{$c_next};
or even
my ($self,...) = @_; ... $self->{state} = \&stateReadLit; goto &stateReadLit;
Personally I have some doubt about this design decision, it doesn't seem like the code ref in $obj->{state} is ever used for anything more than a Boolean check.
If I was storing a state I'd use a readable name not a ref.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
|---|