in reply to Re^2: Weird syntax. What does this goto statement do? ( 'goto &NAME' use cases)
in thread Weird syntax. What does this goto statement do?

Some years ago, i used the goto when i needed a throw method with a stack trace that starts where the method was called. I used Exception::Class exceptions, and the method looked something like this:

sub throw { my $self = shift; my %args = @_; @_ = ('Local::Exception', # ... more params taken from %args and from the object ... ); goto &Exception::Class::Base::throw; }
  • Comment on Re^3: Weird syntax. What does this goto statement do? ( 'goto &NAME' use cases)
  • Download Code

Replies are listed 'Best First'.
Re^4: Weird syntax. What does this goto statement do? ( 'goto &NAME' use cases)
by LanX (Saint) on Jan 03, 2024 at 16:11 UTC
    Yep that's a case of wrapping a function call which inspects the call chain.

    😊👍🏼

    I did similar things too but with carp routines or recently with a self made logger.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery