Well, here's something related I don't quite get that might help. I modified your code somewhat:
use strict; package Foo; sub new { print "Expected class: $_[0]"; bless {} => shift } sub test { print "Actual class: ". ref shift } package main; *Bar:: = \*Foo::; my $x = Bar::new('Bar');
Now as I understand it, this ought to work because that last line is equivalent to my $x = Bar->new. But it doesn't. In fact it returns Undefined subroutine &Bar::new called at - line 9. 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. I haven't yet found any relevant docs though.
In reply to Re: Two argument bless sometimes ignores the class name?
by Errto
in thread Two argument bless sometimes ignores the class name?
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |