in reply to Re: Two argument bless sometimes ignores the class name?
in thread Two argument bless sometimes ignores the class name?
Your example and error message, makes me think that TYPEGLOB aliasing is basically a very shallow operation. Basically that it does not go any deeper than the top level GLOB. If you were to change the alias line to:
I get the following output:*Bar::new = \*Foo::new;
Expected class: Bar
So that makes me think that somehow doing a typeglob assignment on the symbol-table hash doesn't do what you'd expect it to.But you aren't doing it on the symbol table hash, you are doing it on the TYPEGLOB. Although oddly enough, if you do this:
I get the same error you got with your example:%Bar:: = %Foo::; my $x = Bar::new('Bar');
Now that is something I wouldn't expect to happen.Undefined subroutine &Bar::new
|
|---|