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
use strict; use warnings; use File::Find; use ExtUtils::MM_Unix; use version; my $regex = qr{[^A-Za-z0-9:_\-\.]}; my $finde_ungueltiges_zeichen = sub { my ($string) = @_; my $ret = ''; for (my $z = 0; $z < length($string); $z ++) { if (substr($string,$z,1) =~ $regex) { $ret = 'ord('.ord(substr($string,$z,1)).') an Pos. '.$z; last; } } $ret; }; # Dateien aufnehmen my $scan = sub { my %found; for my $dir (@_) { if (-d $dir) { my $topdir = $dir; find( sub { if (-f $File::Find::name && $File::Find::name =~ /\.pm$/ ) { my $fn = $File::Find::name; $fn =~ s/\Q$topdir//g; $fn =~ s/\//::/g; $fn =~ s/^:://g; $fn =~ s/\.pm//g; if ($fn =~ $regex) { print "Der Modulname '$fn' enthält ungültige(s) Zeichen ".$finde_ungueltiges_zeichen->($fn); } else { $found{$fn} = $File::Find::name; } } }, $dir ); } } %found; }; my %found = $scan->(@INC); # erstmal alle Unterverzeichniss einlesen # Versionen if (keys %found) { my $zeile = 0; foreach my $modul (sort {lc $a cmp lc $b} keys %found) { my $version = MM->parse_version($found{$modul}); if (defined $version && $version ne 'undef') { $version =~ s/ //g; if ($version =~ $regex) { # probiere vorher noch eine andere Alternative https://www.perl-community.de/bat/poard/thread/18292/167420 $version = version->parse($version); } if ($version =~ $regex) { print "Für Modul '$modul' '$found{$modul}' enthält der Versionsstring '$version' ungültige Zeichen\n"; } else { print "Gefunden: '$modul' Version '$version'\n"; } } } }
QuoteCan't locate FileFind.pm in @INC (you may need to install the FileFind module) (
@INC contains: C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/stra
wberry/perl/lib .) at installed_pakets.pl line 3.
BEGIN failed--compilation aborted at installed_pakets.pl line 3.
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
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Users\tappenbeckja>perl -MCPAN -e shell
There seems to be running another CPAN process (pid 7464). Contacting...
Other job not responding. Shall I overwrite the lockfile 'C:\strawberry\cpan\.lo
ck'? (Y/n) [y] y
cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.
cpan> install File:Find
Database was generated on Mon, 29 Sep 2014 10:46:44 GMT
Running install for module 'File::Find'
The most recent version "1.27" of the module "File::Find"
is part of the perl-5.20.0 distribution. To install that, you need to run
force install File::Find --or--
install R/RJ/RJBS/perl-5.20.0.tar.gz
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Stopping: 'install' failed for 'File::Find'.
Failed during this command:
RJBS/perl-5.20.0.tar.gz : make NO isa perl
cpan>
2014-09-30T06:52:56 jan99Du wirst im Programm geschrieben haben:(...)bekomme die Meldung
QuoteCan't locate FileFind.pm in @INC (you may need to install the FileFind module) (
@INC contains: C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib .) at installed_pakets.pl line 3.
BEGIN failed--compilation aborted at installed_pakets.pl line 3.
Wenn ich in das Installationsverzeichnis schaue, dann gibt es unter C:\strawberry\perl\lib\File eine Datei mit dem Namne File.pm
1 2 3
use ExtUtils::Installed; my ($inst) = ExtUtils::Installed->new( skip_cwd => 1 ); my (@modules) = $inst->modules();