Fix Those Legacy Subroutines or Methods
Maybe you know the feeling… you go to add an option to that method or subroutine and… cue Jaws theme
sub update_shopping_cart { my $cart_id = shift; my $item = shift; my $quantity = shift;
Argh. You don’t want your legacy code to break but you also don’t want to add a fourth unnamed parameter to the existing problem. And the solution is simple:
This is a pretty elegant solution. I like it.