Hi.

I'm going to write a couple of XS modules (they will be in the Win32 namespace, but i think that is a general question!). Some of them dependent on others. Example:

package Foo::Bar;
package Foo::Bar::Builder;
package Foo::Bar::Store;
* Foo::Bar::Builder creates an Foo::Bar object.
* Foo::Bar objectes can be stored in a Foo::Bar::Store.

Right now i have the following structure:

Foo/Bar.xs
Foo/Bar/Builder.xs
Foo/Bar/Store.xs
How does Foo::Bar::Builder and Foo::Bar::Store know, that there is a Foo::Bar or better what Foo::Bar is! (Builder has a create function that returns a Foo::Bar object (TYPEMAP Foo::Bar T_PTROBJ)).

or is it better to put everything into Foo/Bar.xs like
MODULE = Foo::Bar        PACKAGE = Foo::Bar
MODULE = Foo::Bar        PACKAGE = Foo::BarPtr
MODULE = Foo::Bar::Store        PACKAGE = Foo::Bar::Store
MODULE = Foo::Bar::Store        PACKAGE = Foo::Bar::StorePtr
MODULE = Foo::Bar::Builder        PACKAGE = Foo::Bar::Builder
MODULE = Foo::Bar::Builder        PACKAGE = Foo::Bar::BuilderPtr
or (like that?)

MODULE = Foo::Bar        PACKAGE = Foo::Bar
MODULE = Foo::Bar        PACKAGE = Foo::BarPtr
MODULE = Foo::Bar        PACKAGE = Foo::Bar::Store
MODULE = Foo::Bar        PACKAGE = Foo::Bar::StorePtr
MODULE = Foo::Bar        PACKAGE = Foo::Bar::Builder
MODULE = Foo::Bar        PACKAGE = Foo::Bar::BuilderPtr

<edit1>Typo fixed.</edit1>
<edit2>So in general, how do i call the new function of Foo::Bar (defined in Foo/Bar.xs) inside Foo/Bar/Builder.xs?</edit2>

In reply to XS Modules: Dependencies by esskar

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.