Hi there. I have two problems I'm experiencing with modules at the moment. The first - and smaller - problem is this. I have a file, Foo.pm, that contains something like this :
package Foo::Bar;
sub s1 {}
sub s2 {} ...
package Foo::Bar::Subclass1;
use base Foo::Bar;
...
package Foo::Bar::Subclass2;
use base Foo::Bar;
I'd like to call Foo::Bar::s1 from any of the subclasses.
But - I don't want to call them as class methods (ie $this->s1()). The motivation behind this is that s1, s2, etc aren't really directly related to Foo::Bar or its subclasses, but will be used by all of the subclasses as helper functions at some point.
I've tried using Foo::Bar::s1() from Foo::Bar::Subclass1 - but I get an error saying it could not be found. I *think* this is because the file is called Foo.pm, and not Foo/Bar.pm - but once again, I'm not sure. I've got it working right now by calling s1 from $this, but it seems to me that using $this->s1() for a function that never uses $this is inelegant. If there's an easy way to fix this, let me know.
Second Problem
Of course, the above problem stems from a more deeply-rooted problem - I don't know that much about the inner workings of modules and inheritance. I've tried to RTFM, but there's so much documentation out there, I only find snippets and bits in any place I look. Could anyone point me to a good resource about exactly how modules work? I've read what appeared to be the pertinent man pages (perltoot and perlmod, for instance), but they just provided enough to be usable, not the monk-like knowledge I just *know* is floating around there, somewhere.
Thanks!
James