Subject: | Patch to avoid using CGI.pm |
I had problems running Javascript::Menu under Win32/Apache-2.0.54/mod_perl-2.0.1/Perl-5.8.7
because of CGI.pm, so I removed its use from the module.
I substituted the calls to CGI.pm's routines with standard string-concat operations.
HTH someone...
--- Menu.pm.orig 2005-11-22 08:54:01.976071418 +0100
+++ Menu.pm 2005-11-21 23:37:33.000000000 +0100
@@ -2,7 +2,6 @@
use strict;
-use CGI;
use Tree::Numbered;
use constant DEFAULT_STYLES => {caption => 'caption',
@@ -12,9 +11,6 @@
our $VERSION = '2.02';
our @ISA = qw(Tree::Numbered);
-# package stuff:
-my $cgi = CGI->new; # Just for HTML shortcuts.
-
# A default action generator. See the args passed to it:
my $default_action = sub {
my $self = shift;
@@ -149,13 +145,9 @@
$action =~ s/([^;])\s*$/$1;/;
my @html; # return value.
- push @html, $cgi->div({-class => $styles->{caption},
- -id => "caption_$unique",
- -onMouseOver => "showMenu(1, 0, 'main_$unique', " .
- "this, 'main_$unique')",
- -onMouseOut => "outOfMenu()",
- -onClick => "${action}hideMenus(0)"
- }, $caption);
+ push(@html,
+ "<div class=\"" . $styles->{caption} . "\" id=\"caption_$unique\" onMouseOver=\"showMenu(1,0,'main_$unique',this,'main_$unique')\" onMouseOut=\"outOfMenu()\" onClick=\"${action}hideMenus(0)\">$caption</div>"
+ );
$self->buildTable(1, 0, $unique, \@html, $args{no_ie}, %$styles);
return @html if (wantarray);
@@ -190,7 +182,8 @@
$name = "s_${serial}_$unique"
}
- my $htmlstr = $cgi->start_table({-class => $style, -id => $name});
+ #my $htmlstr = $cgi->start_table({-class => $style, -id => $name});
+ my $htmlstr = "<table class=\"$style\" id=\"$name\">";
my $next_level = $level + 1;
$self->savePlace;
@@ -207,17 +200,17 @@
$onMouse =~ s/~1/$next_level/e;
$item->buildTable(0, $next_level, $unique, $html, $no_ie, %styles);
- } else {$onMouse = "stopTimer();hideMenus($next_level);";}
+ } else {
+ $onMouse = "stopTimer();hideMenus($next_level);";
+ }
my $caption = $item->getFullCap($no_ie);
$onClick =~ s/([^;])\s*$/$1;/;
- $htmlstr .= $cgi->Tr($cgi->td({-onMouseOver => $onMouse,
- -onClick => "${onClick}hideMenus(0)",
- -onMouseOut => 'outOfMenu()'},
- $caption ));
+ $htmlstr .= "<tr><td onMouseOver=\"$onMouse\" onClick=\"${onClick}hideMenus(0)\" onMouseOut=\"outOfMenu()\">$caption</td></tr>";
}
+
$self->restorePlace;
- $htmlstr .= $cgi->end_table;
+ $htmlstr .= "</table>";
push @$html, $htmlstr;
}