From 52fee7ed363e9566bfd9b2e32ade1790bcf809aa Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 25 Feb 2010 14:50:26 +0000 Subject: [PATCH] Erst mal abgeschlossen git-svn-id: http://svn.brehm-online.com/svn/my-stuff/Perl@40 ec8d2aa5-1599-4edb-8739-2b3a1bc399aa --- bin/get-perl-modules.pl | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/bin/get-perl-modules.pl b/bin/get-perl-modules.pl index 3313279..3e289d2 100755 --- a/bin/get-perl-modules.pl +++ b/bin/get-perl-modules.pl @@ -73,12 +73,13 @@ our $VERSION = "1.0." . $Revisn; my $module = {}; -my ( $verbose, $cur_dir, $cmdline_verbose, $DebugLevel, $help, $show_version, $get_module_version ); +my ( $verbose, $cur_dir, $cmdline_verbose, $DebugLevel, $help, $show_version, $get_module_version, $short ); unless ( GetOptions( "verbose|v+" => \$cmdline_verbose, "get-module-version|get-version|gv" => \$get_module_version, + "short|s" => \$short, "DebugLevel|Debug|D=i" => \$DebugLevel, "help|h|?" => \$help, "version|V" => \$show_version, @@ -102,6 +103,11 @@ if ($show_version) { exit 0; } +if ( $verbose and $short ) { + warn "Optionen --verbose und --short vertragen sich nicht.\n"; + exit 1; +} + print "Geladene Module: " . Dumper(\%INC) if $verbose > 1; my $arch = $Config{'archname'}; @@ -219,10 +225,16 @@ print "\nGefundene Module:\n\n" if $verbose; printf "insgesamt %d Module gefunden.\n\n", $global_count if $verbose; for my $m ( sort { lc($a) cmp lc($b) } keys %$module ) { - printf " - %s\n", $m; - for my $mod_info ( @{ $module->{$m}{'locations'} } ) { - my $version = $get_module_version ? ( " (" . $mod_info->{'version'} . ")" ) : ''; - printf " %-11s %s%s\n", $mod_info->{'loc'}, $mod_info->{'path'}, $version; + if ( $short ) { + my $version = $get_module_version ? ( " (" . $module->{$m}{'version'} . ")" ) : ''; + printf "%-11s %s%s\n", $module->{$m}{'first_location'}, $m, $version; + } + else { + printf " - %s\n", $m; + for my $mod_info ( @{ $module->{$m}{'locations'} } ) { + my $version = $get_module_version ? ( " (" . $mod_info->{'version'} . ")" ) : ''; + printf " %-11s %s%s\n", $mod_info->{'loc'}, $mod_info->{'path'}, $version; + } } } -- 2.39.5