Gidday all,
I have written what I will refer to as an include file ( php speak ) and named it
press_config.pl
The contents is the initialisation of the variables that I wish to use across my
mailinglist application. It is below.
First problem
When I use the require statement to call this file into another I no longer have
access to the variables. I was hoping to include this file at the top of each of my
programs across the application naturally so that I only have to write them once.
Back ground info If your interested
My application consists of the following programs
press_config.pl
press_optin.cgi
press_optout.cgi
press_managelist1.cgi
press_managelist2.cgi
press_send.cgi
press_subs.pl
We use a double optin process to subscribe to the mailing list this is handled by
press_optin.cgi
Unsubscribe is handled by press_optout.cgi
These are my admin modules
press_managelist1.cgi
press_managelist2.cgi
I use them to manually add and delete names from the mailing lists if necessary.
There are two lists Im using textfiles as my database
When someone initially subscribes they go on list 1, when they respond to my first
email I place them on list 2.
press_send.cgi is responsible for sending the emails in either html or text format
depending on what format the subscriber chose. This is
run each evening using the cron facility.
Any help appreciated.
<snip>
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
require '/web/www.det/cgi-bin/press_config.pl';
$bolSendNewsletter1 = 0; #false
if( (-e $newsletter1_html) && (-e $newsletter1_text) ) {
$bolSendNewsletter1 = 1; #true
}
$bolSendNewsletter2 = 0; #false
if( (-e $newsletter1_html) && (-e $newsletter1_text) ) {
$bolSendNewsletter2 = 1; #true
}
print "Send Newsletter 1=$bolSendNewsletter1<br>";
</snip>
<snip>
#######
#press_config.pl
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my $year = $year + 1900; # $year is number years since 1900
my $day_text=(qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday))[$wday];
my $mon_text=(qw(January February March April May June July August September October
November December))[$mon];
$mon++; # with localtime months start at zero
my $day = $mday;
my $date = $day . "/" . $mon . "/" . $year;
my $date_today = $day_text." ".$mday." ".$mon_text.","." ".$year;
my $short_month = lc(substr($mon_text,0,3));
my $newsletterName = $year.$mon.$day;
# where to find the subscriber lists
my $list1 = '/web/www.det/cgi-bin/press_data/subscribe_news1.txt';
my $list2 = '/web/www.det/cgi-bin/press_data/subscribe_news2.txt';
# where to find each of the newsletters
my $newsletter1_path =
"/web/www.det/www/newsroom/yr".$year."/".$short_month."/newsletters/";
my $newsletter1_html = $newsletter1_path.$newsletterName.".htm";
my $newsletter1_text = $newsletter1_path.$newsletterName.".txt";
my $newsletter2_path =
"/web/www.det/www/ministerial/yr".$year."/".$short_month."/newsletters/";
my $newsletter2_html = $newsletter2_path.$newsletterName.".htm";
my $newsletter2_text = $newsletter2_path.$newsletterName.".txt";
# the path to the sendmail library
my $sendmailpath="/usr/sbin/sendmail";
1;
</snip>
Colin Johnstone
Website Project Officer
Corporate Website Unit
Public Affairs Directorate
ph 9561 8643
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]