[30802] in Perl-Users-Digest
Perl-Users Digest, Issue: 2047 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 10 18:09:52 2008
Date: Wed, 10 Dec 2008 15:09:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 10 Dec 2008 Volume: 11 Number: 2047
Today's topics:
Error creating Expect object jaysonhill03@yahoo.com
Re: Error creating Expect object <martien.verbruggen@invalid.see.sig>
Help with syntax ... Object::InsideOut <jpsweden@gmail.com>
Re: Help with syntax ... Object::InsideOut <1usa@llenroc.ude.invalid>
looking up function's doc in emacs <xahlee@gmail.com>
Re: Mathematica 7 compares to other languages w_a_x_man@yahoo.com
Re: Mathematica 7 compares to other languages <kkylheku@gmail.com>
Re: Mathematica 7 compares to other languages <xahlee@gmail.com>
Re: Mathematica 7 compares to other languages <xahlee@gmail.com>
Re: Mathematica 7 compares to other languages <jon@ffconsultancy.com>
Re: Mathematica 7 compares to other languages <jwkenne@attglobal.net>
Re: Mathematica 7 compares to other languages <jon@ffconsultancy.com>
Perl / Sybase usawargamer@yahoo.com
Re: Perl / Sybase <smallpond@juno.com>
Re: Perl / Sybase <joost@zeekat.nl>
Re: perl debugger problem <Peter@PSDT.com>
Re: Trouble with Net::Ping <hjp-usenet2@hjp.at>
Re: Trouble with Net::Ping <hjp-usenet2@hjp.at>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 10 Dec 2008 11:44:43 -0800 (PST)
From: jaysonhill03@yahoo.com
Subject: Error creating Expect object
Message-Id: <dede1ebe-77c1-4d75-af36-a53f7e64c90c@p2g2000prf.googlegroups.com>
I'm running a process that creates many different child processes,
each of which create an Expect object. I'm getting the following
error:
Cannot create a new IO::Tty from fd -1: Invalid argument
The code I use to create the Expect object is as follows:
$self->{myFTPHandle}=new Expect;
$self->{myFTPHandle}->debug($debug);
$self->{myFTPHandle}->raw_pty(1);
$self->{myFTPHandle}->log_stdout(0); # Suppress writing of sftp
replies to stdout
The error is on the instantiation of the object (the new Expect call
above). I'm not sure what, exactly, is causing this error. Any help
would be much appreciated.
O/S: HP-UX B.11.11
perl: 5.6.1
Thanks.
------------------------------
Date: Thu, 11 Dec 2008 08:56:53 +1100
From: Martien Verbruggen <martien.verbruggen@invalid.see.sig>
Subject: Re: Error creating Expect object
Message-Id: <slrngk0ep5.9a5.martien.verbruggen@mgjv.heliotrope.home>
On Wed, 10 Dec 2008 11:44:43 -0800 (PST),
jaysonhill03@yahoo.com <jaysonhill03@yahoo.com> wrote:
> I'm running a process that creates many different child processes,
> each of which create an Expect object. I'm getting the following
> error:
> Cannot create a new IO::Tty from fd -1: Invalid argument
This error actually comes from IO::Tty, not from Expect, and it means
that its allocate_pty() XS function, somehow, thinks that it succeeded
in allocating what it needs (i.e. it returned success), but in fact, it
hasn't correctly completed.
This is either a bug in IO::Tty, or in the libraries that it uses on
your system. You could try having a look at IO::TTy directly to see what
happens.
> O/S: HP-UX B.11.11
> perl: 5.6.1
That's a fairly old Perl installation. Have you checked that the modules
that you're using are up to the latest version? Which Expect and IO::TTy
are you using?
Martien
--
|
Martien Verbruggen | Computers in the future may weigh no
first.last@heliotrope.com.au | more than 1.5 tons. -- Popular
| Mechanics, 1949
------------------------------
Date: Wed, 10 Dec 2008 05:04:38 -0800 (PST)
From: jps <jpsweden@gmail.com>
Subject: Help with syntax ... Object::InsideOut
Message-Id: <303528f9-05af-4328-8597-e45fe990102d@35g2000pry.googlegroups.com>
Hi!
I am trying to grasp the "design pattern" of Object::InsideOut and was
reading this:
http://search.cpan.org/~jdhedden/Object-InsideOut-3.52/lib/Object/InsideOut.pod
Looking at the code-examples, I see things like
my @data
:Field
:Type(numeric)
:Accessor(data);
and
sub init :Init
etc.
What are these syntactic elements ":Field" and ":Init" ?
And what do they mean?
I cannot remember having seen those ":Xxxx" constructs before...
What do you call these elements, so I know what to google for? :)
Thanks for help!
/JP
------------------------------
Date: Wed, 10 Dec 2008 13:44:52 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Help with syntax ... Object::InsideOut
Message-Id: <Xns9B7058FD0E3D4asu1cornelledu@127.0.0.1>
jps <jpsweden@gmail.com> wrote in
news:303528f9-05af-4328-8597-e45fe990102d@35g2000pry.googlegroups.com:
> Hi!
>
> I am trying to grasp the "design pattern" of Object::InsideOut and was
> reading this:
> http://search.cpan.org/~jdhedden/Object-InsideOut-
3.52/lib/Object/InsideOut.pod
>
> Looking at the code-examples, I see things like
>
> my @data
> :Field
> :Type(numeric)
> :Accessor(data);
...
> What are these syntactic elements ":Field" and ":Init" ?
> And what do they mean?
They are called attributes.
http://search.cpan.org/~jdhedden/Object-InsideOut-
3.52/lib/Object/InsideOut.pod#ATTRIBUTES
There are some built-in attributes as well:
http://perldoc.perl.org/attributes.html
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Wed, 10 Dec 2008 13:12:44 -0800 (PST)
From: Xah Lee <xahlee@gmail.com>
Subject: looking up function's doc in emacs
Message-Id: <a7fd6142-79f1-4015-b9fd-62a66f009b28@p2g2000prf.googlegroups.com>
in programing elisp in emacs, i can press =E2=80=9CCtrl+h f=E2=80=9D to loo=
kup the doc
for the function under cursor.
is there such facility when coding in perl, python, php?
(i'm interested in particular python. In perl, i can work around with
=E2=80=9Cperldoc -f functionName=E2=80=9D, and in php it's php.net/function=
Name. Both
of which i have a elisp command with a shortcut that let me jump to
the doc)
Thanks.
Xah
=E2=88=91 http://xahlee.org/
=E2=98=84
------------------------------
Date: Wed, 10 Dec 2008 12:37:50 -0800 (PST)
From: w_a_x_man@yahoo.com
Subject: Re: Mathematica 7 compares to other languages
Message-Id: <b056acfe-72f9-41ca-98d9-56090de21c99@s9g2000prg.googlegroups.com>
On Dec 5, 9:51=A0am, Xah Lee <xah...@gmail.com> wrote:
>
> For those of you who don't know linear algebra but knows coding, this
> means, we want a function whose input is a list of 3 elements say
> {x,y,z}, and output is also a list of 3 elements, say {a,b,c}, with
> the condition that
>
> a =3D x/Sqrt[x^2+y^2+z^2]
> b =3D y/Sqrt[x^2+y^2+z^2]
> c =3D z/Sqrt[x^2+y^2+z^2]
>
> In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java,
> you'll have 50 or hundreds lines.
Ruby:
def norm a
s =3D Math.sqrt(a.map{|x|x*x}.inject{|x,y|x+y})
a.map{|x| x/s}
end
------------------------------
Date: Wed, 10 Dec 2008 21:37:34 +0000 (UTC)
From: Kaz Kylheku <kkylheku@gmail.com>
Subject: Re: Mathematica 7 compares to other languages
Message-Id: <20081226055859.604@gmail.com>
On 2008-12-05, Xah Lee <xahlee@gmail.com> wrote:
> Let's say for example, we want to write a function that takes a vector
> (of linear algebra), and return a vector in the same direction but
> with length 1. In linear algebar terminology, the new vector is called
> the “normalized” vector of the original.
>
> For those of you who don't know linear algebra but knows coding, this
If I were to guess who that would be ...
> means, we want a function whose input is a list of 3 elements say
> {x,y,z}, and output is also a list of 3 elements, say {a,b,c}, with
> the condition that
>
> a = x/Sqrt[x^2+y^2+z^2]
> b = y/Sqrt[x^2+y^2+z^2]
> c = z/Sqrt[x^2+y^2+z^2]
>
> In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java,
> you'll have 50 or hundreds lines.
Really? ``50 or hundreds'' of lines in C?
#include <math.h> /* for sqrt */
void normalize(double *out, double *in)
{
double denom = sqrt(in[0] * in[0] + in[1] * in[1] + in[2] * in[2]);
out[0] = in[0]/denom;
out[1] = in[1]/denom;
out[2] = in[2]/denom;
}
Doh?
Now try writing a device driver for your wireless LAN adapter in Mathematica.
------------------------------
Date: Wed, 10 Dec 2008 14:08:12 -0800 (PST)
From: Xah Lee <xahlee@gmail.com>
Subject: Re: Mathematica 7 compares to other languages
Message-Id: <d92d6549-af70-4502-8e1d-acccb815489d@i20g2000prf.googlegroups.com>
Xah Lee wrote:
> > Let's say for example, we want to write a function that takes a vector
> > (of linear algebra), and return a vector in the same direction but
> > with length 1. In linear algebar terminology, the new vector is called
> > the =E2=80=9Cnormalized=E2=80=9D vector of the original.
>
> > For those of you who don't know linear algebra but knows coding, this
>
> If I were to guess who that would be ...
>
> > means, we want a function whose input is a list of 3 elements say
> > {x,y,z}, and output is also a list of 3 elements, say {a,b,c}, with
> > the condition that
>
> > a =3D x/Sqrt[x^2+y^2+z^2]
> > b =3D y/Sqrt[x^2+y^2+z^2]
> > c =3D z/Sqrt[x^2+y^2+z^2]
>
> > In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java,
> > you'll have 50 or hundreds lines.
Kaz Kylheku wrote:
> Really? ``50 or hundreds'' of lines in C?
>
> #include <math.h> /* for sqrt */
>
> void normalize(double *out, double *in)
> {
> double denom =3D sqrt(in[0] * in[0] + in[1] * in[1] + in[2] * in[=
2]);
>
> out[0] =3D in[0]/denom;
> out[1] =3D in[1]/denom;
> out[2] =3D in[2]/denom;
> }
>
> Doh?
Kaz, pay attention:
Xah wrote: =C2=ABNote, that the =E2=80=9Cnorm=E2=80=9D as defined above wor=
ks for vectors
of any dimention, i.e. list of any length.=C2=BB
The essay on the example of Mathematica expressiveness of defining
Normalize is now cleaned up and archived at:
=E2=80=A2 A Example of Mathematica's Expressiveness
http://xahlee.org/UnixResource_dir/writ/Mathematica_expressiveness.html
Xah
=E2=88=91 http://xahlee.org/
=E2=98=84
------------------------------
Date: Wed, 10 Dec 2008 14:15:09 -0800 (PST)
From: Xah Lee <xahlee@gmail.com>
Subject: Re: Mathematica 7 compares to other languages
Message-Id: <40b4b23f-c1eb-4ac5-bb42-e0f6276e97bf@r37g2000prr.googlegroups.com>
Xah Lee wrote:
> > For those of you who don't know linear algebra but knows coding, this
> > means, we want a function whose input is a list of 3 elements say
> > {x,y,z}, and output is also a list of 3 elements, say {a,b,c}, with
> > the condition that
> >
> > a =3D x/Sqrt[x^2+y^2+z^2]
> > b =3D y/Sqrt[x^2+y^2+z^2]
> > c =3D z/Sqrt[x^2+y^2+z^2]
>
> > In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java,
> > you'll have 50 or hundreds lines.
> >
> > Note, that the =E2=80=9Cnorm=E2=80=9D as defined above works for vector=
s of any
> > dimention, i.e. list of any length.
On Dec 10, 12:37 pm, w_a_x_...@yahoo.com wrote:
> Ruby:
>
> def norm a
> s =3D Math.sqrt(a.map{|x|x*x}.inject{|x,y|x+y})
> a.map{|x| x/s}
> end
I don't know ruby, but i tried to run it and it does not work.
#ruby
def norm a
s =3D Math.sqrt(a.map{|x|x*x}.inject{|x,y|x+y})
a.map{|x| x/s}
end
v =3D [3,4]
p norm(v) # returns [0.6, 0.8]
The correct result for that input would be 5.
Also note, i wrote: =C2=ABNote, that the =E2=80=9Cnorm=E2=80=9D as defined =
above works for
vectors of any dimention, i.e. list of any length.=C2=BB.
For detail, see:
=E2=80=A2 A Example of Mathematica's Expressiveness
http://xahlee.org/UnixResource_dir/writ/Mathematica_expressiveness.html
Xah
=E2=88=91 http://xahlee.org/
=E2=98=84
------------------------------
Date: Wed, 10 Dec 2008 22:23:54 +0000
From: Jon Harrop <jon@ffconsultancy.com>
Subject: Re: Mathematica 7 compares to other languages
Message-Id: <PpmdnTwaZJdH3d3UnZ2dnUVZ8ocAAAAA@posted.plusnet>
Xah Lee wrote:
> On Dec 10, 12:37 pm, w_a_x_...@yahoo.com wrote:
>> Ruby:
>>
>> def norm a
>> s = Math.sqrt(a.map{|x|x*x}.inject{|x,y|x+y})
>> a.map{|x| x/s}
>> end
>
> I don't know ruby, but i tried to run it and it does not work.
>
> #ruby
> def norm a
> s = Math.sqrt(a.map{|x|x*x}.inject{|x,y|x+y})
> a.map{|x| x/s}
> end
>
> v = [3,4]
>
> p norm(v) # returns [0.6, 0.8]
That is the correct answer.
> The correct result for that input would be 5.
No, you're confusing normalization with length.
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
------------------------------
Date: Wed, 10 Dec 2008 17:47:49 -0500
From: John W Kennedy <jwkenne@attglobal.net>
Subject: Re: Mathematica 7 compares to other languages
Message-Id: <49404775$0$4893$607ed4bc@cv.net>
Xah Lee wrote:
> In lisp, python, perl, etc, you'll have 10 or so lines. In C or Java,
> you'll have 50 or hundreds lines.
C:
#include <stdlib.h>
#include <math.h>
void normal(int dim, float* x, float* a) {
float sum = 0.0f;
int i;
float divisor;
for (i = 0; i < dim; ++i) sum += x[i] * x[i];
divisor = sqrt(sum);
for (i = 0; i < dim; ++i) a[i] = x[i]/divisor;
}
Java:
static float[] normal(final float[] x) {
float sum = 0.0f;
for (int i = 0; i < x.length; ++i) sum += x[i] * x[i];
final float divisor = (float) Math.sqrt(sum);
float[] a = new float[x.length];
for (int i = 0; i < x.length; ++i) a[i] = x[i]/divisor;
return a;
}
--
John W. Kennedy
"Never try to take over the international economy based on a radical
feminist agenda if you're not sure your leader isn't a transvestite."
-- David Misch: "She-Spies", "While You Were Out"
------------------------------
Date: Wed, 10 Dec 2008 23:02:08 +0000
From: Jon Harrop <jon@ffconsultancy.com>
Subject: Re: Mathematica 7 compares to other languages
Message-Id: <EdednSau4flN1N3UnZ2dnUVZ8i2dnZ2d@posted.plusnet>
Xah Lee wrote:
> Kaz Kylheku wrote:
>> Really? ``50 or hundreds'' of lines in C?
>>
>> #include <math.h> /* for sqrt */
>>
>> void normalize(double *out, double *in)
>> {
>> double denom = sqrt(in[0] * in[0] + in[1] * in[1] + in[2] *
>> in[2]);
>>
>> out[0] = in[0]/denom;
>> out[1] = in[1]/denom;
>> out[2] = in[2]/denom;
>> }
>>
>> Doh?
>
> Kaz, pay attention:
>
> Xah wrote: «Note, that the “norm” as defined above works for vectors
> of any dimention, i.e. list of any length.»
That is still only 6 lines of C code and not 50 as you claimed:
double il = 0.0;
for (int i=0; i<n; ++i)
il += in[i] * in[i];
il = 1.0 / sqrt(il);
for (int i=0; i<n; ++i)
out[i] = il * in[i];
Try computing the Fourier transform of:
0.007 + 0.01 I, -0.002 - 0.0024 I
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
------------------------------
Date: Wed, 10 Dec 2008 13:25:56 -0800 (PST)
From: usawargamer@yahoo.com
Subject: Perl / Sybase
Message-Id: <975eedfd-2cd1-4139-9f91-c8be0784c212@r10g2000prf.googlegroups.com>
I used to program in C and Perl (up until 2001) (a little C++ and Java
too). Since then I've been a Business Analyst and only coded in VBA/
Excel and written some SQL queries. (we use Sybase)
I am thinking I will either relearn Perl or learn Python (I've heard
nice things about it). Roughly speaking - I want to query the
database, and perform some calculations on the results. Its a pain
doing this in a Sybase stored procedure (basically implementing a
bunch of Excel formulas)
1. What database interface is commonly used? I used to use Sybperl,
not DBI. Is Sybperl still around, and /or outdated?
Is there some good documentation on it, plus some examples of good/
useful code?
2. How difficult is it to install Perl on PC/Windows
machines? I want others to be able to run my small programs.
(I used to runPerl on UNIX and never had to worry about any
installation)
------------------------------
Date: Wed, 10 Dec 2008 13:59:28 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: Perl / Sybase
Message-Id: <1d212203-265b-4712-9529-7cf93fcf0838@c36g2000prc.googlegroups.com>
On Dec 10, 4:25 pm, usawarga...@yahoo.com wrote:
> I used to program in C and Perl (up until 2001) (a little C++ and Java
> too). Since then I've been a Business Analyst and only coded in VBA/
> Excel and written some SQL queries. (we use Sybase)
>
> I am thinking I will either relearn Perl or learn Python (I've heard
> nice things about it). Roughly speaking - I want to query the
> database, and perform some calculations on the results. Its a pain
> doing this in a Sybase stored procedure (basically implementing a
> bunch of Excel formulas)
>
> 1. What database interface is commonly used? I used to use Sybperl,
> not DBI. Is Sybperl still around, and /or outdated?
> Is there some good documentation on it, plus some examples of good/
> useful code?
>
> 2. How difficult is it to install Perl on PC/Windows
> machines? I want others to be able to run my small programs.
> (I used to runPerl on UNIX and never had to worry about any
> installation)
Many people think Python is easier to learn, so not a bad choice.
The advantage of Perl is that there are already libraries for
anything that you might want to do at search.cpan.org.
Use Activestate Perl on Windows (free). Buy their development
tools if you plan to do a lot of Perl work.
------------------------------
Date: Wed, 10 Dec 2008 23:17:54 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: Perl / Sybase
Message-Id: <87prjzptd9.fsf@zeekat.nl>
usawargamer@yahoo.com writes:
> I used to program in C and Perl (up until 2001) (a little C++ and Java
> too). Since then I've been a Business Analyst and only coded in VBA/
> Excel and written some SQL queries. (we use Sybase)
>
> I am thinking I will either relearn Perl or learn Python (I've heard
> nice things about it). Roughly speaking - I want to query the
> database, and perform some calculations on the results. Its a pain
> doing this in a Sybase stored procedure (basically implementing a
> bunch of Excel formulas)
>
>
> 1. What database interface is commonly used? I used to use Sybperl,
> not DBI. Is Sybperl still around, and /or outdated?
> Is there some good documentation on it, plus some examples of good/
> useful code?
DBI is really *the* perl database interface. Though I haven't used
sybase at all, looking at the dates of the latest releases can tell you
a lot about where the maintenance and new features effort is going:
DBD::Sybase (the sybase DBI driver): 31 aug 2008 vs sybperl 9 apr 2005.
> 2. How difficult is it to install Perl on PC/Windows
> machines? I want others to be able to run my small programs.
> (I used to runPerl on UNIX and never had to worry about any
> installation)
activestate's activeperl is probably the easiest to install on
windows. other significant contenders are strawberry perl (a community
effort to provide an easy to install base perl + CPAN installer) and
cygwin perl (based on the good, but fairly heavy cygwin "unix
compatability layer" for win32).
Googling for them should turn up the relevant sites. You may want to try
a few to see which ones work best for you, especially if you need sybase
integration.
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
------------------------------
Date: Wed, 10 Dec 2008 14:39:27 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: perl debugger problem
Message-Id: <zwQ%k.2064$Ir1.540@newsfe05.iad>
On Tue, 09 Dec 2008 14:04:59 +0000, Peter Scott wrote:
> On Tue, 09 Dec 2008 00:57:23 -0800, david wrote:
>> In the perl debugger when using the m command on a module it spawns me
>> the following error.
>>
>> Not a subroutine reference at perl5db.pl line 7930.
> Confirmed. This is a regression from 5.8.8. It appears to stem from
> new code in constant.pm. I shall post a bug report. Thanks!
Erm, I meant to say that it worked in 5.8.8. This bug hasn't occurred
before, hence isn't a regression of any kind.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: Wed, 10 Dec 2008 23:46:54 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Trouble with Net::Ping
Message-Id: <slrngk0hmv.pnb.hjp-usenet2@hrunkner.hjp.at>
On 2008-12-09 06:14, Ted Byers <r.ted.byers@gmail.com> wrote:
> On Dec 8, 7:29pm, Big and Blue <N...@dsl.pipex.com> wrote:
>> Ted Byers wrote:
>> > Here is a little script assembled fromt he documentation for
>> > Net::Ping.
>>
>> That same documentation will show that Net::Ping, by default, tries to
>> open a TCP socket to the destination.
>>
> Yes, I noticed that. I also noticed that the documentation said it
> was the slowest because it is a higher level protocol than the others,
> doing checks the others don't. My recollection is a bit fuzzy, but
> IIRC TCP lives on top of UDP (and thus it makes sense that UDP would
> be faster)
No. UDP and TCP are at the same level - both are layered on IP. Same for
ICMP although it is more tightly coupled to IP.
> and http lives on top of TCP. Since I would expect a web
> client like a browser based on LWP would be using http exchanges,
Maybe I'm mixing up threads, but didn't you have problems with FTP?
That's a different protocol then HTTP. Both use TCP, but you can't debug
either of them properly by trying to connect to TCP port 7 (which is
what Net::Ping does).
> it makes sense that if there is trouble with a given http exchange,
> one should check the foundation it is built on, from the top down.
>
>> > You may choose one of six different protocols to use for the ping. The
>> > "tcp" protocol is the default. Note that a live remote host may still
>> > fail to be pingable by one or more of these protocols. For example,
>> > www.microsoft.comis generally alive but not "icmp" pingable.
>>
>> The ping command uses ICMP.
>>
>> These are different Internet Protocols.
>>
> Yes, I know they're different protocols. But, as you note and I had
> already observed, the documentation says tcp is the default protocol,
> and that www.microsoft.com is generally alive but not icmp pingable.
> That is why I tried the default TCP first.
>
> But there is a problem, here, with what you've written. You say the
> ping command uses ICMP, but you say www.microsoft.com is not ICMP
> pingable. I used the ping command provided by MS with WXP. Why would
> that use ICMP if www.microsoft.com is not ICMP pingable.
MS ping uses ICMP because that's its job. "ping" is the command which
checks if a host replies to ICMP echo requests. For some reason
Microsoft doesn't want its web servers to reply to ICMP echo requests.
Maybe they think you should use a browser to look at a webserver, not
ping ;-).
>> > Is there something in configuring Net::Ping that can make it useful
>> > for automating checking connectivity (in the context of handling
>> > situations where, say, and LWP agent fails to retieve data as expected
>> > - did we get no data because there was no data or because the
>> > connection was lost or some other reason)?
>>
>> LWP itself will tell you that. As noted, the "ping" command itself uses
>> ICMP - a protocol which would be of little use for data transfer, and
>> certainly not used by LWP.
>>
> I don't understand why you're on about ICMP when the documentation
> says it is only one of three protocols, and the default protocol is
> TCP.
Probably to explain why it is possible that the ping command shows a
host as alive (that is it replies to ICMP echo requests) but Net::Ping
doesn't (because a connection request to TCP port 7 (echo) times out),
or vice versa. They are just completely different protocols and a
firewall may block one but not the other. (Incidentally, if a firewall
does block requests with a port-unreachable message, Net::Ping thinks
the host is alive, although it may be down).
> In any event, LWP gives only a mention that a given transfer timed out
> (and it happens only when trying to transfer a multimegabyte file),
> but not why. I DID use the LWP::DebugFile package for this, but the
> data doesn't seem very detailed.
>
> I was, in fact, advised in this forum to check connectivity between
> the machines in the transaction using ping and traceroute.
Yes. The commands "ping" and "traceroute". They already exist and are
almost certainly installed on your linux server. No need to write a
replacement in Perl.
hp
------------------------------
Date: Wed, 10 Dec 2008 23:52:13 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Trouble with Net::Ping
Message-Id: <slrngk0i0v.pnb.hjp-usenet2@hrunkner.hjp.at>
On 2008-12-10 00:25, Big and Blue <No_4@dsl.pipex.com> wrote:
> ping is a command that was written a long time ago. It was written
> just to determine whether system A could connect to system B on a
> single network, and the name comes from the fact that for each
> successful packet sent a sound (ping) was emitted from the speaker of
> the system it was running on so that he author could *hear* what was
> happening as he wandered round the rest of the room checking physical
> connexions (since he couldn't see the screen).
ping does have a "-a" option, but the name almost certainly comes from
the similarity to a submarine's sonar.
hp
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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.
#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 V11 Issue 2047
***************************************