I have a script that uses some hash magic to set some variables. It works well in
normal mode, but
when I put it in my /perl directory, it stops working well.
The full script is included. In the script, I set up a hash of variables->subroutines
so that when someone sets a variable, it calles a specific subroutine using
$hash{$value}->()
It doesn't seem to work.
Any ideas?
--
J. J. Horner
[EMAIL PROTECTED]
"The people who vote decide nothing.
The people who count the vote decide everything."
- Josef Stalin
"The tree of liberty must be watered periodically with the
blood of tyrants and patriots alike. ... Resistance to tyrants
is obedience to God."
- Thomas Jefferson
#!/usr/bin/perl -wT
use strict;
use CGI qw(:all);
#use LWP::Simple;
use Apache::Registry;
use lib "/data/2jnetworks/lib";
require 'jjnetworks.pl';
my $header_file = content("/data/2jnetworks/htdocs/header");
my $footer_file = content("/data/2jnetworks/htdocs/footer");
my $q = new CGI;
my %hash = (
Index => \&Index,
Home => \&Index,
Services => \&Index,
ContactUs => \&Index,
Links => \&Index
);
my ($title,$backcolor,$textcolor,$welcome_message,$body_message);
my $value = $q->param('page') || "Index";
$hash{$value}->();
print $q-> header(),
start_html( -title=>"2J Network Services, Inc.",
-bgcolor=>"white",
-text=>"black"
);
print $header_file;
print $q->
h1(
$q->center("$welcome_message")
),
p(
$q->center("$body_message\n")
);
print $footer_file;
print $q-> end_html();
print "\n";
sub Index {
$title = "2J Network Solutions";
$backcolor ="white";
$textcolor = "black";
$welcome_message = "Welcome!!";
$body_message = "Future home of <b>2JNetwork Solutions.</b>";
}
sub Weather {
$title = "Local Weather";
$backcolor = "white";
$textcolor = "black";
$welcome_message = "Current Local Weather from Weather.com:";
$body_message = get_weather();
}
sub Plan {
$title = "Jon's Plan";
$backcolor = "white";
$textcolor = "black";
$welcome_message = "These are the things I have on my drawing board:";
$body_message = content("/data/home/jhorner/.plan");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]