in reply to Re: Eliminating conditional code for GUI and text-mode operation
in thread Eliminating conditional code for GUI and text-mode operation
As stand-alone code, this example produces the expected output. As a module (built with the h2xs boilerplate) make test fails with:
Tried to use 'TestOO'. # Error: Can't locate object method "new" via package "UI::Graphical" at /media/jroth/ecmd-dev/TestOO/blib/lib/TestOO.pm line 56.
Any ideas about this? I just pasted this stuff into the 'precompiled methods go here' indicator in the boilerplate.
Is there a reason why the children would inherit 'new' from the superclass in one context and not in another?
package UI; use Object::Tiny qw(dummy); sub hello {print "superclass hello\n"}; package UI::Graphical; @ISA = 'UI'; sub hello {print "make a window\n";} my $ui = UI->new; $ui->hello; $ui = UI::Graphical->new; $ui->hello; 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Eliminating conditional code for GUI and text-mode operation
by ikegami (Patriarch) on Dec 08, 2007 at 14:06 UTC |