[10976] in Perl-Users-Digest
Perl-Users Digest, Issue: 4576 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 7 20:07:11 1999
Date: Thu, 7 Jan 99 17:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 7 Jan 1999 Volume: 8 Number: 4576
Today's topics:
A little help with Crypt::SSLeay? (Jennifer Ozzello)
Re: Active Perl / NT: XCopy don't work <beisner@acm.org>
Re: autorun CGI <jdixon@slip.net>
Re: comp/comp3 numbers in Perl or maybe C aixgod@ix.netcom.com
Re: comp/comp3 numbers in Perl or maybe C (Ben Coleman)
Denver Perl Mongers (Chris Fedde)
Does anyone know how to add blind carbon copies (Bcc's) <news@coupon1.com>
Re: geting arguments <jwarner@tivoli.com>
Re: geting arguments <jwarner@tivoli.com>
Re: Getting UNIX Filesystems list? <gellyfish@btinternet.com>
Re: help w/ fnord server & perl <gellyfish@btinternet.com>
Help with hashes. (Laran Coates)
Re: Help with hashes. <chub@healtheon.com>
Re: Help with hashes. <due@murray.fordham.edu>
Re: If Larry Wall's listening out there.... <andrew@geac.co.nz>
Re: line continuation; the switch statement <andrew@geac.co.nz>
Need to replace <DEL>'s in data file <jisand@lanl.gov>
Re: Perl Commands at regular intervals? <aqumsieh@matrox.com>
Re: Perl Criticism (Craig Berry)
Re: ping script in perl ....where can I get one? (Clay Irving)
Re: ping script in perl ....where can I get one? <due@murray.fordham.edu>
Re: Problem with Perl script <gellyfish@btinternet.com>
Sorting question <no_spam_ilya@napavlly.rose.hp.com>
Re: syntax errors (basically, newbie needs help) (Stephen Clouse)
thanks for the line # utility <andrew@geac.co.nz>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 Jan 1999 15:53:59 -0800
From: ozzello@best.com (Jennifer Ozzello)
Subject: A little help with Crypt::SSLeay?
Message-Id: <773hen$o9n$1@shell9.ba.best.com>
Hey all,
I've installed SSLeay and Crypt::SSL localling on my shell account and
I'm trying to test everything using the sample code in the README for
Crypt::SSL
Sample code looks like:
use lib "/users/my/account/local/perl/lib";
require Net::SSL;
$sock = Net::SSL->new(PeerAddr => "my.server.of.interest",
PeerPort => 443) || die "Can't connect";
# Who did we connect to (special Net::SSL methods)?
print $sock->get_peer_certificate->subject_name, "\n";
print $sock->get_cipher, "\n";
# The normal HTTP protocol
$sock->print("GET / HTTP/1.0\n\n");
while ($sock->read($buf, 1024)) {
print $buf;
}
Error message looks like:
$ perl5 -w test.pl
CTX=0
Use of uninitialized value at /users/my/account/local/perl/lib/Net/SSL.
pm line 31.
ctx is not an Crypt::SSLeay::CTX at /users/my/account/local/perl/lib/Ne
t/SSL.pm line 31.
line 30 and 31 from SSL.pm look like:
my $ssl = Crypt::SSLeay::Conn->new(*$self->{'ssl_ctx'}, $self);
if ($ssl->connect <= 0) {
Any suggestions where to look for answers on making this work?
For more background, I'm trying to write a small client to interface
with my online brokerage to keep track of things and page me when
something of interest happens. I'm relatively new to perl and especially
to http(s) but I have worked with gawk a fair amount. Code snippets or
simple pointers to the obvious things I'm missing would be appreciated.
I think I might be missing something fundamental about the https protocol,
with this server you connect to one address which then runs a cgi script
to redirect you towards one of about 20 servers. The initial contact to
the server is http and then it switches to https but I don't know how the
negotiation is accomplished and I was hoping that lwp combined with
Crypt::SSL would hide all that from me.
Thanks,
Jen
------------------------------
Date: Thu, 07 Jan 1999 16:35:49 -0800
From: Steve Beisner <beisner@acm.org>
Subject: Re: Active Perl / NT: XCopy don't work
Message-Id: <369552E5.38C041C0@acm.org>
Well, to start with you need the "/s" switch on the xcopy
command line if you want to copy subdirectories.
Thomas Stieglitz wrote:
>
> Hello all!
>
> I try to copy a whole directory tree via the NT/DOS (?) Command XCopy,
> but it doesn't work.
>
> I've tried the following:
> $mycommand = 'xcopy from to';
> $message = `XCOPY $mycommand`;
> or
> system ($mycommand)
>
> The result is, that nothing happens: Neither $! nor $? are giving any
> results, there are no files copied and there is no message, neither on
> the output screen nor in $message.
>
> If I try other commands as "notepad" as example for an NT Programm or
> "blat" as example for an DOS-program, everything runs well.
>
> Who knows a solution or an other solution for copying whole directory
> trees?
>
> Thanks all, Tom
--
Steve Beisner
California: 805-967-5973 265 Nogal Dr, Santa Barbara CA 93110
Louisiana: 225-638-7359 Box 374, 504 E. Main St, New Roads LA 70760
Email: beisner@acm.org Web: http://www.inkpad.com/steve
Anytime personal phone if I'm available, else vmail: 805-895-5326
------------------------------
Date: Thu, 07 Jan 1999 15:41:33 -0800
From: John Dixon <jdixon@slip.net>
Subject: Re: autorun CGI
Message-Id: <3695462C.DFE91F19@slip.net>
Does the SSI exec have to happen from a SHTML?
THanx for teh response.
JD
Bruce Chu wrote:
> I'm no expert, but there are 2 methods that I've seen:
>
> 1) use SSI to exec a cgi
> 2) use image to refer to the cgi script. I think you may have to return an
> image here
>
> -bruce
>
> John Dixon wrote:
>
> > Anybody have suggestions to get a HTML page to automatically run a CGI
> > when a user hits that page?
> >
> > Thanx
> >
> > JD
------------------------------
Date: Thu, 07 Jan 1999 23:48:18 GMT
From: aixgod@ix.netcom.com
Subject: Re: comp/comp3 numbers in Perl or maybe C
Message-Id: <773h41$o4c$1@nnrp1.dejanews.com>
Wow, I knew someone was going to be able to help me with this - you guys
rule. Ok, I'm guilty of not giving enough information up front.
I'm starting on AIX version 4 on an RS/6000 (which is PowerPC 604 I think).
I'll make my data file from there using Perl (the pack function) and then
I'll ftp it up to the mainframe, which is an Amdahl. I believe it's running
OS/390. I think PowerPC chips support either little or big endian operation
(maybe) so I don't really know what AIX does....I think it's big endian but
I'm not sure.
Now, obviously I can get ftp to translate to EBCDIC for me but will that mess
up my packed numbers? The other option is to use a Perl module to translate
into EBCDIC in advance and then send up in binary mode...pretty sure I can do
that. Opinions?
>From Pack in Perl it looks like I give some type of format field specifier
(sequence of characters). I see that 'h' represents a hex string, low nybble
first while 'H' is high nybble first. From one of the earlier posts it sounds
like I use 'H' for generating the comp3 number? What do I use for the regular
comp number? FYI, the comp numbers are actually just variable field length
specifiers in a data file (so it might 12 chars on one line representing a
name, then 15 char on the next, etc.). I guess DB2's load facility wants it
like that. I'm gonna try and give this a shot even though I'm in over my head
on this...
Thanks again,
Dylan
In article <7729lv$kqp$1@nnrp1.dejanews.com>,
JBHenry@excite.com wrote:
> In article <770851$ct6@dfw-ixnews4.ix.netcom.com>,
> "William M. Klein" <wmklein at ix dot netcom dot com> wrote:
> > For those who are about to scream about the answer that was given by Jeff
> >
> > BUT ALL THE COMP values are HARDWARE/SOFTWARE/COMPILER dependent,
> >
> > Please notice the original reference to "DB2" which makes the assumption
> > that the "mainframe" is an "IBM mainframe" fairly safe.
>
> Yes, that is the assumption I was making. I should have stated that in my
> post, or at least said "YMMV".
>
> > Note to original requester: If you are *NOT* talking about an IBM
> > mainframe, then the answers given below may (and probably ARE) *wrong*
> >
> > FYI,
> > The response given for "COMP" (not COMP-3) is a little incomplete. There
> > are methods in IBM mainframe COBOL of specifying COMP fields that create
> > half-word, full-word, or double-word binary fields (and with many PC
> > products single-byte binary fields - but if you get into PC's, then you
need
> > to worry about big-endian/little-endian issues as well).
>
> You are correct, sir. I never even considered the endianism problem at all.
> You mention it in relation to PC's, but couldn't he have that problem
> transfering data from Unix, as well (at least on some hardware)?
>
> Thanks for the clarification.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 08 Jan 1999 00:21:02 GMT
From: tnguru@termnetinc.com (Ben Coleman)
Subject: Re: comp/comp3 numbers in Perl or maybe C
Message-Id: <36954e87.85557014@news.mindspring.com>
On Thu, 07 Jan 1999 23:48:18 GMT, aixgod@ix.netcom.com wrote:
>Now, obviously I can get ftp to translate to EBCDIC for me but will that mess
>up my packed numbers?
Indeed it will.
>The other option is to use a Perl module to translate
>into EBCDIC in advance and then send up in binary mode...pretty sure I can do
>that. Opinions?
That's the way to go. I had to deal with a similar situation with a
monthly history file we download from an IBM mainframe. The data looked
crazy until we realized that the mainframe vendor was sending the file in
textmode instead of binary mode.
Ben
--
Ben Coleman
Senior Systems Analyst
TermNet Merchant Services, Inc.
Atlanta, GA
------------------------------
Date: 7 Jan 1999 16:58:37 -0700
From: cfedde@cfedde.corp.infobeat.com (Chris Fedde)
Subject: Denver Perl Mongers
Message-Id: <773hnd$a7l$1@cfedde.corp.infobeat.com>
It's time for another Denver Perl Mongers gathering.
Denver/Boulder Perl Mongers
Wynkoop Brewing Co.
1634 18th, DENVER CO
Monday, Jan 18, 1999
6:30PM
See you there.
chris
--
Chris Fedde
303 675 2339
------------------------------
Date: Thu, 7 Jan 1999 19:24:44 -0500
From: "John" <news@coupon1.com>
Subject: Does anyone know how to add blind carbon copies (Bcc's) to Sendmail?
Message-Id: <773iv0$llt$1@camel29.mindspring.com>
For some reason, our Sendmail ignores the "Bcc:account@domain" line.
Thanks.
------------------------------
Date: Thu, 07 Jan 1999 16:27:19 -0600
From: John Warner <jwarner@tivoli.com>
Subject: Re: geting arguments
Message-Id: <369534C7.C8D86596@tivoli.com>
Check out the book _The Official Guide to Programming with CGI.pm_ by
Lincoln Stein. The examples from that book are on-line at
http://www.wiley.com/compbooks/stein/source.html. CGI.pm provides a
couple of ways to capture CGI input.
John Warner
Matevz Sernc wrote:
> Hello
>
> I want that some user click on following link:
> http://www.domain.xyz/cgi-bin/here.cgi?user=mk10
>
> --
> How can i get the part after the "?" in a variable in here.cgi ??
>
> I then want to do an user-dependent output to the browser.
>
> But how to get the "mk10" in a variable ??
>
> Can anyone help me ? (maybe someone has an simple cgi, i can see at)
>
> Regards
>
> Matevz Sernc
------------------------------
Date: Thu, 07 Jan 1999 16:40:54 -0600
From: John Warner <jwarner@tivoli.com>
Subject: Re: geting arguments
Message-Id: <369537F6.A7B93272@tivoli.com>
One other place for good information about Perl based CGI is www.perl.net.
John Warner
John Warner wrote:
> Check out the book _The Official Guide to Programming with CGI.pm_ by
> Lincoln Stein. The examples from that book are on-line at
> http://www.wiley.com/compbooks/stein/source.html. CGI.pm provides a
> couple of ways to capture CGI input.
>
> John Warner
>
> Matevz Sernc wrote:
>
> > Hello
> >
> > I want that some user click on following link:
> > http://www.domain.xyz/cgi-bin/here.cgi?user=mk10
> >
> > --
> > How can i get the part after the "?" in a variable in here.cgi ??
> >
> > I then want to do an user-dependent output to the browser.
> >
> > But how to get the "mk10" in a variable ??
> >
> > Can anyone help me ? (maybe someone has an simple cgi, i can see at)
> >
> > Regards
> >
> > Matevz Sernc
------------------------------
Date: 8 Jan 1999 00:27:59 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Getting UNIX Filesystems list?
Message-Id: <773jef$p8$1@gellyfish.btinternet.com>
On Thu, 07 Jan 1999 16:20:56 GMT lethr@my-dejanews.com wrote:
> Is there a good way to get a list of mounted filesystems within perl? (other
> than using a system call or reading fstab). Ideally, I'd like to get results
> similar to:
>
> df -k |awk '{print $7}' (or whatever field might have the filesystem /dir )
>
I would do *that* like:
#!/usr/bin/perl
open(DF,"/bin/df -k |") || die "Cant execute df - ";
while(<DF>)
{
print +(split(' ',$_))[5],"\n" unless (/mounted/i);
}
close(DF) || die "Error in df";
In effect you're going to have to something like that are read fstab
without getting messy with some very system dependent stuff.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 8 Jan 1999 00:13:20 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: help w/ fnord server & perl
Message-Id: <773ij0$nq$1@gellyfish.btinternet.com>
On Thu, 07 Jan 1999 14:20:35 GMT Tony Baker wrote:
> I could sure use some help. I have the fnord server working and it will
> serve up html files to my browers. I have perl running at it will run
> perl programs in a dos window (win95 sys). However, I cannot seem to
> execute my perl programs in the cgi-bin directory. The brower ignores the
> "action" parameter in the <form method="post" action="http:...">.
>
This is a server configuration issue and nothing particularly to do
with Perl - the symptons would occur whatever language you were using.
I have never heard of this server software but you might try asking the
supplier or perhaps in a newsgroup that is interested in servers.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 7 Jan 1999 23:41:41 GMT
From: lcoates@bu.edu (Laran Coates)
Subject: Help with hashes.
Message-Id: <773gnl$1h1$1@news1.bu.edu>
Can anyone tell me how to increment the value for a particular key of a hash.
In other words, if $key{$val} = 2, how can I increment the value of $key{$val}
to 3.
This action is to be used to change the value of the values for given keys
while iterating through an array of arrays. Every time one of a few
particular values is encountered, the value is incremented. It is basically a
complex counter counting for a number of different things. My data is stored
in a two dimensional array, or a table, and I have an array of hashes.
Everytime a particular circumstance is encountered within my two dimensional
array a correspnding hash value is incremented by one.
I hope this makes sense to some of you out there because I'm having a little
bit of trouble getting my mind around it myself.
Thanks to all.
Please reply by email.
Laran Coates
lcoates@bu.edu
------------------------------
Date: Thu, 07 Jan 1999 15:55:53 -0800
From: Bruce Chu <chub@healtheon.com>
Subject: Re: Help with hashes.
Message-Id: <36954989.FA903224@healtheon.com>
Does $key{$val}++ not work?
-bruce
Laran Coates wrote:
> Can anyone tell me how to increment the value for a particular key of a hash.
> In other words, if $key{$val} = 2, how can I increment the value of $key{$val}
> to 3.
>
> This action is to be used to change the value of the values for given keys
> while iterating through an array of arrays. Every time one of a few
> particular values is encountered, the value is incremented. It is basically a
> complex counter counting for a number of different things. My data is stored
> in a two dimensional array, or a table, and I have an array of hashes.
> Everytime a particular circumstance is encountered within my two dimensional
> array a correspnding hash value is incremented by one.
>
> I hope this makes sense to some of you out there because I'm having a little
> bit of trouble getting my mind around it myself.
>
> Thanks to all.
>
> Please reply by email.
>
> Laran Coates
> lcoates@bu.edu
------------------------------
Date: 8 Jan 1999 00:25:20 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: Help with hashes.
Message-Id: <773j9g$7u$0@206.165.165.140>
Laran Coates wrote in message <773gnl$1h1$1@news1.bu.edu>...
|Can anyone tell me how to increment the value for a particular key of a hash.
|In other words, if $key{$val} = 2, how can I increment the value of
$key{$val}
|to 3.
How about:
#!/usr/local/bin/perl -w
use strict;
my $val = 'increment_me';
my %key;
$key{$val} = 2;
$key{$val}++;
print "key val is now: $key{$val}";
You get the idea.
HTH
AmD
[posted and mailed]
------------------------------
Date: Fri, 8 Jan 1999 13:15:23 +1300
From: "Andrew Mayo" <andrew@geac.co.nz>
Subject: Re: If Larry Wall's listening out there....
Message-Id: <773jj8$amf$1@news.akl.netlink.net.nz>
Tripp Lilley wrote in message <3694F7BD.26F7F6D9@perspex.com>...
>
>However, below is a Perlish answer to your problem. I'm sure it could be
tweaked
>and hacked into something much more concise and expressive. My only design
>criteria was to not use any modules that aren't part of the Perl standard
>distribution. Fixups welcomed.
Now ain't *that* cunning - of course, use Perl to augment itself. How
elegant!
My gratitude for this noble gesture is ubounded - and I suspect a number of
other people out there will be fond of this little perl of wisdom... thanks
very much indeed - I'll go try it out..... (sound of cheerful whistling
diminishes into the distance...)
------------------------------
Date: Fri, 8 Jan 1999 13:33:07 +1300
From: "Andrew Mayo" <andrew@geac.co.nz>
Subject: Re: line continuation; the switch statement
Message-Id: <773k8l$fbh$1@news.akl.netlink.net.nz>
>>Also Programming Perl lists the /x flag as 'use extended regular
>>expressions' and then doesn't appear to document it further. I assume it
>>does something quite different, by the sound of things....
>>
>
>It's there. The last paragraph on page 57 of the second edition:
>
> The /x modifier itself needs a little more explanation. It
[snip]
Yes, I see that *now*, but page 70, right in the middle of the Pattern
Matching section, which is the bit of the book that is rapidly looking
dogeared, says "use extended regular expressions" which I submit is not
perhaps the most obvious explanation. And the same comment appears on page
72, as well. Bit confusing for the newbie......
------------------------------
Date: Thu, 07 Jan 1999 16:54:01 -0700
From: Jeannie Sandoval <jisand@lanl.gov>
Subject: Need to replace <DEL>'s in data file
Message-Id: <36954919.D1A605@lanl.gov>
I need to replace <DEL> with spaces in a text file.
I've tried:
s/\<DEL\>/ /g;
s/<DEL>/ /g;
$pattern = "<DEL>";
s/{$pattern}/ /g;
This worked for me before: s/\^M/g; # to remove all instances
of '^M' from data file.
------------------------------
Date: Tue, 5 Jan 1999 15:12:54 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Perl Commands at regular intervals?
Message-Id: <x3ylnjhlbqx.fsf@tigre.matrox.com>
Arvind Krishnaswamy <arvindk@pa.dec.com> writes:
>
> Is there a way of executing a command inside a Perl script , say , every
> 30 seconds? I am trying to connect to a socket every 30 seconds to check
> for some data which is returned -
>
Of course there is a way! Have a look at alarm().
Basically, you have to define a block of code (subroutine) to be
executed every time the alarm goes off. In your case, I would define
it as:
> 30 seconds? I am trying to connect to a socket every 30 seconds to check
> for some data which is returned -
>
sub my_alarm_routine {
printf MYSOCKET $command;
while <MYSOCKET> {
print $_;
}
$SIG{ALRM} = \&my_alarm_routine;
alarm $interval;
}
or something like that. Then whenever you want to, start the alarm:
$interval = 30;
$SIG{ALRM} = \&my_alarm_routine;
alarm 30;
Every $interval seconds, an ALRM signal will be sent to your process,
which will execute the 'my_alarm_routine' subroutine (which
re-initializes the alarm).
This should be your solution.
Ala
------------------------------
Date: 8 Jan 1999 00:49:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl Criticism
Message-Id: <773kmp$sen$1@marina.cinenet.net>
Martien Verbruggen (mgjv@comdyn.com.au) wrote:
: In article <7739gu$ial$1@nnrp1.dejanews.com>,
: topmind@technologist.com writes:
: > Scripting languages are a subset of programming languages. C, C++,
: > Pascal, and Java are NOT scripting languages, for example.
:
: Huh? This is one that you made up, I suppose? How is sh or csh a
: subset of a programming language?
I think you've misunderstood his statement. There is a set of all
programming languages. His assertion is that there is a well-defined
subset of this set which he labels "scripting languages." He further
asserts that C, C++, Pascal, and Java are not in the "scripting languages"
subset. Presumably, sh and awk and Perl would be in this subset.
: You're only convincing me more that you don't really know what you're
: talking about. There is no real distinction between scripting and
: programming languages. It is an artificial one, and not defined by
: anything globally or generally.
Rather, as he appear to be using the terms, and as I have done myself in
other posts, he is using "programming language" as the most general term,
defining the superset, and "scripting language" to refer to a subset of
programming languages. How to define this subset is the only real issue
(or, conversely, showing that it cannot be meaningfully defined).
It is clear that there is a continuum of "script-ness" in languages. For
example:
* C Compiled/linked to machine code, executed directly
* Java Compiled to bytecode before use, executed by virtual machine
* Perl Compiled to bytecode on each execution, exec'd by "VM"
* sh Compiled line-by-line as read, executed by shell
Where one drops the "scripting language" divide into this kind of sequence
is the root of all argument on this topic.
: Depending on which criteria you use,
: perl is seen as a programming language, or a scripting language.
By my definition, which I believe matches the original posters', all
scripting languages are programming languages. We need a better term for
the complementary subset than "nonscripting languages," but nothing both
pithy and accurate springs to mind.
--
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "The hills were burning, and the wind was raging; and the
clock struck midnight in the Garden of Allah."
------------------------------
Date: 7 Jan 1999 19:00:30 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: ping script in perl ....where can I get one?
Message-Id: <773hqu$kmn@panix.com>
In <7733mb$3m5a$2@news-inn.inet.tele.dk> "Mads" <maso@int.tele.dk> writes:
>I've searched and searched, but I can't find a script that can 'ping'. Are
>there any of you who knows where I can find a ping script (preferably in
>perl)?
Searched and searched? Where?
# perl -MCPAN -e shell
cpan shell -- CPAN exploration and modules installation (v1.43)
ReadLine support enabled
cpan> i /ping/
Going to read /net/local/src/CPAN/sources/authors/01mailrc.txt.gz
Going to read /net/local/src/CPAN/sources/modules/02packages.details.txt.gz
Scanning cache /net/local/src/CPAN/build for sizes
CPAN: LWP loaded ok
Fetching with LWP:
ftp://ftp.cdrom.com/pub/perl/CPAN/modules/03modlist.data.gz
Going to read /net/local/src/CPAN/sources/modules/03modlist.data.gz
Module id = Net::Ping
DESCRIPTION TCP and ICMP ping
CPAN_USERID GSAR (Gurusamy Sarathy <gsar@umich.edu>)
CPAN_VERSION 2.02
CPAN_FILE GSAR/perl5.005_02.tar.gz
DSLI_STATUS SupO (standard,comp.lang.perl.*,perl,object-oriented)
MANPAGE Net::Ping - check a remote host for reachability
INST_FILE /usr/local/lib/perl5/5.00502/Net/Ping.pm
INST_VERSION 2.02
--
Clay Irving
clay@panix.com
------------------------------
Date: 7 Jan 1999 23:03:43 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: ping script in perl ....where can I get one?
Message-Id: <773egf$ikl$0@206.165.165.145>
Mads wrote in message <7733mb$3m5a$2@news-inn.inet.tele.dk>...
|I've searched and searched, but I can't find a script that can 'ping'. Are
|there any of you who knows where I can find a ping script (preferably in
|perl)?
Net::Ping will ping away for you, and I think it meets the specification of
being a script. Or is it that once something becomes a module it is no longer
considered a script? Anyway, if you don't have it installed you can find it
at www.perl.com/CPAN.
Then it is as simple as:
#!/usr/local/bin/perl -w
use strict;
use Net::Ping;
my($ping_obj) = Net::Ping->new("icmp");
#icmp as I am a POB
if ($ping_obj->ping('www.perl.com')) { print "Pong";}
else {print "The sound of silence."}
You get the idea.
HTH
AmD
------------------------------
Date: 8 Jan 1999 00:05:45 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Problem with Perl script
Message-Id: <773i4p$nn$1@gellyfish.btinternet.com>
On Thu, 07 Jan 1999 12:28:18 GMT John wrote:
> I am (a newbie) getting an error message
> 'premature ending of script' for the
> following:
>
I think you mean 'premature end of script headers'
> #!/usr/bin/perl
> #
> &readparse;
> print "Content-type: text/html\n\n";
> #
> #*****************BEGIN BODY*************
> print "<h1>Thank you for filling out the form</h1>";
> $firstname = $value[0];
> $lastname = $value[1];
> $email = $value[2];
>
> print "Your first name is $firstname<BR>";
> print "Your last name is $lastname<BR>";
> print "Your e-mail is $email<BR>";
>
If this is your entire script then your problem is largely due to the
fact that the subroutine 'readparse' is not defined. If you run the
script at the command prompt then it will have told you that.
You probably actually want to be using the module CGI.pm which is well
documented and will help you to debug your programs at the command
line.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 8 Jan 1999 00:26:28 GMT
From: Ilya <no_spam_ilya@napavlly.rose.hp.com>
Subject: Sorting question
Message-Id: <773jbk$gai$1@ocean.cup.hp.com>
If I have an array that I want to sort by 2 fields, I do:
@new_lines=sort by_components @new_lines;
sub by_components
{
(split(/\s+/,$a))[$key1] cmp (split(/\s+/,$b))[$key1]
||
(split(/\s+/,$a))[$key2] cmp (split(/\s+/,$b))[$key2];
}
This will sort the array first by $key1 field and then by $key2 field. My
problem is that sometimes not all lines have $key2 field, i.e. lines that
are not long enough. Everything sorts fine even in that case, but I get
annoying messages of the type:
Use of uninitialized value at ./convert_all.pl line 200.
I need to put an if statement in the by_components sub, but nothing I tried
worked. Any ideas?
Please post your replies, thank you.
------------------------------
Date: Fri, 08 Jan 1999 00:31:11 GMT
From: see.sig@for.address (Stephen Clouse)
Subject: Re: syntax errors (basically, newbie needs help)
Message-Id: <36955008.23331573@news.kc.net>
On Sat, 7 Nov 1998 15:22:17 -0600 in message
<<RC9l2.183$%o5.546@newsfeed.slurp.net> comp.lang.perl.misc>, "Al Dykshorn"
<sitesurf@sitesurf.addr.com> wrote:
First, check your system clock. Dunno about you, but here on my planet, Earth,
it's January 7, 1999.
>I used this in a script....
>
>foreach $name_value_pair (@name_value_pairs)
> {
> ($name,$value)=split('=',$name_value_pair);
> $value=~tr/+/ /g;
> $value=~s/%([0-9A-Fa-f][0-9A-Fa-f])/hex($1)/g;
> $form{$name}=$value;
> }
>
>and get the following errors...
>
>Bareword found where operator expected at ./signupform.cgi line 12, near
>"tr/+/ /g"
>syntax error at ./signupform.cgi line 12, near "tr/+/ /g"
tr doesn't have a g modifier. Did you read the docs?
perldoc -f tr
perldoc perlop
et. al.
And is this a routine to decode CGI parameters? That what it looks like. Use
the CGI module instead.
perldoc CGI
>Also how to I run shell commands from perl, such as, "mkdir"
Did you read the docs?
perldoc -f mkdir
perldoc -f system
perldoc -f exec
perldoc perlfunc
et. al.
>Also in a shell script to append the contents of a variable to a file i do
>this...
>
>echo $variable >> file
>
>so i figured in perl it should be...
>
>print $variable >> file;
>
>but it don't work.
Did you read the docs?
perldoc -f open
perldoc -f print
et. al.
And BTW, did you read the docs?
--
Stephen Clouse -- steve at acme-labs dot com (Anti-Spam enabled)
Acme Labs -- Resident Megalomaniac (http://www.acme-labs.com)
------------------------------
Date: Fri, 8 Jan 1999 13:21:46 +1300
From: "Andrew Mayo" <andrew@geac.co.nz>
Subject: thanks for the line # utility
Message-Id: <773jj9$amf$2@news.akl.netlink.net.nz>
My damn newsreader karked on me as I was posting thanks for the line number
utility that someone posted here and now those messages have been logically
deleted , losing their email address - so I'd just like to say - this was
really helpful and thanks very much.
and also, what a crappy bunch of #$%^ Microsoft Outlook Express is, to be
sure......
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4576
**************************************