in reply to Two argument bless sometimes ignores the class name?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Two argument bless sometimes ignores the class name?
by stvn (Monsignor) on Jan 07, 2005 at 13:21 UTC |