From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of KEITA
Alhassane Abdel
Sent: 04 November 2005 15:09
To: activeperl@listserv.ActiveState.com
Subject: importing scalars into an other script

> 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 warnings;

> use lib('E:\Program Files\EasyPHP1-8\cgi-bin\devis') ;
> use test;
> print "$var1\n" ;
> sub_test();
 > 
> "test.pm"
> -----------------------------------------------------------

use strict;
use warnings;

> package test ;
> BEGIN{
>  use Exporter ;
>  our @ISA = qw(Exporter) ;
>  our @EXPORT = qw ($var1 &sub_test) ;
> }

Doesn't need to be in a BEGIN sub.

> my $var1 = 100 ;

Lexical variables cannot be exported. It should be a package variable
(our) if you want to export it.

> sub sub_test{
>  print "Sub sucessfully imported" ;
> }
> 1;
> END{}

The "1;" should be the last statement in the file. Also, what is the END
sub here for, especially as it does nothing.

>  
>  
> -----------------------------------------------
> 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.

Also, it is easier for me if you post in plain text rather than html.

HTH

-- 
Brian Raven




=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the 
intended addressee(s). Unauthorised reproduction, disclosure, modification, 
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message do not 
necessarily reflect those of Atos Euronext Market Solutions.

L'information contenue dans cet e-mail est confidentielle et uniquement 
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. 
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail 
vous parvient par erreur, nous vous prions de bien vouloir prevenir 
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre 
systeme. Le contenu de ce message electronique ne represente pas necessairement 
la position ou le point de vue d'Atos Euronext Market Solutions.


_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to