homepage Welcome to WebmasterWorld Guest from 54.205.247.203
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
Dynamic Generated Page---Hide/Unhide TS
manik112




msg:3795698
 12:50 am on Nov 28, 2008 (gmt 0)

I have a Perl script which generates the Web Page and its dynamic. Here is my perl script:
!/usr/bin/perl
#
#
# Modified by :
# Modified Date :

use warnings;
use strict;
use Socket;

( my $pgm = $0 ) =~ s{ \A .* / }{}xms;

my $data = {};
my $host = ();
my $poolold = ();

my $POOL_NAME_WIDTH = 30;
my $IP_ADDRESS_WIDTH = 15;

LINE:

open(SMP, "/usr/bin/snmpwalk -c test -v 2c X.X.X.X F5-BIGIP-LOCAL-MIB::ltmPoolMemberStat grep -v -i integer grep -v -i mail grep -v -i syslog ") die "Failed: $!\n";

while ( <SMP> ) {
chomp;
my $line = $_;

$line !~ m{ \S }xms and next LINE;

if ( $line !~ m{
\A
F5-BIGIP-LOCAL-MIB::\w+ [.]
" ( [^"]+ ) "
[.] ipv4 [.]
" ( [^"]+ ) "
}xms
)
{
warn "$pgm: warning: can't parse line: $line\n";
next LINE;
} # if

my (
$pool,
$ip_address,
) = (
$1,
$2,# HTMP Page Display

print "Content-type: text/html\n\n";

print <<ENDOFHTML;
<HTML>
<HEAD>
<TITLE>DashBoard</B></CENTER></TITLE>
<BODY background="/icons/page-background.png">
<body text="#808080">
<IMG SRC="/icons/tst.gif" width="142" height="60" align="left">
<h1 align="center" font size=1> SNMP Page</center></h1>
<br>
<br>
</HEAD>
</HTML>
ENDOFHTML

print "<table border=1>";
print "<tr>";
print "<th>Pool Name</th>";
print "<th>Member</th>";
print "</tr>";

for my $pool ( sort keys %$data ) {
for my $ip_address ( sort keys %{ $data->{ $pool } } ) {
my @numbers = split /\./, $ip_address;
my $raw_ipaddr = pack("C4", @numbers);
$host = (gethostbyaddr($raw_ipaddr, 2))[0];
# printf "%-${POOL_NAME_WIDTH}s %${IP_ADDRESS_WIDTH}s\n\n",
# $pool,
# $host;
# print "<br>\n POOL Name:$pool , Members: $host<br>\n";

if ( $poolold ne $pool ) {
$poolold = $pool ;
}else{
$pool = () ;
}

print "<tr>";
print "<td>$pool</td>";
print "<td>$host</td>";
} # for
} # for

print "</tr>";
print "</table>";

-------->My output is:

Pool Members
a 1
2
3

b 4
5

....

Hence how can I hide members and unhide them when mouse is over Pool i.e. a or b...

Note: The output is Pool is a and members are 1,2,3 and So forth.....In this message its looks like 2 and 3 are Pool and its not aligning the members under members heading.

Thanks

 

phranque




msg:3797404
 12:08 pm on Dec 1, 2008 (gmt 0)

welcome to WebmasterWorld [webmasterworld.com], manik112!

this isn't really a perl issue.
you could use css to add a hover pseudo-class to the Pool column elements and use that to control the visibility of the Members column elements.

you have some problems with the html you are outputting.
there are two body tags and no closing body tag and several displayable inline elements in the head of the document.
the table should be within a body tag, which should be after the head but before the closing html tag.
this may render correctly on some browsers but it won't validate.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved