Created
July 18, 2014 12:41
-
-
Save VadimPushtaev/58216fd01d99eef22dc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package My_Loop; | |
use strict; | |
use warnings; | |
our $AUTOLOAD; | |
sub AUTOLOAD { | |
my ($class, $method) = split /::/, $AUTOLOAD; | |
my ($prefix, $i) = split /_/, $method; | |
$i--; | |
my $next_method = "${prefix}_${i}"; | |
print "$i\n"; | |
return __PACKAGE__->$next_method; | |
} | |
sub loop_0 {} | |
__PACKAGE__->loop_13; | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment