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

Projectcomplete the following queries using hr schema

Project Complete the following queries using HR Schema. Submit your answer in the form of a SQL text file to the Final Project Dropbox. 1. Show first name, last name, start date and end date for all employees. The dates ...

Assignment- relational database design amp

Assignment- Relational Database Design & Implementation Important Note: You are required to submit an electronic copy to ilearn as well as a hard copy of your assignment to the assignment box allocated in the ground floo ...

Sql assignmentwrite 10 sql statements against the student

SQL Assignment Write 10 SQL statements against the STUDENT schema you created for practice lab 1. Your statements should run error-free and should be valid. Submit two separate files: one plain text file (.txt or .sql fi ...

Writing sql statements1 for each movie category show the

Writing SQL statements. 1. For each movie category, show the number of movies in the database of that category, the total number (sum) of nominations (NOMS) and the average length of that type. Include only those categor ...

Write the sql select statement to display the average rent

Write the SQL SELECT statement to display the average rent of the properties. Use the following PROPERTY table to answer the question: PropertyID Type Rooms Rent 306 Apt 3 550 308 House 6 1000 325 Apt 4 625 397 Apt 3 550 ...

Lab structured query language sqlrefer to the database

Lab: Structured Query Language (SQL) Refer to the database design crested in Lab 2: Modifying a Database Design to complete this Lab. Perform the following steps in MySQL: 1. Create the tables and relationships from the ...

Consider a typical sales invoice that would include the

Consider a typical sales invoice that would include the following information. Design a single table to hold all of the information required to store an invoice including this information. Next, apply normalization to re ...

Question 1 create a package deptpkg with the followinga a

Question : 1. Create a package, DEPT_PKG, with the following: a) A public procedure called NEW_DEPT to enter a new department row into the DEPARTMENTS table. The procedure should accept four parameters - one for each col ...

Movie theater database sql commandswrite the sql data

Movie Theater Database: SQL Commands Write the SQL Data Definition Language (DDL) commands to create the movie theater database based upon the below Entity Relationship Model (ERM). Be sure to include commands to create ...

Assignmentwrite sql queries for the books database

Assignment Write SQL queries for the books database (discussed in Section 18.3) that perform each of the following tasks: a) Select all authors from the Authors table with the columns in the order lastName, firstName and ...

  • 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

WalMart Identification of theory and critical discussion

Drawing on the prescribed text and/or relevant academic literature, produce a paper which discusses the nature of group

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro