After reading that article, I'm wondering: what's the value of Ruby refinements over dynamically-scoped monkey-patching? Taking the String.camelize example from the article, you could write in Perl:
sub withCamelize (&) {
my ($thunk) = @_;
local *{'String::camelize'} = sub { ... };
$thunk->()
}
sub camelize_and_join {
my ($str_ary) = @_;
withCamelize {
join ', ', map { $_->camelize } @$str_ary
}
}
So you can probably already accomplish the same with Ruby's equivalent of 'local' for dynamic scoping.