in reply to Re^3: This can't happen, can it?
in thread This can't happen, can it?
means that Spiffy would export function into package two. Actually what I need to do is declare that package one is the base class package two, like this:our @EXPORT = qw(function);
The problem is that package two lives in the same file as package one, and this causes a compiler error. The whole thing can be resolved by adding:use one -base;
after theimport one;
Thus the final program, and its output is:@two::ISA = qw(one);
#!/usr/bin/perl package one; use Class::Spiffy -base; our @EXPORT = qw(function); sub function { print "Function in package one\n" } package two; @two::ISA = qw(one); import one; print STDERR "Class::Spiffy version is ", $Class::Spiffy::VERSION, "\n +"; print STDERR "Can two function? ",two->can('function'), "\n"; function(); __END__ cd /home/henry/dev/ /usr/bin/perl -w /home/henry/dev/spiffy_bug.pl Class::Spiffy version is 0.15 Can two function? CODE(0x814b738) Function in package one Compilation finished at Tue Feb 21 10:37:35
Thanks to all who have tried to be helpful in solving this mystery.
Best wishes,
Henry Laxen
|
|---|