in reply to Unable to turn off strict refs

Based on our previous conversations, I will guess that you want to call every implementation of a method in the inheritance tree instead of only the most-specific?

There is probably a module on CPAN somewhere for this, and perhaps another monk will be able to cite it, but I do not know. I suggest trying: (untested)

sub _run_chain { my $s = shift; my $sub = shift; for my $r ( @{ $s->{_classes} } ) { $s->($r.'::'.$sub) if $s->can($r.'::'.$sub); } }

This will override the method search to directly call each method. Because Perl is a highly dynamic language, I have removed the no strict and expect that this will not contain a symref.

Your problem was not in this code at all — it was looking up $sub as a class method for each $r and then, finding that a sub by that name does indeed exist in that package, invoking it as a class method even though it is written as an instance method. You have been actually calling into File::Collector::Date::Classifie...::$sub and that is where the error is occurring. I think that running your code under the debugger would give you a nice backtrace showing the successful call and the unsuccessful dereference. (Simply run the script with perl -d and type c at the prompt to let the program run.)

And another comment on OO design: subclass relationships and the package hierarchy are independent in Perl. It might make more sense to have a File::Collector::Sorter::Date::ByMonth mixin class that groups files by month, or your sorting classes may all make more sense somewhere in your application's local package hierarchy.