[otrs-cvs] otrs/bin otrs.CheckModules.pl,1.47,1.48

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/bin
In directory lancelot:/tmp/cvs-serv28094/bin

Modified Files:
	otrs.CheckModules.pl 
Log Message:
- Made sure ANSI output works on Win32.
- Moved code to determine if module is installed from EU::MM to a sub in this file; on old perls such as the one in RHEL5 the sub we used does not exist.

Author: mb

Index: otrs.CheckModules.pl
===================================================================
RCS file: /home/cvs/otrs/bin/otrs.CheckModules.pl,v
retrieving revision 1.47
retrieving revision 1.48
diff -2 -u -d -r1.47 -r1.48
--- otrs.CheckModules.pl	15 Jan 2013 17:43:26 -0000	1.47
+++ otrs.CheckModules.pl	15 Jan 2013 20:22:39 -0000	1.48
@@ -32,4 +32,6 @@
 
 use ExtUtils::MakeMaker;
+use File::Path;
+use if $^O eq 'MSWin32', "Win32::Console::ANSI";
 use Term::ANSIColor;
 
@@ -495,11 +497,9 @@
     print '.' x $Length;
 
-    # use internal EU:MM sub to determine if given module is installed
-    # just as in Module::Version
-    my $File = MM->_installed_file_for_module( $Module->{Module} );
+    my $File = _InstalledFileForModule( $Module->{Module} );
     if ($File) {
 
-        # determine version number
-        my $Version = version->parse( MM->parse_version($File) );
+        # determine version number by means of ExtUtils::MakeMaker
+        my $Version = MM->parse_version($File);
 
         # cleanup version number
@@ -580,4 +580,26 @@
 }
 
+sub _InstalledFileForModule {
+
+    # copied from ExtUtils::MakeMaker; it is not available on the
+    # old EU_MM versions that ship with Perl 5.8.
+    my $Prereq = shift;
+    my $File   = "$Prereq.pm";
+    $File =~ s{::}{/}g;
+
+    # traverse @INC to see if the current module is installed in
+    # one of these locations
+    my $Path;
+    PATH:
+    for my $Dir (@INC) {
+        my $PossibleLocation = File::Spec->catfile( $Dir, $File );
+        if ( -r $PossibleLocation ) {
+            $Path = $PossibleLocation;
+            last PATH;
+        }
+    }
+    return $Path;
+}
+
 sub _VersionClean {
     my (%Param) = @_;
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.