in reply to accessing subs/methods from the module
I am not sure I understood your question, if you simply need to call another class' method, or another package subroutine, or it makes sense to create a Foobar instance just to call another class' method...
Anyway, if you just want to know if it is possible to call another class' method without instanciating it, or another package's subroutine, the reply is:
# Access a Foobar's method Foobar->method(@parameters) ; # Access a Foobar subroutine Foobar::subroutine(@parameters) ;
Be warned that in Perl subroutines and methods are the same thing, but calling Foobar->method(@parameters) is not the same as calling &Foobar::subroutine(@parameters).
Ciao!
--bronto
Update: (after shrubbery's explaination): ok, I understand now:
steves & C. already replied: it is possible, but you should use package or global variables, which should be avoided if possible.
The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
--John M. Dlugosz
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: accessing subs/methods from the module
by shrubbery (Acolyte) on Feb 06, 2003 at 19:00 UTC | |
by artist (Parson) on Feb 06, 2003 at 20:23 UTC | |
by steves (Curate) on Feb 06, 2003 at 19:20 UTC | |
by shrubbery (Acolyte) on Feb 06, 2003 at 21:03 UTC | |
by dragonchild (Archbishop) on Feb 06, 2003 at 20:14 UTC |