in reply to How to correctly import variables to a module ?

I got this to work, but I'm not 100% on if it would be the propper way to do it..

LinuxCommandsPaths.pm
package LinuxCommandsPaths; use strict; use vars qw( @ISA @EXPORT_OK $cat $cleartool $chkconfig ); require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw( $cat $cleartool $chkconfig ) ; our $cat = '/bin/cat'; our $cleartool = '/usr/atria/bin/cleartool'; our $chkconfig = '/sbin/chkconfig'; 1;


Test Code
#!/usr/bin/perl -iw # use strict; use vars qw( $cat $cleartool $chkconfig ); use LinuxCommandsPaths qw($cat $cleartool $chkconfig); print "\$cat == |$cat|\n"; print "\$cleartool == |$cleartool|\n"; print "\$chkconfig == |$chkconfig|\n";


Good Luck!
SFlex,

Replies are listed 'Best First'.
Re^2: How to correctly import variables to a module ?
by ronbarak (Novice) on Dec 13, 2006 at 09:15 UTC
    Thanks SFlex, for the code. Great help.

    Bye,
    Ron.