[EMAIL PROTECTED] wrote:
> my openconf function contains:
>
> sub openconf {
> my $pkg = shift;
> my $self = bless([EMAIL PROTECTED],$pkg);
> open(...
> ....
> return($self);
> }
>
> I have "my @config;" set at the beggining of the module
>
you have defined @config as a class variable which means it will be shared
among all instances of your My::Lib class. you don't want that, you need an
instance variable instead.
>> > my $cfg1 = My::Lib->openconf("cfg1.conf");
>> > my $cfg2 = My::Lib->openconf("cfg2.conf");
>> >
>> > print $cfg1->param("someparam");
>> > print $cfg2->param("someparam");
>> >
>> > it prints two times the param from second conf file. Any ideas or I
>> > wasn't clear enough ?:")
cfg1.conf and cfg2.conf both have the same param and because @config is
shared among $cfg1 and $cfg2, they both print exactly the same thing.
david
--
s$s*$+/<tgmecJ"ntgR"tgjvqpC"vuwL$;$;=qq$
\x24\x5f\x3d\x72\x65\x76\x65\x72\x73\x65
\x24\x5f\x3b\x73\x2f\x2e\x2f\x63\x68\x72
\x28\x6f\x72\x64\x28\x24\x26\x29\x2d\x32
\x29\x2f\x67\x65\x3b\x70\x72\x69\x6e\x74
\x22\x24\x5f\x5c\x6e\x22\x3b\x3b$;eval$;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>