Theresa Mullin wrote:
> #!/usr/local/bin/perl
> ...
> use Test;
 > ...
 >
> Here is module Test: 
> #!/usr/bin/perl
> ...
> package Test;
> ...
> $dbase = "TEST";
> print "And to all a good night \n";  
>
> The code appears to execute, and no error messages are generated.
> However, the value of $dbase is never written to the log file.
> Any advice you can give would be helpful.
> Thanks,
> T.

this is because $dbase is being declared in a separate "Test" namespace. 


there is a difference between using modules and using packages.  modules 
are separate files and share the namespace of the calling script, but 
packages have their own name space.  a package can be in the same file 
or in a different one.

the syntax for including modules or packages (demo.pl) is the same "use 
FOO;".  you can tell if you're calling a package by looking for the 
'package FOO;' declaration somewhere in your source.

thus, in your case - try commenting out "package Test;" from Test.pm or 
you can use the Exporter to export the $dbase variable to demo.pl.

cheers,
   twkonefal

-- 
  "The stuff you own ends up owning you ... It's only after you've lost 
everything that you're free to do anything." --tyler durden

New Media Copyright Extensions Would Harm Canada: 
http://ansuz.sooke.bc.ca/icsub.html


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@lists.vm.com/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to