in reply to Require into package
Here is an example
File Foo.pm:
File Client1.pm:package Foo; use strict; use warnings; use Exporter; our @ISA = qw(Exporter); our $foo = "FOO"; our @EXPORT = qw( $foo ); 1;
File Client2.pm:package Client1; use strict; use warnings; use Foo; 1;
File main.plpackage Client2; use strict; use warnings; use Foo; 1;
Program output:#!/usr/bin/perl use strict; use warnings; use Client1; use Client2; print "Client1::foo=", $Client1::foo, "\n"; print "Client2::foo=", $Client2::foo, "\n"; #both variables $Client1::foo and $Client2::foo are just other names f +or $Foo::foo, #so the second assignment wins $Client1::foo = 'CLIENT1'; $Client2::foo = 'CLIENT2'; print "Client1::foo=", $Client1::foo, "\n"; print "Client2::foo=", $Client2::foo, "\n";
I'm actually not sure that this is what you really want to do. Please provide some more details if it is not.Client1::foo=FOO Client2::foo=FOO Client1::foo=CLIENT2 Client2::foo=CLIENT2
|
|---|