Ralf Schaa wrote:

> Cheers all,
>
> i am doing my first steps with writing packages/modules and of course
> there are problems:
>
> the module holds a variable in a subroutine. this variable i like to
> pass to the callerprogram,

Dont.  Just don't.  Use good design in your program instead.  Good design does
not require having global variables.

>
> so it is in the @EXPORT_OK  and even in the @EXPORT. So far so good, i
> thought!

Export functions, not variables.  Don't try to share variables between files, or
even between functions and you will save yourself a lot of grief.  Instead,
learn how to pass arguments to functions, and how to use references to allow
functions to access arrays, hashes, and objects.
perldoc perlref
perldoc perlsub
perldoc perlmod
perldoc perlobj


>
> but nothing happens when i run the caller-program...
>
> i  tried also defining with 'my ..' , or without 'use strict' ...
>
> somebody has the clue?
>
> thanx
> -ralf

If you explain what you are trying to accomplish, we can probably help you to
use modules appropriately to accomplish the task.  I would suggest that until
you are ready to take on serious object-oriented design, you should focus on
uisng subroutines well and passing arguments to and returning values from
subroutines.

Don't try to get around scoping restrictions.  Work with them instead.  The
discipline they impose is very healthy, and will make your programs much more
dependable.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to