The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Goto::Cached - a fast drop-in replacement for Perl's O(n) goto

SYNOPSIS

sub factorial($) {
    use Goto::Cached;
    my $n = shift;
    my $accum = 1;

    iter: return $accum if ($n < 2);
    $accum *= $n;
    --$n;
    goto iter;
}

DESCRIPTION

Goto::Cached provides a fast, lexically-scoped drop-in replacement for Perl's builtin goto. Its use is the same as the builtin. goto &sub and jumps out of the current scope are not cached.

VERSION

0.22

SEE ALSO

AUTHOR

chocolateboy <chocolate@cpan.org>

COPYRIGHT

Copyright (c) 2005-2010, chocolateboy.

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.