[27975] in Perl-Users-Digest
Perl-Users Digest, Issue: 9339 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 22 06:05:37 2006
Date: Thu, 22 Jun 2006 03:05:04 -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 Thu, 22 Jun 2006 Volume: 10 Number: 9339
Today's topics:
Re: How to open Perl.5.8.6.Core for Viewing Errors <benmorrow@tiscali.co.uk>
Re: How to open Perl.5.8.6.Core for Viewing Errors <janicehwang1325@yahoo.com>
Re: How to open Perl.5.8.6.Core for Viewing Errors <benmorrow@tiscali.co.uk>
Re: How to open Perl.5.8.6.Core for Viewing Errors <janicehwang1325@yahoo.com>
Re: OO Perl help for a dot Net convert? ben.wilder@gmail.com
Re: perl programmer needed <john@castleamber.com>
Re: perl programmer needed usenet@DavidFilmer.com
Re: perl programmer needed usenet@DavidFilmer.com
Running another program in daemon server <janicehwang1325@yahoo.com>
Re: Special variable "@$" (Heinrich Mislik)
Re: What is a type error? <pc@p-cos.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 22 Jun 2006 08:14:59 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: How to open Perl.5.8.6.Core for Viewing Errors
Message-Id: <jkspm3-it7.ln1@osiris.mauzo.dyndns.org>
Quoth "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>:
>
> I have errors in my program and i think Perl5.8.6.core is where all
> the erros logged. However, it's in unreadable form. Is there anyway to
> open the file and read?
This is a core dump (you are using a Unix machine, right?). Can you
provide a minimal script that causes it to happen? Perl should never
core dump, so someone should file a bug.
Ben
--
It will be seen that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher convinces them that their institutions are not based
on the strictest morality. [Samuel Butler, paraphrased] benmorrow@tiscali.co.uk
------------------------------
Date: 22 Jun 2006 00:35:35 -0700
From: "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>
Subject: Re: How to open Perl.5.8.6.Core for Viewing Errors
Message-Id: <1150961735.347098.286750@g10g2000cwb.googlegroups.com>
Here is my code posted before,
#the code here would be creating IO::Socket::SSL connection for the
client to connect with.
#run as daemon
sub handle_connection{
$dbh = DBI->connect("DBI:mysql:test_mrtg", "root",
'password'),{RaiseError => 1, AutoCommit => 0} || die ("Cannot connect
to database");
#$outpath =
"/usr/home/extol/testing/SocketProgramming/MRTG/THREAD/serverAlert.log";
$s = shift;
$output = shift || $s;
#$s->autoflush(1);
$exit = 0;
#print $s "Welcome to $0; Send me the new log.....\n";
my ($peer_cert, $subject_name, $issuer_name, $date, $str);
if( ! $s ) {
warn "error: ", $s->errstr, "\n";
$exit = 1;
break;
}
while(<$s>){
if( ref($s) eq "IO::Socket::SSL") {
$subject_name =
$s->peer_certificate("subject");
$issuer_name = $s->peer_certificate("issuer");
print $_;
chomp($_);
if(/done/i)
{
last;
}
else{
@info = split(/\s+/, $_);
$date = $info[0];
$type = $info[1];
$service = $info[2];
$hostname = $info[3];
$sourceIP = $info[4];
$destIP = $info[5];
$customer = $info[6];
$count = $info[7];
$downtime = $info[8];
$uptime = $info[9];
$checked = $info[10];
lock($date);
lock($type);
lock($service);
lock($hostname);
lock($sourceIP);
lock($destIP);
lock($customer);
lock($count);
lock($downtime);
lock($uptime);
lock($checked);
#check if the same record exist in the summary table. If does,
update the table
$checksame = "select count(*) from summary
where Type = '$type' AND Service = '$service' AND Hostname =
'$hostname' AND sourceIP = '$sourceIP' AND destIp = '$destIP' AND
customer = '$customer' AND Checked = 0 ";
$checkexist = $dbh->prepare($checksame);
$checkexist->execute or die "can't check\n";
$countsame = $checkexist->fetchrow_array;
if($countsame > 0) #the record exist
{
$sqlconfig = "update summary set Date
= '$date',CountDown = '$count',Downtime = '$downtime', Uptime =
'$uptime', Checked = '$checked' WHERE Type = '$type' AND Service =
'$service' AND Hostname = '$hostname' AND sourceIP = '$sourceIP' AND
destIp ='$destIP' AND customer = '$customer' AND Checked = 0";
$update = $dbh->prepare($sqlconfig);
$update->execute or die "can't update
uptime\n";
}
else
{
#insert into the database
$sql = "insert into summary values
('$date','$type','$service','$hostname','$sourceIP','$destIP','$customer','$count','$downtime','$uptime',0,'$checked')";
$insert = $dbh->prepare($sql);
$insert->execute or die "cannot be insert\n";
}
$checkexist->finish();
#query the database to get the record with the above information
$sql = "select * from summary where (CountDown >=3
AND SendMail = 0) OR (Checked = 1 AND SendMail = 0) OR (CountDown >=3
AND SendMail = 1 AND Checked = 0)";
$send = $dbh->prepare($sql);
$send->execute or die "cannot execute\n";
while(@row = $send->fetchrow_array)
{
$DataDate = $row[0];
$DataType = $row[1];
$DataService = $row[2];
$DataHostname = $row[3];
$DataIP = $row[4];
$DataDest = $row[5];
$DataCustomer = $row[6];
$DataCount = $row[7];
$DataDown = $row[8];
$DataUp = $row[9];
lock($DataDate);
lock($DataType);
lock($DataService);
lock($DataHostname);
lock($DataIP);
lock($DataDest);
lock($DataCustomer);
lock($DataCount);
lock($DataDown);
lock($DataUp);
#send Alert by using above information
#$subject = "TESTING!!Alerts from $DataType";
#$message = "\r\n \t Date : $DataDate \r\n \t
Type : $DataType \r\n \t Service : $DataService \r\n \t IP : $DataIP
\r\n \t Destination : $DataDest \r\n \t Customer : $DataCustomer \r\n
\t Number of Down Time : $DataCount \r\n \t Last Down Time : $DataDown
\r\n \t Up Time : $DataUp \r\n\r\n";
#`/usr/local/mss_dev/tcpmail/mailalert
"$subject" "$message"`;
#send message to server on extol side
#print "Extol :$DataDate $DataType $DataService $DataHostname
$DataIP $DataDest $DataCustomer $DataCount $DataDown $DataUp\n";
#after send alert, set SendMail flag to 1
$set = "update summary set SendMail = 1 where
Date='$DataDate' AND Type='$DataType' AND Service='$DataService' AND
Hostname='$DataHostname' AND sourceIP = '$DataIP' AND destIP =
'$DataDest' AND customer = '$DataCustomer' AND CountDown = '$DataDown'
AND Uptime = '$DataUp' OR (Checked = 1 AND SendMail = 0) OR (Checked =
0 AND SendMail = 0)";
$setMail = $dbh->prepare($set);
$setMail->execute or die "cannot update
SendMail\n";
}
$send->finish();
}
}
else{
$exit = 1;
}
last if ($exit == 1);
}
$dbh->disconnect;
}
while(1){
while(($s = $sock->accept())) {
$s->autoflush(1);
$thread = threads->create(\&handle_connection, $s);
$thread->detach;
}
}
The scenario is: This server do accept connections from different
clients and storing the data from different client into the database.
However, after running some time, the out of memory error and the
program stopped. Therefore, I would like to check the errors from the
core file to find the bugs. I try to debug the program many times, but
the error still occur.
Ben Morrow wrote:
> Quoth "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>:
> >
> > I have errors in my program and i think Perl5.8.6.core is where all
> > the erros logged. However, it's in unreadable form. Is there anyway to
> > open the file and read?
>
> This is a core dump (you are using a Unix machine, right?). Can you
> provide a minimal script that causes it to happen? Perl should never
> core dump, so someone should file a bug.
>
> Ben
>
> --
> It will be seen that the Erwhonians are a meek and long-suffering people,
> easily led by the nose, and quick to offer up common sense at the shrine of
> logic, when a philosopher convinces them that their institutions are not based
> on the strictest morality. [Samuel Butler, paraphrased] benmorrow@tiscali.co.uk
------------------------------
Date: Thu, 22 Jun 2006 09:19:43 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: How to open Perl.5.8.6.Core for Viewing Errors
Message-Id: <vd0qm3-sc8.ln1@osiris.mauzo.dyndns.org>
[ quoting fixed. please quote properly ]
Quoth "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>:
> Ben Morrow wrote:
> > Quoth "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>:
> > >
> > > I have errors in my program and i think Perl5.8.6.core is where all
> > > the erros logged. However, it's in unreadable form. Is there anyway to
> > > open the file and read?
> >
> > This is a core dump (you are using a Unix machine, right?). Can you
> > provide a minimal script that causes it to happen? Perl should never
> > core dump, so someone should file a bug.
>
> Here is my code posted before,
Firstly, that is hardly a minimal script. There is no way anyone could
have any idea what in that script is causing the problem.
<snipped>
> The scenario is: This server do accept connections from different
> clients and storing the data from different client into the database.
> However, after running some time, the out of memory error and the
> program stopped.
Well then, you're running out of memory. I'm slightly surprised you get
a core dump, though.
> Therefore, I would like to check the errors from the
> core file to find the bugs.
The core file will be of no use to you, unless you are familiar with
Perl internals.
I can't see anything obviously wrong with the code, but as I said you
want to see if you can reduce the test-case first. My only thought would
be: you seem to be creating a whole lot of threads: are you sure they're
terminating?
Ben
--
Outside of a dog, a book is a man's best friend.
Inside of a dog, it's too dark to read.
benmorrow@tiscali.co.uk Groucho Marx
------------------------------
Date: 22 Jun 2006 02:29:41 -0700
From: "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>
Subject: Re: How to open Perl.5.8.6.Core for Viewing Errors
Message-Id: <1150968581.698573.153200@g10g2000cwb.googlegroups.com>
Ya, you are right. I just found out that the server is spawning too
many threads that exceeds the quota that i set. Now i try to end each
thread after processing and the program now seems ok. Thank you very
much.
Ben Morrow wrote:
> [ quoting fixed. please quote properly ]
>
> Quoth "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>:
> > Ben Morrow wrote:
> > > Quoth "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>:
> > > >
> > > > I have errors in my program and i think Perl5.8.6.core is where all
> > > > the erros logged. However, it's in unreadable form. Is there anyway to
> > > > open the file and read?
> > >
> > > This is a core dump (you are using a Unix machine, right?). Can you
> > > provide a minimal script that causes it to happen? Perl should never
> > > core dump, so someone should file a bug.
> >
> > Here is my code posted before,
>
> Firstly, that is hardly a minimal script. There is no way anyone could
> have any idea what in that script is causing the problem.
>
> <snipped>
>
> > The scenario is: This server do accept connections from different
> > clients and storing the data from different client into the database.
> > However, after running some time, the out of memory error and the
> > program stopped.
>
> Well then, you're running out of memory. I'm slightly surprised you get
> a core dump, though.
>
> > Therefore, I would like to check the errors from the
> > core file to find the bugs.
>
> The core file will be of no use to you, unless you are familiar with
> Perl internals.
>
> I can't see anything obviously wrong with the code, but as I said you
> want to see if you can reduce the test-case first. My only thought would
> be: you seem to be creating a whole lot of threads: are you sure they're
> terminating?
>
> Ben
>
> --
> Outside of a dog, a book is a man's best friend.
> Inside of a dog, it's too dark to read.
> benmorrow@tiscali.co.uk Groucho Marx
------------------------------
Date: 22 Jun 2006 03:02:18 -0700
From: ben.wilder@gmail.com
Subject: Re: OO Perl help for a dot Net convert?
Message-Id: <1150970538.886765.284670@m73g2000cwd.googlegroups.com>
Gentlemen,
Thank you all very much for your help. Your explanations very much
appreciated. I have now the Conway OO perl book and will investigate!
The copying array in the constructor sample is invaluable and your
explanation of class / object behaviour has improved my understanding
of how Perl implements OO a great deal!
Thanks again for your time!
Ben
------------------------------
Date: 22 Jun 2006 07:18:21 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: perl programmer needed
Message-Id: <Xns97EA177213836castleamber@130.133.1.4>
usenet@DavidFilmer.com wrote:
> my-name-is@slim.shady.com wrote:
>> Re: perl programmer needed
>
> http://jobs.perl.org is the appropriate forum for your message. This is
> not.
You think?
"I need this cracked so I can use it on my other sites."
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
------------------------------
Date: 22 Jun 2006 00:26:08 -0700
From: usenet@DavidFilmer.com
Subject: Re: perl programmer needed
Message-Id: <1150961168.855664.211160@i40g2000cwc.googlegroups.com>
John Bokma wrote:
> You think?
> "I need this cracked so I can use it on my other sites."
I gave the OP the benefit of the doubt and assumed he meant "hacked."
I'm not sure how you can "crack" a Perl program... besides, most Perl
programs I've seen are cracked to begin with ;^) (including a lot of
my own stuff) :^O
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 22 Jun 2006 00:30:16 -0700
From: usenet@DavidFilmer.com
Subject: Re: perl programmer needed
Message-Id: <1150961416.292187.196860@m73g2000cwd.googlegroups.com>
use...@DavidFilmer.com wrote:
> I gave the OP the benefit of the doubt...
OP: my-name-is@slim.shady.com
Hmmm. Then again....
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 22 Jun 2006 02:32:35 -0700
From: "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>
Subject: Running another program in daemon server
Message-Id: <1150968755.469396.141540@m73g2000cwd.googlegroups.com>
hi,
I came across a problem which is when i run the server program without
the daemon code, calling another program by `perl second.pl` is just
fine. However, when i put the server to be in daemon, calling to
another program by using `perl <something>.pl` is not working anymore.
What is the cause and how to solve?
Thank you very much.
------------------------------
Date: 22 Jun 2006 08:40:44 GMT
From: Heinrich.Mislik@univie.ac.at (Heinrich Mislik)
Subject: Re: Special variable "@$"
Message-Id: <449a578c$0$12642$3b214f66@usenet.univie.ac.at>
In article <pdqmg.10338$1G2.2671@trnddc06>, jurgenex@hotmail.com says...
>
>
>narra.madan@gmail.com wrote:
>> can any one explain the meaning of the perl special variable @$;
>> the variable is used in the code..
>[...]
>> &do(\@fields);
>>
>> sub do {
>> my($fields_1,@fields,$var);
>> $fields_1=@_;
>> @fields=@$fields_1;
>
>In this context $fields_1 is a reference to an array and the leading @
>dereferences this array.
It woulb be, if done right:
($fields_1)=@_;
@fields=@$fields_1;
Greetings
Heinrich
--
Heinrich Mislik
Zentraler Informatikdienst der Universitaet Wien
A-1010 Wien, Universitaetsstrasse 7
Tel.: (+43 1) 4277-14056, Fax: (+43 1) 4277-9140
------------------------------
Date: Thu, 22 Jun 2006 09:59:29 +0200
From: Pascal Costanza <pc@p-cos.net>
Subject: Re: What is a type error?
Message-Id: <4fv0v3F1kipa6U1@individual.net>
Chris Smith wrote:
> While this effort to salvage the term "type error" in dynamic languages
> is interesting, I fear it will fail. Either we'll all have to admit
> that "type" in the dynamic sense is a psychological concept with no
> precise technical definition (as was at least hinted by Anton's post
> earlier, whether intentionally or not) or someone is going to have to
> propose a technical meaning that makes sense, independently of what is
> meant by "type" in a static system.
What about this: You get a type error when the program attempts to
invoke an operation on values that are not appropriate for this operation.
Examples: adding numbers to strings; determining the string-length of a
number; applying a function on the wrong number of parameters; applying
a non-function; accessing an array with out-of-bound indexes; etc.
>> In the terminology I'm suggesting, the object has no type in this language
>> (assuming we're talking about a Smalltalk-like language without any type system
>> extensions).
>
> I suspect you'll see the Smalltalk version of the objections raised in
> response to my post earlier. In other words, whatever terminology you
> think is consistent, you'll probably have a tough time convincing
> Smalltalkers to stop saying "type" if they did before. If you exclude
> "message not understood" as a type error, then I think you're excluding
> type errors from Smalltalk entirely, which contradicts the psychological
> understanding again.
Sending a message to an object that does not understand that message is
a type error. The "message not understood" machinery can be seen either
as a way to escape from this type error in case it occurs and allow the
program to still do something useful, or to actually remove (some)
potential type errors. Which view you take probably depends on what your
concrete implementation of "message not understood" does. For example,
if it simply forwards the message to another object that is known to be
able to respond to it, then you remove a potential type error; however,
if it pops up a dialog box to ask the user how to continue from here, it
is still a type error, but just gives you a way to deal with it at runtime.
Pascal
--
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/
------------------------------
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 V10 Issue 9339
***************************************