Mailinglist Archive: opensuse-programming-de (209 mails)

< Previous Next >
Re: Abfrage vorhandener Perl Module
  • From: "Kroll, Volker" <Kroll@xxxxxxxxx>
  • Date: Fri, 14 Feb 2003 12:11:25 +0100
  • Message-id: <20030214111125.GO2986@xxxxxxxxxxxxxxxxxxxxxx>
On 2003-02-14 09:19:04, bb@xxxxxxxxxx wrote:
> moin,
> wie kann ich erfragen welche Perl Module auf meinem Rechner installiert
> sind.

Ich habe mir dafür ein kleines Skript gebaut, was HTML ausspuckt...
Ist nicht sehr sauber programmiert ;-) ist ne Ausgliederung aus einem
größeren Projekt....

HTH
Volker

----------------------%--------------%----------------------------
#!/usr/bin/perl -w
print "Content-Type: text/html\n\n";

use strict;
use Data::Dumper;
use ExtUtils::Installed;
use Config;

my $perl = getPerlModules();
print $perl;

sub getPerlModules {
my $instmod = ExtUtils::Installed->new();
my $Modules;
my $text = "";
foreach my $module ($instmod->modules()) {
my $version = $instmod->version($module) || "???";
$Modules .= $module . "\t" . $version. "<br>\n";
}

my $INC = '<b>Includepath</b> </td><td>' . shift(@INC) . "<br>";
foreach (@INC) {
$INC .= "\t". $_." <br>\n";
}

my $perladmin = `perl -V:perladmin`;
$perladmin =~ s/[^=]+=(.*)/$1/;
my $perlversion = `perl -V:version`;
$perlversion =~ s/[^=]+=(.*)/$1/;
my $path = `which perl`;
my $confargs = `perl -V:config_args`;
$confargs =~ s/[^=]+=(.*)/$1/;
my $ccf = `perl -V:ccflags`;
$ccf =~ s/[^=]+=(.*)/$1/;
my $cc = `perl -V:cc`;
$cc =~ s/[^=]+=(.*)/$1/;
my $libs = `perl -V:libs`;
$libs =~ s/[^=]+=(.*)/$1/;
my $complete = `perl -V`;
my $date = "";

my(@lines) = split(/\n/, $complete);
foreach (@lines) {
next unless $_ =~ /Compiled at/;
$_ =~ s/Compiled at(.+)/$1/;
$date = $_;
last;
}

$text .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\";>\n";
$text .= "<html>\n";
$text .= "<head>\n";
$text .= " <title>Service</title>\n";
$text .= " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
$text .= " <style type=\"text/css\">\n";
$text .= " body, td { font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 12px; }\n";
$text .= " a { font-weight : bold; color : #da251d; text-decoration : none; }\n";
$text .= " a:hover { font-weight : bold; color : #da251d; text-decoration : underline; }\n";
$text .= " input.login { border: 1px solid #000000; background-color: #f5f5f5; }\n";
$text .= " input.button { border: 1px solid #000000; background-color: #b0c4de; }\n";
$text .= " </style>\n";
$text .= "</head>\n";
$text .= "<body bgcolor=\"#f5f5f5\" background=\"images/bg.gif\">\n";

$text .= "<table width=\"600\" cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#778899\">";

$text .= "<tr bgcolor=\"#f5f5f5\">";
$text .= "<td><b>Administrator</b></td><td>$perladmin</td>\n";
$text .= "</tr>\n<tr bgcolor=\"#f5f5f5\">";
$text .= "<td><b>Version</b></td><td>$perlversion</td>\n";
$text .= "</tr>\n<tr bgcolor=\"#f5f5f5\">";
$text .= "<td><b>Compiled at</b></td><td>$date</td>\n";
$text .= "</tr>\n<tr bgcolor=\"#f5f5f5\">";
$text .= "<td><b>Configured with</b></td><td>$confargs</td> \n";
$text .= "</tr>\n<tr bgcolor=\"#f5f5f5\">";
$text .= "<td><b>Compiled with</b></td><td>$cc</td>\n";
$text .= "</tr>\n<tr bgcolor=\"#f5f5f5\">";
$text .= "<td><b>Compilerflags</b></td><td>$ccf</td>\n";
$text .= "</tr>\n<tr bgcolor=\"#f5f5f5\">";
$text .= "<td><b>Linked against</b></td><td>$libs</td>\n";
$text .= "</tr>\n<tr bgcolor=\"#f5f5f5\">";
$text .= "<td><b>Path</b></td><td>$path</td>\n";
$text .= "</tr>\n<tr bgcolor=\"#f5f5f5\">";
$text .= "<td>\n";
$text .= $INC."</td>\n";
$text .= "</tr>\n<tr bgcolor=\"#f5f5f5\">";
$text .= "<td><b>Installed Modules</b></td>";
$text .= "<td>\n";
$text .= $Modules;
$text .= "</td>\n";
$text .= "</tr>\n";
$text .= "</table>";
$text .= "<small>Output generated by a script by Volker Kroll<br>html-ified by Thorsten Rinne </small>";
$text .= "</body>\n";
$text .= "</html>\n";
return $text;

}

< Previous Next >
Follow Ups
References