--- "Morse, Loretta" <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> Does anybody know how to call a subroutine that is in a .pm file from
> another .pm file.

Given A.pm
===========
package A;
sub a { return "a!\n"; }
1;
===========

and B.pm
===========
package B;
use A;
sub b { print A::a(); }
1;
===========

and C.pl
===========
use B;
B::b();
===========

running C.pl should print "a!\n".

Unfortunately, this simple example fails to work for me, though I can
make virtually the same call work fine using much more complicated
modules I've written.

The principle is that you specify the package space. For example, if in
your module you 
  use Symbol;

then you should be able to generate globs at need with
  my $glob = Symbol::gensym;

"gensym" being a function in the "Symbol" namespace.
I've done this in lots of modules.

So could somebody point out to me what I'm doing stupid, so no one on
this list will copy the part of the above example that I'm doing
*wrong*? lol!!

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to