Online Shopping : Computers : Programming : Languages : Perl

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 1 people (100%) answered Yes
Recently 1 of 1 people (100%) answered Yes

Entry

I have a variable in a new function in a Perl module, I want that varaible to retain its value.

Apr 14th, 2009 04:02
roan mke, Vincent Milette, Kunal Kapoor,


In your perl-module, you must export the variable. That way, you will be
able to use it 
elsewhere.
If you don't know how to export the variable here is the way
...in your module after the package name...
use Exporter;
use vars qw(@ISA @EXPORT $VERSION);
$VERSION = 1.00;
@ISA = qw(Exporter)
;
@EXPORT = qw($var); #export the var to other module or script including
this module
use vars qw ($var); # give the possibility to use the var in the module
By exporting the var this way it is easier to create a config file for
your program...I do it 
like that all the time
For further help, see:
http://stein.cshl.org/genome_informatics/using_perl_modules/index.html
There is a chapter about Exporting module
There is also other way to do what you want...because with
perl..."There's More Than 
One Way to Do It"
HTH
Vincent M.
http://petsomsorg.blogspot.com
http://helsefitness.blogspot.com
http://reisen-london.blogspot.com
http://salutefisica.blogspot.com
http://curaanimalidomestici.blogspot.com
http://sanatatefitness.blogspot.com
http://husdjur1.blogspot.com
http://petscuidados.blogspot.com
--------------------------------------------------------
http://fluge.blogtact.com/
http://flyreiser.blogtact.com/
http://flyvninger.blogtact.com/
http://curagiardino.blogtact.com/
http://curalagravidanza.blogtact.com/
http://zwangerschapzorg.blogtact.com/
http://viaggiolondra.blogtact.com/
http://ideescadeaux.blogtact.com/
http://schoonheidsverzorging.blogtact.com/
http://londenreizen.blogtact.com/
--------------------------------------------------------