shoez has asked for the wisdom of the Perl Monks concerning the following question:
In one package, the central one, I have this code..
package pkg1; use strict; use factory; etc, etc...
In the package called factory, I have the following.
package factory; use strict; use base qw(Class::Factory); __PACKAGE__->add_factory_type(hello=>'speak::hello'); 1;
Now that all seems fine to me. The package speak::hello should be preloaded using require, by Class::Factory, and I should be able to call it at a later time. Herein lies my issue. I hacked together a little test script, which contained just these lines.
#!d:/perl use lib 'c:/perlcode'; use pkg1;
Sadly it didn't work, as Perl seemingly wanted to give me the error you see below. I must be doing something hideously wrong, but I can't seem to work out what/why. Please help, I'm tearing my hair out :) Oh, and I don't know if it's worth mentioning, but I'm using the latest ActiveState Perl distribution (5.8).
Can't locate object method "add_factory_type" via package "factory" at d:/site/factory.pm line 4.
with respect -shoez
2003-04-20 edit ybiC: retitle from "strange error when subclassing packages"