Thanks, I think I will go the route of making a module "Config.pm"

Although it seems there are many ways to do that, which one is the best
or "proper way" of making one, I don't want to start coding any more
sloppy then I already do. 

I have tried to make a config.pm module but still have troubles getting
it to work, I am not sure why it won't find the module,  use lib "lib/";
use Dell::Config doesn't get me to my lib directory where I have the
folder "Dell" and Config.pm inside of that. 

Not exactly sure what I am doing wrong but strict seems to not like it

Config.pm
___________
use strict;
package Dell::Config;

our($Template, $ChartImageName, $bubbleName, $imageType);


$Template = qq(Dell_Deployment_Optimization_Report.pdf);
$ChartImageName = "DellDOChart";
$bubbleName = "Bubble";
$imageType =".png";

1; #Return True


BuildReport.pl
______________

use strict;
use warnings;
use lib "lib/";
use Dell::Config


code here....


any ideas what I am doing wrong?



-----Original Message-----
From: Bill Luebkert [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 22, 2007 5:39 PM
To: Ben Eagle
Subject: Re: Passing Variable from .pl to .pl

Ben Eagle wrote:
> I am trying to break up a script for easy configuration,
> 
>  
> 
> So I want to put all my global variables in a file call config.pl
> 
>  
> 
> And on BuildReport.pl I add
> 
> Require "config.pl";
> 
>  
> 
> In strict mode this doesn't work I get error saying I never declared
my 
> variables.
> 
>  
> 
> I use our($this, $that);

You could make it a .pm file and do something like:

use strict;
use warnings;
use myconfig;

print "x=$x\n";
print "y=$y\n";
print "z=$z\n";

__END__

myconfig.pm:

use strict;
use warnings;
use vars qw($x $y $z);

$x = 1;
$y = 2;
$z = 3;

__END__

Or you could use a do in a begin block:

use strict;
use warnings;

BEGIN { do 'config.pl'; }

print "x=$x\n";
print "y=$y\n";
print "z=$z\n";

__END__

Where config.pl is the same as config.pm above.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to