in reply to Re: if (ref $value eq "ARRAY") {
in thread if (ref $value eq "ARRAY") {
I guess that's just syntactic sugar around the test I could write inside the function, now.
I think the concept here is that "all differences in allowed parameter types should be done through polymorphism". In Perl, that's hard to do with anything that's not blessed.
But, it does suggest something. I could have an abstract base class to serve as an "interface", and recognise that case as well as the built-in things (plain scalar and array ref). Then, anyone wanting to pass an object and have it mean something to this function would simply need to make it "isa" that interface class.
— John
|
---|