Skip to content

Instantly share code, notes, and snippets.

@zentooo
Created December 7, 2011 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zentooo/1443493 to your computer and use it in GitHub Desktop.
Save zentooo/1443493 to your computer and use it in GitHub Desktop.
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