Perl Code to Parse File Versions

In various automations,. systems engineers require to determine the version of file to perform a action based on the file version. Here is a excerpt code that checks for the version of a specified file. CODE#1 [code language=”perl”] #=============================================================================== # sub CheckFileVersion #=============================================================================== sub CheckFileVersion { if (-e "$File") { my $cmd = "filever \"$File\""; my $output = `$cmd`; my @lines = split(/ /, $output); my $ver = ($lines[7] eq ”) ? $lines[8] : $lines[7]; my @version = split(/\./, $ver); my $filever = $version[0]; if ($filever) { print "INFO: $File major version is $filever\n"; } else { print "ERROR: Failed […]

Read more

Compiling Perl Modules on Windows

Compiling Perl Modules for Windows systems includes:   Executing Makefile.PL   NMAKE.EXE Test   Generating .ppd Files Commands for compiling Perl Modules on Windows Systems: Ensure you have Visual Studio installed in-order to support the name.exe. For this run VCVARS32.BAT file from VS. C:>path | grep -i vc98 C:>"C:Program FilesMicrosoft Visual StudioVC98BinVCVARS32.BAT" Setting environment for using Microsoft Visual C++ tools. C:> Navigate to the folder where your modules are existing: C:srcSystems-Windows-Log>perl Makefile.PL Checking if your kit is complete… Looks good Writing Makefile for Systems::Windows::Log C:srcSystems-Windows-Log> Run Nmake.exe C:srcSystems-Windows-Log>C:ToolsbinNMAKE.EXE Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. […]

Read more