Created
December 7, 2011 16:35
-
-
Save zentooo/1443493 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
use strict; | |
use warnings; | |
use feature qw/say/; | |
our $_add = our $_remove = sub { | |
say "add and remove should be called in builder block!"; | |
}; | |
sub add { | |
$_add->(); | |
} | |
sub remove { | |
$_remove->(); | |
} | |
sub builder(&) { | |
local $_add = sub { | |
say "add!"; | |
}; | |
local $_remove = sub { | |
say "remove!"; | |
}; | |
shift->(); | |
} | |
add(); | |
builder { | |
add(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment