Solved

Net::RawIP, getopts.pl

Posted on 2003-12-10
7
812 Views
Last Modified: 2006-11-17
what is the meaning of these lines ?Thank you


#!/usr/bin/perl

require 'getopts.pl';
use Net::RawIP;
use IO::Socket;

Getopts('s:d:p:q:w:t:');
$synPacket = new Net::RawIP;
$ackPacket = new Net::RawIP;

die "Usage $0 -s <IP source> -d <IP destination> -p <source port> -q <dest port> -w <window> -t <ttl>"
unless ($opt_s && $opt_d && $opt_p && $opt_q && $opt_w);
0
Comment
Question by:bertinoflex
  • 3
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
mrh30 earned 25 total points
ID: 9912492
Net::RawIP is a module for manipulating raw IP packets.  See http://search.cpan.org/~skolychev/Net-RawIP-0.1/RawIP.pm for details.

getopts.pl could be anything!  The require before it just means that if it hasn't been loaded already it will be loaded.  There's no way of telling from this code which getops will actually do.

The most likely explanation is that Getopts('s:d:p:q:w:t:') is a function supplied by getopts.pl and that this plucks the command line arguments and puts them in $opt_s etc appropriately.
0
 
LVL 2

Assisted Solution

by:PurplePerls
PurplePerls earned 25 total points
ID: 9912887
0
 
LVL 3

Expert Comment

by:mrh30
ID: 9912918
PurplePerls: There's no guarantee that getopts.pl is the same one though.  It could be anything with the same file name.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 2

Expert Comment

by:PurplePerls
ID: 9913072
From the upper link:
;# getopts.pl - a better getopt.pl

;# Usage:
;#      do Getopts('a:bc');  # -a takes arg. -b & -c not. Sets opt_* as a
;#                           #  side effect.

Of course you are true, it could be anything but getting options :)

0
 
LVL 3

Expert Comment

by:mrh30
ID: 9913092
I do also agree with you though - it is certainly the most likely candidate! :-)
0
 
LVL 20

Expert Comment

by:jmcg
ID: 10218553
Nothing has happened on this question in more than 7 weeks. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
split points between mrh30 and PurplePerls.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Passing shell scripts to run on the SFTP cmd object 12 182
binary to char / hexadecimal 5 114
Perl, group, sort, count question 6 133
Insert Text into odbc.ini file 15 66
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question