Scripting with Perl Identify modules from CPAN that can support a graphical user
ID: 3722179 • Letter: S
Question
Scripting with Perl
Identify modules from CPAN that can support a graphical user interface (GUI), network protocol, and database adapters. In your analysis, demonstrate how these modules will make interacting with the system more human-friendly in support of maintaining servers in the data center.
Describe how you will practically interact with CPAN to install the modules that you have identified.
Provide the syntax to create your own custom module that lends itself to being reused. Because the company is focused on managing servers, you might consider a module based on the following examples, but you are free to create your own:
Executes system commands to retrieve system metrics like CPU utilization
Reads information from a flat file and then inserts into a database
Connects to a database and retrieves reporting information
Explanation / Answer
Identify modules from CPAN that can support a graphical user interface (GUI), network protocol, and database adapters.
Answer:
“Win32::GUI is a Win32-platform native graphical user interface toolkit for perl.Basically, it's an XS implementation of most of the functions found in user32.dll and gdi32.dll,with an object oriented perl interface and an event-based dialog model”. (Win32::GUI,n.d).Net::SSH::Perl This module provides a Perl interface to the SSH1 and SSH2 Secure shellprotocols. The module has built-in support for both password and private key authentication,performs automatic encryption of all data, and can read an existing SSH configuration.Use thismodule when your Perl application needs to interface with an SSH-protected host. DBD::mysql“is the Perl5 Database Interface driver for the MySQL database. In other words: DBD::mysql isan interface between the Perl programming language and the MySQL programming API thatcomes with the MySQL relational database management system”( CPAN, 2017)
In your analysis, demonstrate how these modules will make interacting with the system more human-friendly in support of maintaining servers in the data center.
Answer:
These modules are useful for maintaining and connecting to the database; making iteasier to update and make changes if need. DBI requires a database driver module to talk to the database. The driver module handles all of the details about connecting to and communicatingwith the database.
#DATA SOURCE NAME
$dsn = "dbi:mysql:$database:localhost:3306";
# PERL DBI CONNECT
$DBIconnect = DBI->connect($dsn, $user, $password);
Describe how you will practically interact with CPAN to install the modules that youhave identified
Answer:
Installing a new module can be as simple as typingperl -MCPAN -e 'install“Spreadsheet::Parse” inthe terminal;or by typing cpanm in the terminal; select the moduleyou want for example typecpanm “DBD::mysql”
Syntax
Executes system commands to retrieve system metrics like CPU utilization
#calls all subroutines
CSS260_IP1( );
CSS260_IP2( );
CSS260_IP3( );
#Executes system commands
sub MySystem {
die "could not fork " unless defined(my $pid = fork);
eturn waitpid $pid, 0 if $pid; #parent waits for child
exec @_; #replace child with new proces
}# MySystem(_)
# Global variables to gather system data
chomp(my $hostName = `hostname`);
chomp(my $operatingSystem = `uname -s`);
chomp(my $kernelName = `uname -s`);
chomp(my $kernelVersion = `uname -v`);
chomp(my $kernelRelease = `uname -r`);
chomp(my $machineHwName = `uname -m`);
chomp(my $hardwarePlatform = `uname -i`);
chomp(my $processorType = `uname -p`);
# Capture memory statistics
chomp(my $vmMemoryStats = `vmstat`);
# Determine memory utilization and available (i.e. free)
chomp(my $memoryStats = `free`);
# Determine disk utilization
my @diskUtilization = `df -k`;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.