more useful options | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It is possible to do what you want by making TEST a package-scope variable within package openFile and then exporting it. (You would also need to export an openFile::close() subroutine to call in place of close (TEST).) But this is a poor design. Much better to put all the file opening, writing, and closing routines together into a single package, e.g. package MyFile, and keep the details of the filehandle variable (in this case, MyFile::TEST) private to the package (i.e., unexported). The general rule of modularisation is: Group related things together and keep independent things separate. In this case, opening and writing to the file are closely related activities and should be implemented within the same package. Hope that helps,
In reply to Re: how to pass filehandle between module ?
by Athanasius
|
|