KEITA Alhassane Abdel wrote:
> hello.
>
> I've tryed to use some variables declared into my package "test.pm" in
> my script "test.pl". I work under "Windows XP".
>
> "test.pl"
> -----------------------------------------------------------
> use strict ;
> use lib('E:\Program Files\EasyPHP1-8\cgi-bin\devis') ;
> use test;
> print "$var1\n" ;
> sub_test();
>
> "test.pm"
> -----------------------------------------------------------
> package test ;
> BEGIN{
> use Exporter ;
> our @ISA = qw(Exporter) ;
> our @EXPORT = qw ($var1 &sub_test) ;
> }
> my $var1 = 100 ;
> sub sub_test{
> print "Sub sucessfully imported" ;
> }
> 1;
> END{}
>
>
> -----------------------------------------------
> Results : the subroutine has been successfully imported when the
> variable $var1 is undefined. If someone can give me a basic sample which
> turns, or can show me what errors I've done, it will be very nice.
This works for me (note I changed test to testit):
use lib ('E:\Program Files\EasyPHP1-8\cgi-bin\devis');
use testit;
print "var1 = $var1\n";
sub_test ();
__END__
package testit;
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw($var1 sub_test);
our $var1 = 100;
sub sub_test {
print "Sub testit::sub_test sucessfully imported\n";
}
print "testit loaded\n";
1;
__END__
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs