[21710] in Perl-Users-Digest
Perl-Users Digest, Issue: 3914 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 4 14:10:18 2002
Date: Fri, 4 Oct 2002 11:05:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 4 Oct 2002 Volume: 10 Number: 3914
Today's topics:
Re: Avoid zombie and get exit status ctcgag@hotmail.com
Re: Avoid zombie and get exit status (Villy Kruse)
Re: Best Method to Check Remote Directory (Bryan Castillo)
Re: Calling a shell from perl without losing control <wksmith@optonline.net>
Re: Can't use string () as an ARRAY ref while "strict r (Tad McClellan)
Re: Dynamically defining subroutines in another package <goldbb2@earthlink.net>
How Does Perl Tell Whether a Java Compile Was Successfu (Kevin Simonson)
Re: How Does Perl Tell Whether a Java Compile Was Succe <krahnj@acm.org>
Re: How to change unix file access timestamp in perl? (Tad McClellan)
Re: IO::Select has limits? or how to use IO::Poll? <crudmail@cox.net>
Re: IO::Select has limits? or how to use IO::Poll? <goldbb2@earthlink.net>
ithreads, perl 5.8 and shared objects <derek@wedgetail.com>
Re: ithreads, perl 5.8 and shared objects <uri@stemsystems.com>
One line to Segfault Perl (Paul Gillingwater)
Re: One line to Segfault Perl (Helgi Briem)
Re: One line to Segfault Perl <spam@thecouch.homeip.net>
Re: One line to Segfault Perl (Mark Jason Dominus)
Re: One line to Segfault Perl (Helgi Briem)
Re: One line to Segfault Perl <andyw2@remove2reply.btconnect.com>
Re: Perl to get DOCUMENT_ROOT on IIS (Helgi Briem)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 04 Oct 2002 15:15:06 GMT
From: ctcgag@hotmail.com
Subject: Re: Avoid zombie and get exit status
Message-Id: <20021004111506.151$79@newsreader.com>
sami@xenetic.fi (Samppa) wrote:
> hello,
>
> The signal option $SIG{CHLD} = 'IGNORE'; is obviously
> used to avoid zombie processes. If I use this option no zombie will
> occur, but I can't receive the child's exit status. If I change the
> signal handling to $SIG{CHLD} = 'DEFAULT'; the child's exit status via
> $? variable is received fine, but also zombie process will occur.
How can you have a zombie with an exit status? I would think something
that produced an exit status has exited, and hence is not a zombie.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service
------------------------------
Date: 04 Oct 2002 15:55:32 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Avoid zombie and get exit status
Message-Id: <slrnaprefk.l87.vek@pharmnl.ohout.pharmapartners.nl>
On 04 Oct 2002 15:15:06 GMT,
ctcgag@hotmail.com <ctcgag@hotmail.com> wrote:
>sami@xenetic.fi (Samppa) wrote:
>> hello,
>>
>> The signal option $SIG{CHLD} = 'IGNORE'; is obviously
>> used to avoid zombie processes. If I use this option no zombie will
>> occur, but I can't receive the child's exit status. If I change the
>> signal handling to $SIG{CHLD} = 'DEFAULT'; the child's exit status via
>> $? variable is received fine, but also zombie process will occur.
>
>How can you have a zombie with an exit status? I would think something
>that produced an exit status has exited, and hence is not a zombie.
>
You can't have an exit status without first having a zombie. The reason
for the existence of a zombie is to save the exit status of a terminated
process until the parent process call wait. At this time the wait
function will retreive that exit status and the zombie have no longer
a reson to exist and it will therefore go away.
Killing the zombies using $SIG{CHLD} = 'IGNORE' will discard the exit
status as soon as the process is terminated, and the exit status will
therefore not be available to the parent process.
Villy
------------------------------
Date: 4 Oct 2002 10:21:35 -0700
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: Best Method to Check Remote Directory
Message-Id: <1bff1830.0210040921.461fd80a@posting.google.com>
> What is the best perl method to check a remote directory recursively to see
> what files and directories uploaded correctly? I'm using Net::FTP, and I
> cannot get a Recursive directory listing with $ftp->ls() or $ftp->dir().
> However, that's probably not the best way.
>
[If you have some say about what is on the remote machine(s)]
See if there is a way to write the search program on the server, which
is called by the client. Perhaps, you have a web-server you can write
a CGI script on, which you can call from the client using LWP. Or
write you own socket code.
[[ If you have no cares about security use rexec ]]
------------------------------
Date: Fri, 4 Oct 2002 09:38:15 -0400
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Calling a shell from perl without losing control
Message-Id: <a%gn9.6494$GF5.127810@news4.srv.hcvlny.cv.net>
"Zeus" <zeus_riposta@yahoo.com> wrote in message
news:3D9CBCF4.4A768641@yahoo.com...
> > The closest that you could do would be something like:
> > open FH, "| csh" or die horribly;
> > print FH "myprog1.csh\n";
> > print FH "myprog2.csh\n";
> > close FH or die horribly;
> >
>
> This does not run myprog1.csh and myprog2.csh from within the opened csh,
> which is my requirement.
>
> Zeus.
>
>
Could you write a third shell script that executes the other two? Run the
new script from perl using backtics, system or pipe as required.
Bill
------------------------------
Date: Fri, 4 Oct 2002 07:51:46 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Can't use string () as an ARRAY ref while "strict refs in use. Eh?
Message-Id: <slrnapr3n2.2r2.tadmc@magna.augustmail.com>
Tassilo v. Parseval <Tassilo.Parseval@post.rwth-aachen.de> wrote:
> Also sprach Simon Harvey:
>
>> Does anyone know what the following means.
It means that "use strict" has saved you from inadvertently using
symbolic references.
> I dont know whys its saying I'm
>> using "Boxing Club" as a Reference. Boxing club should be what is contained
>> in the array!
and you are treating what is contained in the array as
a (symbolic) reference.
>> Any ideas?. I'll put the code at the bottom incase that helps.
Yes it helps, but it is not enough to tell you exactly how
to fix it. We don't know any of the variable's values.
>> if($allClubs[$allClubsCounter][0] == $memberships[$membershipsCounter][2]){
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> These two are the suspects.
Yes, we can guess that one of those has the 'Boxing Club' value in it.
> Remember, this is equivalent to:
>
> $allClubs->[$allClubsCounter]->[0];
No, it is equivalent to:
$allClubs[$allClubsCounter]->[0];
You can only leave the arrow out when it is between subscripts.
So the OP has @allClubs and @memberships arrays.
> So, $allClubs must be a reference to an array
So not that one :-)
> and so must
> $allClubs->[$allClubsCounter].
But those better be (and aren't, according to strict.pm).
> I suggest you print out the
> data-structure to see what's going on:
> use Data::Dumper;
> print Dumper $allClubs;
print Dumper \@allClubs;
print Dumper \@memberships;
> If output looks like this:
So now the expected output should look different.
-----
Using Data::Dumper should be one of the first things you use
when multi-level data structures aren't working as you expect.
I am surprised that none of the multi-level DS "usual suspects"
seems to mention it:
grep Dump perlreftut.pod perlref.pod perllol.pod perldsc.pod
finds nothing!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 04 Oct 2002 13:50:16 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Dynamically defining subroutines in another package
Message-Id: <3D9DD4D8.4E36841B@earthlink.net>
Gupit wrote:
>
> Hi,
> Can I declare a subroutine in another package at run time?
> Something like:
>
> package Base;
> sub new {
> my ($o) = @_;
> my $class = ref($o) || $o;
>
> my $self = bless {}, $class;
>
> $self->{evalHandler} = eval {
> package $class;
> return sub {
> my ($o, $cmd) = @_;
> {
> no strict;
> eval $cmd;
> die $@ if $@;
> }
> };
> };
I would write this as:
eval sprintf q{
package %s;
sub evalHandler {
my $o = shift;
{
no strict;
eval shift;
die $@ if $@;
}
};
}, $class unless defined &{$class . "::evalHandler"};
$self->{evalHandler} = do {
no strict 'refs';
\&{$class . "::evalHandler"};
};
[snip]
> package Derived;
You need a line here saying:
@ISA = qw(Base);
Or:
use base qw(Base);
> use vars qw($foo);
> $foo = 123;
>
> package main;
>
> my $obj = new Derived();
> &$obj->{evalHandler}($obj, 'print $foo');
No need for the '&' in front here:
$obj->{evalHandler}->($obj, 'print $foo');
--
How many Monks would a Chipmonk chip,
if a Chipmonk could chip Monks?
------------------------------
Date: 4 Oct 2002 07:56:01 -0700
From: kvnsmnsn@hotmail.com (Kevin Simonson)
Subject: How Does Perl Tell Whether a Java Compile Was Successful?
Message-Id: <6dfb1603.0210040656.1053ec8e@posting.google.com>
I'm trying to write a Perl script that will compile a Java file and,
if the compile is successful, goes ahead and runs the Java interpreter
on the file's class. My question is, how do I tell whether the Java
compile was successful or not?
If I do the Java compile by hand, then I can check the value of
the Unix "$status" variable after the compile; if it's zero then the
compile was successful, and if it's nonzero then I know the compile
was unsuccessful. How do I access this "$status" variable in my Perl
code? I tried referring to it as '$ENV{"status"}', as in the code be-
low, but my Perl interpreter says that when I access "$Status" it is
uninitialized, and doesn't print out either a zero or any digit. Is
my use of "%ENV" in error? Is there another name for the hash table
that has the values of all the environment variables? Is "$status"
not an environment variable?
Any information on this would be greatly appreciated.
---Kevin Simonson
"Maybe it started as a dream, but doesn't everything?"
from _James and the Giant Peach_
sul+/home/simonkm/Java} cat JavaCompile
#!/usr/bin/perl -w
if ($#ARGV == 0)
{ if (-e "$ARGV[0].Java")
{ print "Backing up \"$ARGV[0].Java\".\n";
print `/home/simonkm/Bin/Backup nw $ARGV[0]`;
if (! -e "$ARGV[0].java")
{ print "ln -s $ARGV[0].Java $ARGV[0].java\n";
print `ln -s $ARGV[0].Java $ARGV[0].java`;
}
print "javac $ARGV[0].java\n";
print `javac $ARGV[0].java`;
$Status = $ENV{"status"};
print "Status is $Status\n";
}
else
{ print "File \"$ARGV[0].Java\" doesn't exist.\n";
}
}
else
{ print "Usage is\n JavaCompile <root>\n";
}
sul+/home/simonkm/Java} JavaCompile Rounder
Backing up "Rounder.Java".
javac Rounder.java
Use of uninitialized value at JavaCompile line 14.
Status is
sul+/home/simonkm/Java}
------------------------------
Date: Fri, 04 Oct 2002 15:05:56 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: How Does Perl Tell Whether a Java Compile Was Successful?
Message-Id: <3D9DAE50.F3E64918@acm.org>
Kevin Simonson wrote:
>
> I'm trying to write a Perl script that will compile a Java file and,
> if the compile is successful, goes ahead and runs the Java interpreter
> on the file's class. My question is, how do I tell whether the Java
> compile was successful or not?
>
> If I do the Java compile by hand, then I can check the value of
> the Unix "$status" variable after the compile; if it's zero then the
> compile was successful, and if it's nonzero then I know the compile
> was unsuccessful.
perldoc -f system
John
--
use Perl;
program
fulfillment
------------------------------
Date: Fri, 4 Oct 2002 08:12:41 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to change unix file access timestamp in perl?
Message-Id: <slrnapr4u9.2r2.tadmc@magna.augustmail.com>
Rodney McDuff <mcduff@its.uq.edu.au> wrote:
[nothing in the body, you should put your question in the body]
perldoc -q timestamp
"How do I set a file's timestamp in perl?"
You should check the Perl FAQ *before* posting to the Perl newsgroup.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 04 Oct 2002 13:47:27 GMT
From: Joel Nelson <crudmail@cox.net>
Subject: Re: IO::Select has limits? or how to use IO::Poll?
Message-Id: <3D9D9D9D.3E3F070B@cox.net>
Benjamin Goldberg wrote:
> Joel Nelson wrote:
> >
> > Benjamin tried to help Joel with::::
> >
> > > > I am trying to build both client and server pieces that can be used to
> > > > stress test a server program being written at work. We run these
> > > > scripts under windows (blech)...
> > > >
> > > > The problem with the server piece is that I need to be able to handle
> > > > at least 1024 connections. IO::Select seems to choke at 127
> > > > connections(clients time out),
> > >
> > > This is a system imposed limitation; it's not perl's fault, but the
> > > fault of the underlying C function call.
> >
> > Hmmm, I'm not a C guy. But how are servers written to handle large numbers
> > of connections (even on windows, like Apache)?
>
> Dunno... download Apache and look at the source?
Hehe, actually I did that recently. Verrrrrry confusing. I'm too novice yet.
> > > > and I am having trouble trying to use arrays of IO::Select objects.
> > >
> > > That's not likely going to work, unless you use timeouts of zero on all
> > > of them... That is, something like:
> > >
> > > while( 1 ) {
> > > foreach my $fh ( map $_->can_read(0), @io_select_objects ) {
> >
> > It looks like your suggesting I don't use the IO::Select but to hold the
> > handles in an array? Then I can do my own can_read(0) calls on the handle?
>
> can_read is a method of IO::Select. I'm suggesting that @io_select_objects
> be an array of IO::Select objects, and you use that method.
Gotcha!
> [snip]
> > > If you have a filehandle which you want to watch for readability, do:
> > > $poll->mask( $fh, POLLIN );
> > > If you have a filehandle which you want to watch for writability, do:
> > > $poll->mask( $fh, POLLOUT );
> > > To watch a handle for both reading and writing:
> > > $poll->mask( $fh, POLLIN|POLLOUT );
> > > To stop watching a handle, do:
> > > $poll->mask( $fh, 0 );
> > >
> > > To block until some handles are ready for reading or writing, and to
> > > find out what those handles are, do:
> > > $poll->poll( $timeout );
> > > my @readok = $poll->handles( POLLRDNORM );
> > > my @writeok = $poll->handles( POLLWRNORM );
> >
> > I did a test and set up a handle in poll with POLLIN|POLLOUT. I tried a
> > $poll->handles(POLLOUT) and it returned 0.
>
> Did you call $poll->poll before calling $poll->handles(POLLOUT)?
>
> Remember, when you call $poll->handles, all it's doing is showing you
> the results of the last call to the ->poll method.
Yeah, I called $poll->poll. I'll do some more testing. Prolly a brain fart on my
part.
[snip]
> > > How many Monks would a Chipmonk chip,
> > > if a Chipmonk could chip Monks?
> >
> > Three! :-)
>
> Ok, but where do you get that number from, though? I've seen "Nun"
> as an answer (coming from Monk vs Nun), but three?
Well, it sounded so much like the "how many licks does it take to get to the
tootsie roll center of a tootsie pop?"
Benjamin, thanks for all your help. I guess I'm surprised that I can't find any
others that have tested the limits of sockets under perl. I will try again with
ideas you have suggested. I am running out of time and may have to switch to
java or maybe even Delphi (my old favorite language). Usually I can whip things
out in perl so fast.....
------------------------------
Date: Fri, 04 Oct 2002 12:56:43 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: IO::Select has limits? or how to use IO::Poll?
Message-Id: <3D9DC84B.9348675A@earthlink.net>
Joel Nelson wrote:
>
> Benjamin Goldberg wrote:
>
> > Joel Nelson wrote:
> > >
> > > Benjamin tried to help Joel with::::
> > >
> > > > > I am trying to build both client and server pieces that can be
> > > > > used to stress test a server program being written at work.
> > > > > We run these scripts under windows (blech)...
> > > > >
> > > > > The problem with the server piece is that I need to be able to
> > > > > handle at least 1024 connections. IO::Select seems to choke
> > > > > at 127 connections(clients time out),
> > > >
> > > > This is a system imposed limitation; it's not perl's fault, but
> > > > the fault of the underlying C function call.
> > >
> > > Hmmm, I'm not a C guy. But how are servers written to handle
> > > large numbers of connections (even on windows, like Apache)?
> >
> > Dunno... download Apache and look at the source?
>
> Hehe, actually I did that recently. Verrrrrry confusing. I'm too
> novice yet.
[snip]
> > > > If you have a filehandle which you want to watch for
> > > > readability, do:
> > > > $poll->mask( $fh, POLLIN );
> > > > If you have a filehandle which you want to watch for
> > > > writability, do:
> > > > $poll->mask( $fh, POLLOUT );
> > > > To watch a handle for both reading and writing:
> > > > $poll->mask( $fh, POLLIN|POLLOUT );
> > > > To stop watching a handle, do:
> > > > $poll->mask( $fh, 0 );
> > > >
> > > > To block until some handles are ready for reading or writing,
> > > > and to find out what those handles are, do:
> > > > $poll->poll( $timeout );
> > > > my @readok = $poll->handles( POLLRDNORM );
> > > > my @writeok = $poll->handles( POLLWRNORM );
> > >
> > > I did a test and set up a handle in poll with POLLIN|POLLOUT. I
> > > tried a $poll->handles(POLLOUT) and it returned 0.
> >
> > Did you call $poll->poll before calling $poll->handles(POLLOUT)?
> >
> > Remember, when you call $poll->handles, all it's doing is showing
> > you the results of the last call to the ->poll method.
>
> Yeah, I called $poll->poll. I'll do some more testing. Prolly a brain
> fart on my part.
Erm, I just noticed... if you want to find the handles ready for
writing, you have to call ->handles with POLLWRNORM, not POLLOUT.
Similarly, if you want handles ready for reading, it's POLLRDNORM, not
POLLIN.
[snip]
> Benjamin, thanks for all your help. I guess I'm surprised that I
> can't find any others that have tested the limits of sockets under
> perl. I will try again with ideas you have suggested. I am running
> out of time and may have to switch to java or maybe even Delphi (my
> old favorite language). Usually I can whip things out in perl so
> fast.....
Remember that java is an interpreted language -- the interpreter is
written in C, just like perl's is. If the underlying C runtime doesn't
support multiplexing lots of sockets, then neither will java.
Of course, since with java, you pretty much *have* to be using threads
(one thread per socket), it's quite possible that it will using a
different API to handle multiplexing than the C select() function, and
that API will be able to handle more sockets.
With Delphi... that's a descendent of Pascal, right?
Would you handle multiple sockets via threads, or via select() or
something similar? If it's threads, then maybe it will work (or maybe
not). If it's select(), then you'll have the same limit as in Perl.
PS: Have you considered upgrading perl to 5.8.0, and using threads
instead of multiplexing?
--
How many Monks would a Chipmonk chip,
if a Chipmonk could chip Monks?
------------------------------
Date: Fri, 04 Oct 2002 09:14:04 GMT
From: Derek Thomson <derek@wedgetail.com>
Subject: ithreads, perl 5.8 and shared objects
Message-Id: <wZcn9.280$i84.19789@news.optus.net.au>
Hi all,
Please excuse the top-posting, but it's necessary to provide a brief
introduction to this query
This question was asked on comp.lang.perl.misc, and then on
comp.lang.perl.moderated some time ago, but did not receive any response.
According to Google, there was an even older post by a completely
different person asking a similar question, the answer to which is that
the code as follows should work.
The problem is that it does not.
This is a very important question, as if we cannot share objects between
threads in Perl, then threading in Perl is, for everything except toy
examples, broken and I will have to be advising people considering Perl
for multithreaded applications that Perl is still *not* thread capable.
Secondly, I'm working on a Perl CORBA ORB
(http://sourceforge.net/projects/perlorb), and if Perl threads aren't
working correctly then there's no way it can properly support
multithreaded servers. I'd really like to know what the story is one way
or another soon.
If we don't see an answer to this problem soon, I guess it's time to
report a bug, and make sure no one starts attempting to use Perl
threading in the meantime, as it just isn't going to work beyond trivial
"passing strings about" demonstrations.
The question's body follows, please reply if you know the answer!
Thanks in advance,
Derek Thomson.
Derek Thomson <derek@wedgetail.com> wrote in message
news:<nhcg9.632$0J2.51051@news.optus.net.au>...
> Hi,
>
> This was posted recently to comp.lang.perl.misc a few days ago, but
> received no answer. I get the same behaviour, and I can't see what's
> wrong with it. It does the right thing as far as I can tell - it shares
> *after* blessing.
>
> How can this be made to work?
The original question:
The following simple program gives this error in Perl 5.8
and I don't understand why. Any help is appreciated:
Can't call method "id" on unblessed reference at s.pl line 23.
======================
#!/usr/local/bin/perl
use strict;
use threads;
use threads::shared;
our %Assoc : shared;
%Assoc=();
MAIN:
{
for (my $i=0;$i<10;$i++) {
my $f=new Foo($i);
share($f);
$Assoc{$i} = $f;
}
foreach my $f (values %Assoc) {
print $f->id() . "\n";
}
}
{
package Foo;
sub new {
my $proto=shift;
my $id=shift;
my $class=ref($proto) || $proto;
my $self = {
ID => $id,
};
bless($self,$class);
return $self;
}
sub id {
my $self=shift;
return $self->{ID};
}
}
------------------------------
Date: Fri, 04 Oct 2002 16:39:46 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: ithreads, perl 5.8 and shared objects
Message-Id: <x7r8f6tay6.fsf@mail.sysarch.com>
>>>>> "DT" == Derek Thomson <derek@wedgetail.com> writes:
DT> Secondly, I'm working on a Perl CORBA ORB
DT> (http://sourceforge.net/projects/perlorb), and if Perl threads aren't
DT> working correctly then there's no way it can properly support
DT> multithreaded servers. I'd really like to know what the story is one
DT> way or another soon.
do you have to use threads? instead try an event loop and message
passing design based stem or poe. then data sharing is trivial and no
mutexes are needed. in many cases the designs are much simpler than
threads and faster since the locking is eliminated. it also means better
scalabilty as you can distribute this design to multiple boxes while
threads can't go beyond one box.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 4 Oct 2002 06:33:06 -0700
From: paul@lanifex.com (Paul Gillingwater)
Subject: One line to Segfault Perl
Message-Id: <f9da71c4.0210040533.7f074b2@posting.google.com>
Here's a Perl script which segfaults Perl:
#!/usr/bin/perl
undef tcp;
-------
Sure, it's a nasty thing to do, but should this be a bug? Segfaults
are never the Right Thing To Do.
------------------------------
Date: Fri, 04 Oct 2002 14:06:31 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: One line to Segfault Perl
Message-Id: <3d9d9fbc.2180320565@news.cis.dfn.de>
On 4 Oct 2002 06:33:06 -0700, paul@lanifex.com (Paul
Gillingwater) wrote:
>Here's a Perl script which segfaults Perl:
>
>#!/usr/bin/perl
>undef tcp;
No it doesn't. All I get is:
Can't modify constant item in undef operator at
undef_tcp.pl line 1, near "tcp;"
Both under Win2000 and RH Linux 7.2.
Activeperl 5.6.1 on both platforms.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Fri, 04 Oct 2002 10:44:41 -0400
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: One line to Segfault Perl
Message-Id: <3D9DA959.1090005@thecouch.homeip.net>
Paul Gillingwater wrote:
> Here's a Perl script which segfaults Perl:
>
> #!/usr/bin/perl
> undef tcp;
Just for the record, I get the same thing:
[mina@blackcorner] ~ $ perl -e 'undef anything;'
Segmentation fault
[mina@blackcorner] ~ $ uname -a
Linux blackcorner 2.4.19 #2 Wed Aug 14 20:59:47 EDT 2002 i686 unknown
[mina@blackcorner] ~ $ perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
Platform:
osname=linux, osvers=2.4.17-0.13smp, archname=i386-linux
uname='linux daffy.perf.redhat.com 2.4.17-0.13smp #1 smp fri feb 1
10:30:48 est 2002 i686 unknown '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc
-Dcf_by=Red Hat, Inc.
-Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386
-linux -Dvendorprefix=/usr
-Dsiteprefix=/usr -Uusethreads -Uuseithreads -Uuselar
gefiles -Dd_dosuid -Dd_semctl_semun -Di_db
-Di_ndbm -Di_gdbm -Di_shadow -Di_sysl
og -Dman3ext=3pm'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=unde f
useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
optimize='-O2 -march=i386 -mcpu=i686',
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.2
2.96-109)', gccos andvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize =4
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options:
Built under linux
Compiled at Apr 1 2002 12:23:22
@INC:
/usr/lib/perl5/5.6.1/i386-linux
/usr/lib/perl5/5.6.1
/usr/lib/perl5/site_perl/5.6.1/i386-linux
/usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.6.1/i386-linux
/usr/lib/perl5/vendor_perl/5.6.1
/usr/lib/perl5/vendor_perl
.
------------------------------
Date: Fri, 4 Oct 2002 14:58:19 +0000 (UTC)
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: One line to Segfault Perl
Message-Id: <ankaab$fj9$1@plover.com>
In article <3d9d9fbc.2180320565@news.cis.dfn.de>,
Helgi Briem <helgi@decode.is> wrote:
>On 4 Oct 2002 06:33:06 -0700, paul@lanifex.com (Paul
>Gillingwater) wrote:
>
>>Here's a Perl script which segfaults Perl:
>>
>>#!/usr/bin/perl
>>undef tcp;
>
>No it doesn't.
I don't think this sort of response is useful. What do you mean "No
it doesn't?" All you really saw was that *you* couldn't get it to
segfault; that doesn't mean it didn't segfault when Paul did it. If
Paul had posted saying that "This program segfaults when Helgi Briem
tries it." then your answer ("No it doesn't") would be correct. But
as it is, you are pretending to knowlege that you don't have.
The correct phrasing is "It doesn't do that when I try it," which,
unlike the answer you did give, is factually correct. Even this
answer is not particularly useful to anyone unless you have something
more constructive to add.
There are many possible explanations the discrepancy between your
observation and Paul's. For example:
1. Perhaps Paul does not know what a segfault looks like and
reported something that never actually occurred.
(unlikely, since segfaults are so clear-cut and obvious)
2. Perhaps you don't know what a segfault looks like.
(unlikely for the same reason)
3. Paul garbled the test code while posting it.
(unlikely, for a test as simple as this one)
4. You garbled the test code while trying it. (ditto)
5. Paul's version of Perl segfaults and yours doesn't. (aha!)
...
What puzzles me is that you seem not to have found explanation #5,
which I would consider the obviously-most-plausible one, by yourself.
Instead you seem to have opted for #1 or #3 or some other peculiar or
unlikely explanation. Perhaps it seems unlikely to you that a certain
example could cause a segfault on one platform but not on another?
> All I get is:
This has no bearing on the question under discussion. When I drive my
car faster than 75 mi/h, the chassis shakes and there is a grinding
sound from under the hood. "No, it doesn't," says Helgi Briem.
"Because when *I* drive *my* car at that speed, neither of those
things happens." Huh?
plover% perl -v
This is perl, v5.6.1 built for i586-linux
...
plover% perl -le 'undef tcp'
Segmentation fault (core dumped)
Now how about that?
Paul, thanks for your report. I will file a bug report for you. In
the future, please use the 'perlbug' utility that comes with Perl when
you want to report a bug; it will append important system and
configuration information to your report that will help avoid
misunderstandings like this in the future.
------------------------------
Date: Fri, 04 Oct 2002 15:33:47 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: One line to Segfault Perl
Message-Id: <3d9db1d1.2184950212@news.cis.dfn.de>
On Fri, 4 Oct 2002 14:58:19 +0000 (UTC), mjd@plover.com
(Mark Jason Dominus) wrote:
> 5. Paul's version of Perl segfaults and yours doesn't. (aha!)
>What puzzles me is that you seem not to have found
>explanation #5, which I would consider the obviously-
>most-plausible one, by yourself.
Actually, I thought it self-evident that explanation #5
was the real one, but as Paul did not say which version
of perl he was using and I was unable to replicate his
results with a current version of perl on 2 different and
common platforms, that he was using some old and
out-of-date perl. My "No, it doesn't" was a kind of
shorthand, perhaps regrettable, for "No, it doesn't now".
I have since repeated the experiment with solaris
and perl5.00503 with identical results. No segfault.
I am at a loss to explain how you and he are able
to segfault with what appear on the surface to be
the same versions of perl that I use.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Fri, 4 Oct 2002 17:58:48 +0000 (UTC)
From: AndyW <andyw2@remove2reply.btconnect.com>
Subject: Re: One line to Segfault Perl
Message-Id: <pan.2002.10.04.17.57.37.227887.4488@remove2reply.btconnect.com>
On Fri, 04 Oct 2002 15:58:19 +0100, Mark Jason Dominus wrote:
<snip>
>
> plover% perl -v
> This is perl, v5.6.1 built for i586-linux
> ...
> plover% perl -le 'undef tcp'
> Segmentation fault (core dumped)
>
> Now how about that?
>
I get on Red Hat Linux 7.3:
[andy@pavilion andy]$ perl -v
This is perl, v5.6.1 built for i386-linux
[andy@pavilion andy]$ perl -le 'undef tcp'
Segmentation fault
And on Red Hat 7.3.94 (beta of Red Hat 8.0):
[andyw@beta andyw]$ perl -v
This is perl, v5.8.0 built for i386-linux-thread-multi
[andyw@beta andyw]$ perl -le 'undef tcp'
Can't modify constant item in undef operator at -e line 1, at EOF
Execution of -e aborted due to compilation errors
So perhaps it's a bug in (Red Hat's build of?) Perl 5.6.1,
now fixed in 5.8.0.
Andy
------------------------------
Date: Fri, 04 Oct 2002 13:29:53 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Perl to get DOCUMENT_ROOT on IIS
Message-Id: <3d9d96d5.2178041548@news.cis.dfn.de>
On Fri, 04 Oct 2002 08:45:28 -0400, add <add@nrcan.gc.ca>
wrote:
>but I think you're talking about Apache here (and that I knew
>how to get it).
>
>IIS doesn't seem to carry DOCUMENT_ROOT
Why don't ask in a more appropriate newsgroup?
How should we know what IIS calls its environment
variables? This is a web server configuration issue
that has nothing whatsoever to do with Perl.
Ask in comp.infosystems.www.servers.ms-windows
for example.
On the other hand you could dump all the environment
variables and look at them:
for ( keys %ENV ) { print "$_\t$ENV{$_}\n"; }
> (hey, don't forget it's Microstuff!)...
What does that have to do with the price of fish?
They are under no onus to use the same (arbitrarily
chosen) variable names as someone else.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
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.
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 V10 Issue 3914
***************************************