Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Packages

Status
Not open for further replies.

scribouille

Programmer
May 10, 2001
6
FR
Hi,
Well, my problem is the following :
-I have 2 packages A.pm and B.pm and one principal programm, main.pl
I try (but it doesn't work) to specify my 1rst packqge like that :
#A.pm :
package A;
require Exporter;
@ISA=qw(Exporter);
@EXPORT=qw(Sub1 %Var1);
@EXPORT_OK=qw($Var2);
%Var1=(1=>...,2=>...);
use strict #Is it the good place for it ?
my($Var2)
Sub1'={...}
1;
My questions :
How can I have a variable (for instance %Var) both :
->Visible and not writable NEITHER by main NORE by B
->Visible and midifiable by A (well, it could see easy but... not for me)
How I have to specify my package B and the good specification of A and the main
Thanks for your help
 
I don't think that's possible -at least I don't know how to do it. By placing %Var1 in @EXPORT, I believe that any module that does

use A;

has full(visible and writable) access to %Var1.

In fact, variables placed in either @EXPORT or @EXPORT_OK are fully modifiable by the "use"ing module. I could be wrong about this but this is my understanding.

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Well, i tried different things but the only thing i found is declaring my different variables as global one and establishing that we can't touch this variable without being in the wanted package.
Thank's for your help
(but, if someone has an idea...)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top