class_case takes a list of KEY, VALUE pairs and returns a code reference that (when called on an object) will analyze the object's class according to the rules described below and return the corresponding VALUE of the first matching KEY.

This will check the class of $some_object against KEY1, KEY2, ... in order and return the corresponding VALUEn of the first match. If no key matches, an empty list/undef is returned in list/scalar context, respectively.

Any other string is interpreted as a class name and matches if the input value is an object for which $obj->isa($CLASS) is true. To match any kind of object (blessed value), use the key 'UNIVERSAL'.

Starting with Perl 5.10.0 Perl supports checking for roles with DOES, so Dispatch::Class actually uses $obj->DOES($CLASS) instead of isa. This still returns true for normal base classes but it also accepts roles that have been composed into the object's class.