Line 1... |
Line 1... |
1 |
#! /usr/bin/env perl
|
1 |
#! /usr/bin/env perl
|
2 |
|
2 |
|
3 |
use warnings;
|
3 |
use warnings;
|
4 |
use strict;
|
4 |
use strict;
|
5 |
use open ':std', ':utf8' ; # force all I/O, including disk and STD?, to use utf-8
|
5 |
use open ':std', ':encoding(utf8)' ; # force all I/O, including disk and STD?, to use utf-8
|
- |
|
6 |
use utf8; # Source code encoded using UTF-8, used to ensure output from modules is UTF-8, see tabDelimitedToHash
|
6 |
|
7 |
|
7 |
# sysinfo
|
8 |
# sysinfo
|
8 |
# Author: R. W. Rodolico
|
9 |
# Author: R. W. Rodolico
|
9 |
# Primary client portion of sysinfo system. Will collect information about its current
|
10 |
# Primary client portion of sysinfo system. Will collect information about its current
|
10 |
# host and create a report containing the information. This report can then be processed
|
11 |
# host and create a report containing the information. This report can then be processed
|
Line 197... |
Line 198... |
197 |
# fixed a problem where it did not correctly find the source directory when called from a symbolic link
|
198 |
# fixed a problem where it did not correctly find the source directory when called from a symbolic link
|
198 |
#
|
199 |
#
|
199 |
# Version 3.7.0 20240517 RWR
|
200 |
# Version 3.7.0 20240517 RWR
|
200 |
# Added code to put everything from config file except for moduleDirs, transports and scriptDirs into the report. This allows
|
201 |
# Added code to put everything from config file except for moduleDirs, transports and scriptDirs into the report. This allows
|
201 |
# users to arbitrarily choose to send additional information by simply adding it to the config file.
|
202 |
# users to arbitrarily choose to send additional information by simply adding it to the config file.
|
- |
|
203 |
#
|
- |
|
204 |
# Version 3.7.1 20240518 RWR
|
- |
|
205 |
# Added code to ensure output is UTF-8
|
202 |
|
206 |
|
203 |
|
207 |
|
204 |
# find our location and use it for searching for libraries
|
208 |
# find our location and use it for searching for libraries
|
205 |
BEGIN {
|
209 |
BEGIN {
|
206 |
use FindBin;
|
210 |
use FindBin;
|
Line 216... |
Line 220... |
216 |
my $sourceDir = dirname( abs_path( __FILE__ ) );
|
220 |
my $sourceDir = dirname( abs_path( __FILE__ ) );
|
217 |
|
221 |
|
218 |
# define the version number
|
222 |
# define the version number
|
219 |
# see https://metacpan.org/pod/release/JPEACOCK/version-0.97/lib/version.pod
|
223 |
# see https://metacpan.org/pod/release/JPEACOCK/version-0.97/lib/version.pod
|
220 |
use version;
|
224 |
use version;
|
221 |
our $VERSION = version->declare("v3.7.0");
|
225 |
our $VERSION = version->declare("v3.7.1");
|
222 |
our $DATA_VERSION = version->declare( 'v3.7.0' ); # used in sending the data file. sets version of XML/YAML data file
|
226 |
our $DATA_VERSION = version->declare( 'v3.7.0' ); # used in sending the data file. sets version of XML/YAML data file
|
223 |
|
227 |
|
224 |
# see https://perldoc.perl.org/Getopt/Long.html
|
228 |
# see https://perldoc.perl.org/Getopt/Long.html
|
225 |
use Getopt::Long;
|
229 |
use Getopt::Long;
|
226 |
# allow -vvn (ie, --verbose --verbose --dryrun)
|
230 |
# allow -vvn (ie, --verbose --verbose --dryrun)
|
Line 424... |
Line 428... |
424 |
#
|
428 |
#
|
425 |
#######################################################
|
429 |
#######################################################
|
426 |
sub tabDelimitedToHash {
|
430 |
sub tabDelimitedToHash {
|
427 |
my ($hashRef, $tabdelim) = @_;
|
431 |
my ($hashRef, $tabdelim) = @_;
|
428 |
&logIt( 3, "Entering tabDelimitedToHash" );
|
432 |
&logIt( 3, "Entering tabDelimitedToHash" );
|
- |
|
433 |
|
- |
|
434 |
utf8::encode( $tabdelim ); # ensure this is all utf8, convert if necessary
|
- |
|
435 |
|
429 |
foreach my $line ( split( "\n", $tabdelim ) ) { # split on newlines, then process each line in turn
|
436 |
foreach my $line ( split( "\n", $tabdelim ) ) { # split on newlines, then process each line in turn
|
430 |
$line =~ s/'/\\'/gi; # escape single quotes
|
437 |
$line =~ s/'/\\'/gi; # escape single quotes
|
431 |
my @fields = split( / *\t */, $line ); # get all the field values into array
|
438 |
my @fields = split( / *\t */, $line ); # get all the field values into array
|
432 |
my $theValue = pop @fields; # the last one is the value, so save it
|
439 |
my $theValue = pop @fields; # the last one is the value, so save it
|
433 |
# now, we build a Perl statement that would create the assignment. The goal is
|
440 |
# now, we build a Perl statement that would create the assignment. The goal is
|