Can I call a superclass sort with a subclass compare in perl?
问题 I want to use a superclass sort which uses a subclass compare function. I've tried to distill the nature of the question in the following code. This isn't the "production" code, but is presented here for illustration. It's tested. #!/usr/bin/perl # $Id: foo,v 1.10 2019/02/23 14:14:33 bennett Exp bennett $ use strict; use warnings; package Fruit; use Scalar::Util 'blessed'; sub new { my $class = shift; my $self = bless({}, $class); $self->{itemList} = []; warn "Called with class ", blessed