1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
#!/usr/bin/perl
# Change the line above to match the path to perl on your server
###############################################################################
# This software is Copyright.
###############################################################################
# © Webnet77.com 2003-2004 All rights reserved.
###############################################################################
# INDEMNITY:
# THIS SOFTWARE IS PROVEDED WITHOUT ANY WARRANTY WHATSOEVER. USE ENTIRELY AT YOUR
# OWN RISK. NO LIABILITY WHATSOEVER, OF ANY NATURE, WILL BE ASSUMEND BY
# Webnet77.com, IT'S DISTRIBUTORS, RESELLERS OR AGENTS. SHOULD THE SOFTWARE
# DAMAGE YOUR SERVER, CAUSE YOU LOSS OR OTHER FINANCIAL DAMAGE, YOU AGREE YOU
# HAVE NO CLAIM AGINST Webnet77.com IT'S DISTRIBUTORS, RESELLERS OR AGENTS. IF
# YOU DO NOT ACCEPT THESE TERMS YOU MAY NOT USE THIS SOFTWARE.
###############################################################################
# Author: B.R. Maurer.
# Version 1.0.0 - Initial release April 2004
# Purpose of Software: List installed Perl Modules in a nice table.
# Contact information: http://www.Webnet77.com
###############################################################################
###############################################################################
# *****~~~~~INSTALLATION~~~~~***** #
###############################################################################
# 1. Unzip the file. There is only 1 file you need.
# - list-modules.pl (the program)
#
# 4. Upload list-modules.pl to your server in ASCII MODE. NOTE ASCII mode!!!
#
# 5. CHMOD the file to 755.
#
# 6. If you did it all right, you should be ready to go.
# Point your browser to http://yoursite.com/cgi-bin/list-modules.pl
###############################################################################
###############################################################################
# !!!!!!!!!!!!!DO NOT CHANGE ANYTHING BEYOND THIS LINE!!!!!!!!!!!!!
###############################################################################
use CGI qw(:all);
use strict;
my @mods;
#-------------------------------------------------------------------------------
sub list_modules {
my ($n, $msg, $i);
eval "use File::Find;";
if ($@) {
disp_html(qq|<b><font color="#FFFFFF">Sorry, <u>File::Find</u> is not installed on this server.</font></b>|);
}
find(\&wanted, @INC);
@mods = sort {lc($a) cmp lc($b)} @mods;
$n = @mods;
$msg = qq|<p align="center"><font face="Arial" size="3" color="#FFFFFF"><b>Found: $n Modules</b></b></font></p>\n|;
$msg .= qq|<div align="center"><center><table border="0" cellpadding="1" width="90%">\n|;
$msg .= " <tr>\n";
$msg .= qq| <td valign="top"><font face="Arial,Arial" size="1" color="#FFFFFF">\n|;
$i = 0;
foreach (@mods) {
$i++;
$msg .= " $_<br>\n";
if (($i == int(($n / 3) + 2 / 3)) or ($i == int((2 * $n / 3) + 2 / 3 ))) {
$msg .= qq| </td>\n<td valign="top"><font face="Arial,Arial" size="1" color="#FFFFFF">\n|;
}
}
$msg .= " </td>\n </tr>\n</table>\n</center>\n</div>\n";
&disp_html($msg);
}
#-------------------------------------------------------------------------------
sub wanted {
if ($File::Find::name =~ /\.pm$/) {
open(F, $File::Find::name) || return;
while(<F>) {
if (/^ *package +(\S+);/) {
push (@mods, $1);
last;
}
}
close(F);
}
}
#-------------------------------------------------------------------------------
sub disp_html {
my $mods = shift;
print qq|
<html>
<head> <title>LIST MODULES</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<meta HTTP-EQUIV="CHARSET" CONTENT="ISO-8859-1">
<style>
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#FF0000" vlink="#FF0000" alink="#FF0000">
<center>
<table border="0" width="80%" bgcolor="#C0C0C0">
<tr>
<td width="100%" bgcolor="#000080"><p align="center"><b>
<font color="#FFFFFF" size="2" face="Arial">LIST PERL MODULES INSTALLED ON
THIS SERVER</font></b></td>
</tr>
<tr>
<td width="100%" bgcolor="#336699">
<br>$mods<br>
</td>
</tr>
</table>
</center>
<p align="center"><i><font size="1" face="Arial">Free from
<a style="text-decoration: none" title="Great hosting! Great service! Great pricing!" href="http://webnet77.com/">
Webnet77.com</a></font></i></p>
</body>
</html>
|;
exit;
}
#-------------------------------------------------------------------------------
print header();
list_modules; |
Partager