Thank you Corion, that was very helpful. In the meantime I have also discovered the source of my confusion. I made the (wrong) assumption that simply saying
our @EXPORT = qw(function);
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:
use one -base;
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:
import one;
after the
@two::ISA = qw(one);
Thus the final program, and its output is:
#!/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


In reply to Re^4: This can't happen, can it? by henrylaxen
in thread This can't happen, can it? by henrylaxen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.