NAME

Acme::Gosub - Implement BASIC-like "gosub" and "greturn" in Perl

VERSION

version 0.1.9

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;
}

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.

FUNCTIONS

filter()

Does the actual filtering to the code.

filter_blocks()

The workhorse of the module - does most of the work of transforming the code.

line()

Taken from Switch.pm.

unimport()

Cancels the filter.

AUTHOR

Damian Conway is the original author of Switch.pm, on which this module is based.

Shlomi Fish ( http://www.shlomifish.org/ ) converted Switch.pm to become Acme::Gosub.

ACKNOWLEDGEMENTS

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.

SEE ALSO

Acme::ComeFrom .

SUPPORT

Websites

The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.

Bugs / Feature Requests

Please report any bugs or feature requests by email to bug-acme-gosub at rt.cpan.org, or through the web interface at https://rt.cpan.org/Public/Bug/Report.html?Queue=Acme-Gosub. You will be automatically notified of any progress on the request by the system.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

https://github.com/shlomif/perl-acme-gosub

git clone git://github.com/shlomif/perl-acme-gosub.git

AUTHOR

Shlomi Fish <shlomif@cpan.org>

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/shlomif/perl-acme-gosub/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by Shlomi Fish.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.