stevan/p5-mop — Issue #35: Inheriting from packages
Author: cpansprout
Created: 2011-12-14 20:55:53+00:00
State: open

This is a continuation of a topic brought up in issue #30.

Sometimes one comes across code like this:

```
sub dup {
my $self = shift;
ref($self)->new($self);
}
```

So, if a new-style class inherits from a package, `ref($self)` will have to return the class for that to work.

For the least amount of surprise, the class would have to stringify as its name, so that `warn ref($thing)` will continue to work.

I don’t think we can make class method calls work on hybrid inheritance chains, at least on traditional classes that do different things based on whether `ref($_[0])` is true. I cannot think of a real-world case where that will be a problem, though. Maybe this limitation should be documented.