Neat! A couple of suggestions: First, an insert_method() would be a useful addition to append_method(). I'd like to be able to add a subroutine that executes before an existing one instead of after. Also, your example should probably mention that the package of the method to append needs to be specified explicitly when passed as a string or it ends up in Class::AppendMethod and fails to exist. E.g.
#!/usr/bin/perl
use strict;
package Dummy;
sub test { print "one\n"; }
package main;
use Class::AppendMethods 'append_method';
append_method("Dummy::test", "post_test");
sub post_test { print "two\n"; }
Dummy::test;
Gives me this output:
one
Undefined subroutine &Class::AppendMethods::post_test called at /home/
+matt/Class/AppendMethods.pm line 43.
Whereas
append_method("Dummy::test", "main::post_test");
or
append_method("Dummy::test", \&post_test);
... behaves as expected.
-Matt