Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask PL-SQL Expert

Objective:  

prepare and test a simple perl program on the linux platform.  You may use any linux system you wish, including the Suse linux installed.

Activities.

To run linux in the lab use Vmware Workstation to run the virtual machine “Clone of OpenSuse 12.1”

Your program is going to function like the linux “ifconfig” command that is used to obtain information about network interfaces.  You will have to install the Net::Int::Stats and Net::Ifconfig::Wrapper packages using CPAN.  The CPAN documentation for the packages describes how the packages are used.  When you run CPAN on the computers in the lab you must run it with root privileges.  First, open a command prompt.  On the lab computers the command prompt is called XTerm and is listed in the menu under System Tools.  At the prompt enter

sudo perl -MCPAN -e shell

you will be asked for the root password, which is “tcpip”.   CPAN may ask for detailed configuration.
The linux ifconfig command can also be used to configure network interfaces, and, with no parameters will display information about all of the available interfaces.  Our program will not be able to set information, and will expect an interface name as a parameter.  It will then display information similar to what would be obtained by a command like “ifconfig eth0”.
To run the ifconfig command on the computers in the lab you must run the command with root privileges.  First, open a command prompt.  At the prompt enter

sudo /sbin/ifconfig

you will be asked for the root password, which is “tcpip”.

The Net::Int::Stats package has a constructor method called “new” which returns an object reference

$get_Iface_data = Net::Int::Stats->new();

A method of this object can be used to retrieve information about an interface like this

my $Iface     = $ARGV[0];
my $rx_packets  = $get_Iface_data->value($Iface, 'rx_packets');

The Net::Ifconfig::Wrapper package returns a complicated hash ref, from which information about an interface can be extracted.  This statement gets the hash ref:

my $Iface_Info = Net::Ifconfig::Wrapper::Ifconfig('list', '', '', '');

Then statements like these provide access to the data:

print "\tether ". $Iface_Info->{$Iface}{'ether'}."\n";

In this statement $Iface_Info is a hash ref, $Iface_Info->{$Iface} refers to the data in the hash corresponding to the key value contained in $Iface.  That data is also a hash, and $Iface_Info->{$Iface}{'ether'} refers to the data in this hash corresponding to the key value 'ether'.

This statement gets address and mask values, and since an interface can have more than one address it has to loop through a list contained in a hash,

while (my ($Addr, $Mask) = each(%{$Info->{$int}{'inet'}}))
      { print "\tinet $Mask $Addr"; };

Deliverable:

Include comments in your program that describe, for ex,  what the object methods do, and how the data returned by Net::Ifconfig::Wrapper  is structured.  Private variables are to be used and the “use strict” pragma should be invoked at the start of the program.  The -w option should be present in the shabang line.

PL-SQL, Programming

  • Category:- PL-SQL
  • Reference No.:- M9545

Have any Question? 


Related Questions in PL-SQL

The stevens company is converting from the sql server

The Stevens Company is converting from the SQL Server database to the Oracle database. Using the sample shown below, create a Risk Information Sheet for at least five potential risks that might be encountered during the ...

Use mysql workbench for these questions do not use

Use MySQL Workbench for these questions. Do NOT use Lucidchart. MySQL Workbench has more capability than Lucidchart, as it allows creation of DDL SQL from the model. Turn in 1 Workbench file , 1 document with the forward ...

These exercises all use the createmyguitarshopsql links to

These exercises all use the create_my_guitar_shop.sql (Links to an external site.). Write the code for each and save the code (each code segment identified and separated) in Notepad. Submit your completed assignment via ...

The following assignment is based on the database

The following assignment is based on the database environment created Design and develop the below queries using professional principles and standards: • A set of SQL Statements that returns all rows and all data for eac ...

Sql fundamentalsprojectwrite a script that will create the

SQL Fundamentals Project Write a script that will create the below tables with the indicated relations. Your script must build a database that contains the tables specified in the diagram. You can use any name for your d ...

Database assignment aggregate functions nested queries

Database Assignment: Aggregate Functions, Nested Queries, Union, Intersect, Except Name__Shelly Rideout Write the SQL code for the following queries (you do not have to give the results of the query) 1. List the employee ...

Case study susan the sql programmerplease assist with the

Case Study: Susan the SQL Programmer Please assist with the following. CASE EXAMPLE IS ATTACHED AS A .JPG Read the case example about Susan the SQL Programmer on page 6-1 of the Ethical Hacking and Countermeasures: Web A ...

Using the data model shown below write sql statements as

Using the data model shown below write SQL statements as specified below. Some questions may require more than one SQL statement to get the full answer. You may make up whatever data values you like to complete the assig ...

Module triggersmodule overview- in this module you will

Module Triggers Module Overview - In this module you will learn how to write PL/SQL and T-SQL triggers Objectives After completing this module you will be able: - to develop, test and debug Oracle PL/SQL triggers - to de ...

What is sqlanswer the following question in 500 words or

What is SQL Answer the following question in 500 words or more. You MUST use two outside sources to support your answer. You MUST cite these sources in APA Format. Title page, reference page, or cited sources do not coun ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate