Acme-Gosub
view release on metacpan or search on metacpan
lib/Acme/Gosub.pm view on Meta::CPAN
1;
__END__
=head1 NAME
Acme::Gosub - Implement BASIC-like "gosub" and "greturn" in Perl
=head1 SYNOPSIS
use Acme::Gosub;
sub pythagoras
{
my ($x, $y) = (@_);
my ($temp, $square, $sum);
$sum = 0;
$temp = $x;
gosub SQUARE;
$sum += $square;
$temp = $y;
gosub SQUARE;
$sum += $square;
return $sum;
SQUARE:
$square = $temp * $temp;
greturn;
}
=head1 DESCRIPTION
Using this function enables using the "gosub" and "greturn" statements inside
your program. "gosub" is identical to "goto" except that it records the
place from which it was invoked. Then, when a "greturn" is used, it jumps back
to the place of the last goto that was not "greturned" yet. If you're not
a BASIC programmer you can think of it as a poor man's recursion.
For more information consult the examples in the test files.
=head1 FUNCTIONS
=head2 filter()
Does the actual filtering to the code.
=head2 filter_blocks()
The workhorse of the module - does most of the work of transforming the code.
=head2 line()
Taken from Switch.pm.
=head2 unimport()
Cancels the filter.
=head1 AUTHOR
Damian Conway is the original author of L<Switch.pm>, on which this module
is based.
Shlomi Fish ( L<http://www.shlomifish.org/> ) converted Switch.pm to become
Acme::Gosub.
=head1 BUGS
The function's gosub recursion stack is function-wide and so different
instances of the function will all use the same recursion stack. Hopefully
it will be fixed in later versions.
I am not sure whether this will work on dynamic functions (a.k.a closures).
Please report any bugs or feature requests to
C<bug-acme-gosub@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-Gosub>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
=head1 ACKNOWLEDGEMENTS
=head1 COPYRIGHT & LICENSE
Copyright (c) 1997-2003, Damian Conway. All Rights Reserved.
Modified by Shlomi Fish, 2005 - all rights disclaimed.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 SEE ALSO
L<Acme::ComeFrom> .
=cut
( run in 0.632 second using v1.01-cache-2.11-cpan-98e64b0badf )