Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

71 lines (59 sloc) 0.995 kB
#!/usr/bin/perl
# Copyright 2004-2011, Paul Johnson (pjcj@cpan.org)
# This software is free. It is licensed under the same terms as Perl itself.
# The latest version of this software should be available from my homepage:
# http://www.pjcj.net
sub unused { 0 }
sub empty { }
sub gen
{
my $x = shift;
sub
{
my $y = shift;
return $x + $y if $y;
}
};
my $o = gen(1);
my $p = $o->(7);
my $q = $o->(8);
my $r = gen(1)->(2);
my $s = gen(3)->(4);
my $t = gen(5)->(6);
print "$p, $q, $r, $s, $t\n";
for my $func (qw(f1 f2 f3))
{
no strict "refs";
*$func = sub
{
print "$func\n";
}
}
f1();
f2();
sub AUTOLOAD
{
my $func = $AUTOLOAD;
$func =~ s/^.*:://;
no strict "refs";
if ($func eq "add")
{
*$func = sub
{
print "Add!\n";
};
}
else
{
*$func = sub
{
print "$func\n";
};
}
goto &$func
}
add();
add();
add();
qaz();
wsx();
Jump to Line
Something went wrong with that request. Please try again.