[27931] in Perl-Users-Digest
Perl-Users Digest, Issue: 9295 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 14 06:06:06 2006
Date: Wed, 14 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 Wed, 14 Jun 2006 Volume: 10 Number: 9295
Today's topics:
Re: Converting XML to Perl structures FAST <mirod@xmltwig.com>
Re: Daemon perl script <janicehwang1325@yahoo.com>
Re: IE Mechanize urls -- what about escaping? <bart@nijlen.com>
new CPAN modules on Wed Jun 14 2006 (Randal Schwartz)
Running 2 client programs simultaneously <janicehwang1325@yahoo.com>
Re: Running 2 client programs simultaneously usenet@DavidFilmer.com
Re: Running 2 client programs simultaneously <janicehwang1325@yahoo.com>
Re: Running 2 client programs simultaneously <jurgenex@hotmail.com>
Re: Running 2 client programs simultaneously <janicehwang1325@yahoo.com>
Re: The Nature of the "Unix Philosophy" (long) <jurgenex@hotmail.com>
Re: The Nature of the "Unix Philosophy" (long) <wyrmwif@tango-sierra-oscar-foxtrot-tango.fake.org>
Re: UTF-8 subject in an email [Binary/Quoted-Printable] <ynleder@nspark.org>
Re: UTF-8 subject in an email <ynleder@nspark.org>
Re: What is Expressiveness in a Computer Language <xah@xahlee.org>
WIN32::PIPE bug ? <karl_zero@free.net>
Re: WIN32::PIPE bug ? <sisyphus1@nomail.afraid.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 14 Jun 2006 10:53:03 +0200
From: Michel Rodriguez <mirod@xmltwig.com>
Subject: Re: Converting XML to Perl structures FAST
Message-Id: <448fce5b$0$989$5fc30a8@news.tiscali.it>
Ignoramus17503 wrote:
> On 13 Jun 2006 01:35:08 GMT, John Bokma <john@castleamber.com> wrote:
>
>>Ignoramus17503 <ignoramus17503@NOSPAM.17503.invalid> wrote:
>>
>>
>>>I installed XML::Twig, and things seem, so far, to be a lot faster and
>>>CPU use is way down. It is not quite as easy to use, but I can live
>>>with it.
>>
>>Uhm, how easy do you want it? Study the manual and the examples.
>
>
> Well, here's how I accessed data with XML::Simple:
>
> my $price = $item->{SellingStatus}->{CurrentPrice}->{content};
>
> Here's how I access it with XML::Twig:
>
> $price = $item->first_child( 'SellingStatus' )->first_child( 'CurrentPrice' )->text;
If you do $item->simplify, then you get the exact same structure as with
XML::Simple (if there is any difference you can report this as a bug).
Also if you find any memory leak, report it, and hopefully I can fix the
bug.
--
mirod
------------------------------
Date: 13 Jun 2006 21:22:04 -0700
From: "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>
Subject: Re: Daemon perl script
Message-Id: <1150258924.658759.43610@u72g2000cwu.googlegroups.com>
thanks all for the comments. it's really helpful to me. actually after
renicing the program, the program do run without any "killing".
however, my supervisor is changing his mind and the progarm is now
changed. I have another problem occur n will post in another message
later. Pls feel free to have a look
------------------------------
Date: 14 Jun 2006 02:03:28 -0700
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: Re: IE Mechanize urls -- what about escaping?
Message-Id: <1150275808.147811.279680@f6g2000cwb.googlegroups.com>
nsb_tsd@eml.cc wrote:
> I am munging together a url from the following snippet of html. It
> shows the button I want to click, except it's accessed thru Javascript.
> The jscript opens a new window which makes the content inaccessible, so
> that's why I want to munge the address myself, so I can open it in the
> same window.
>
> For munging I extract the key value, append it to the base url, and do
> an IE->get().
>
> Does IE->get() do url escaping? The key value below is already escaped,
> and I don't know if IE is unescaping the character codes. How would I
> ensure that IE escapes the slashes in the key?
> [...]
Well, you could debug your code by looking if the value is escaped or
not at any point when the code runs (just for the debug work,
obviously), like
print "1. URL is now $urlnow\n";
print "2. URL is now $urlnow\n";
...
If it turns out you need to unescape the value by hand, it's quite
easy.
Perl:
--------------
#!perl
use strict; use warnings; use URI::Escape;
my $string
='2FxxxD%2Fxxa%2FS%2FasdfF%2Fbsa%2FNIL%2FNIL%2FXF%252';
print uri_unescape($string);
--------------
Javascript:
--------------
var string =
'2FxxxD%2Fxxa%2FS%2FasdfF%2Fbsa%2FNIL%2FNIL%2FXF%252'
document.write(unescape(string))
--------------
Hope this helps,
--
Bart
------------------------------
Date: Wed, 14 Jun 2006 04:42:08 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Jun 14 2006
Message-Id: <J0u2E8.1z9K@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Catalyst-Plugin-FormValidator-Simple-Auto-0.03
http://search.cpan.org/~typester/Catalyst-Plugin-FormValidator-Simple-Auto-0.03/
Smart validation with FormValidator::Simple
----
Devel-Modlist-0.7
http://search.cpan.org/~rjray/Devel-Modlist-0.7/
Perl extension to collect module use information
----
Net-Yadis-1.0
http://search.cpan.org/~arnesond/Net-Yadis-1.0/
----
Net-OpenID-JanRain-1.1.0
http://search.cpan.org/~arnesond/Net-OpenID-JanRain-1.1.0/
----
Bundle-DBWIZ-0.01
http://search.cpan.org/~calvinm/Bundle-DBWIZ-0.01/
Perl CPAN Bundle for DBWIZ
----
Time-TAI-Now-0.000
http://search.cpan.org/~zefram/Time-TAI-Now-0.000/
determine current time in TAI
----
Time-GPS-0.000
http://search.cpan.org/~zefram/Time-GPS-0.000/
Global Positioning System time
----
Time-TAI-0.000
http://search.cpan.org/~zefram/Time-TAI-0.000/
International Atomic Time and realisations
----
Time-TT-0.000
http://search.cpan.org/~zefram/Time-TT-0.000/
Terrestrial Time and its realisations
----
Math-Interpolator-0.000
http://search.cpan.org/~zefram/Math-Interpolator-0.000/
interpolate between lazily-evaluated points
----
Hardware-1Wire-HA7Net-1.01
http://search.cpan.org/~dvklein/Hardware-1Wire-HA7Net-1.01/
----
Unicode-Escape-0.0.1
http://search.cpan.org/~itwarrior/Unicode-Escape-0.0.1/
Escape and unescape Unicode characters other than ASCII
----
POE-Component-IRC-4.93
http://search.cpan.org/~bingos/POE-Component-IRC-4.93/
a fully event-driven IRC client module.
----
Acme-PM-Erlangen-SteffenW-BuildTest-0.001
http://search.cpan.org/~steffenw/Acme-PM-Erlangen-SteffenW-BuildTest-0.001/
create a CPAN Module using Module::Build on Win32-Systems
----
Catalyst-Plugin-FormValidator-Simple-Auto-0.02
http://search.cpan.org/~typester/Catalyst-Plugin-FormValidator-Simple-Auto-0.02/
Smart validation with FormValidator::Simple
----
RRD-Simple-1.36
http://search.cpan.org/~nicolaw/RRD-Simple-1.36/
Simple interface to create and store data in RRD files
----
Catalyst-Plugin-FormValidator-Simple-Auto-0.01
http://search.cpan.org/~typester/Catalyst-Plugin-FormValidator-Simple-Auto-0.01/
Smart validation with FormValidator::Simple
----
Net-Z3950-ZOOM-1.09
http://search.cpan.org/~mirk/Net-Z3950-ZOOM-1.09/
Perl extension for invoking the ZOOM-C API.
----
Net-IMAP-Simple-1.16
http://search.cpan.org/~cfaber/Net-IMAP-Simple-1.16/
Perl extension for simple IMAP account handling.
----
Data-RuledValidator-0.03
http://search.cpan.org/~ktat/Data-RuledValidator-0.03/
data validator with rule
----
Regexp-Compare-0.04
http://search.cpan.org/~vbar/Regexp-Compare-0.04/
partial ordering for regular expressions
----
Unicode-Normalize-1.01
http://search.cpan.org/~sadahiro/Unicode-Normalize-1.01/
Unicode Normalization Forms
----
Pugs-Compiler-Rule-0.05
http://search.cpan.org/~fglock/Pugs-Compiler-Rule-0.05/
Compiler for Perl 6 Rules
----
JavaScript-SpiderMonkey-0.16
http://search.cpan.org/~tbusch/JavaScript-SpiderMonkey-0.16/
Perl interface to the JavaScript Engine
----
Email-Simple-FromHandle-0.011
http://search.cpan.org/~rjbs/Email-Simple-FromHandle-0.011/
an Email::Simple but from a handle
----
OpenGuides-0.55
http://search.cpan.org/~dom/OpenGuides-0.55/
A complete web application for managing a collaboratively-written guide to a city or town.
----
Email-Valid-0.172
http://search.cpan.org/~rjbs/Email-Valid-0.172/
Check validity of Internet email addresses
----
Data-OptList-0.101
http://search.cpan.org/~rjbs/Data-OptList-0.101/
parse and validate simple name/value option pairs
----
WWW-Scraper-ISBN-ISBNdb_Driver-0.03
http://search.cpan.org/~diberri/WWW-Scraper-ISBN-ISBNdb_Driver-0.03/
isbndb.com driver for WWW::Scraper::ISBN
----
GD-Thumbnail-1.0
http://search.cpan.org/~burak/GD-Thumbnail-1.0/
Thumbnail maker for GD
----
Geo-Coder-Google-0.01
http://search.cpan.org/~miyagawa/Geo-Coder-Google-0.01/
Google Maps Geocoding API
----
Lingua-ZH-Romanize-Pinyin-0.13
http://search.cpan.org/~kawasaki/Lingua-ZH-Romanize-Pinyin-0.13/
Romanization of Standard Chinese language
----
HTTP-Server-Simple-Static-0.03
http://search.cpan.org/~sjquinney/HTTP-Server-Simple-Static-0.03/
Serve static files with HTTP::Server::Simple
----
Business-TPGPost-0.04
http://search.cpan.org/~blom/Business-TPGPost-0.04/
Calculate Dutch (TPG Post) shipping costs
----
EasyTool-2006.06.13.02
http://search.cpan.org/~foolfish/EasyTool-2006.06.13.02/
----
EasyTool-2006.06.13
http://search.cpan.org/~foolfish/EasyTool-2006.06.13/
----
POE-Wheel-UDP-0.00_01
http://search.cpan.org/~hachi/POE-Wheel-UDP-0.00_01/
POE Wheel for UDP handling.
----
App-Cmd-0.001
http://search.cpan.org/~rjbs/App-Cmd-0.001/
write command line apps with less suffering
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 13 Jun 2006 21:28:56 -0700
From: "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>
Subject: Running 2 client programs simultaneously
Message-Id: <1150259336.582505.297140@f6g2000cwb.googlegroups.com>
hi expert,
Currently, I have a server program running localhost. Then i have 2
separate client programs that will connect to the server at the same
time. However, my server program will only allow one client program to
connect. If there is another program from the same IP connect, it will
exit. Is it the program becoz of the client is using same identity to
connect to the server making the server exit itself? FYI, i had tested
the server progarm (it's multitaking using thread) and having
connection from different user having no problem. If i would like to
run the server to accept connections from clients from the same IP is
that possible?
------------------------------
Date: 14 Jun 2006 00:24:01 -0700
From: usenet@DavidFilmer.com
Subject: Re: Running 2 client programs simultaneously
Message-Id: <1150269841.164740.137320@g10g2000cwb.googlegroups.com>
janicehwang1325@yahoo.com wrote:
> However, my server program will only allow one client program to
> connect. If there is another program from the same IP connect, it will
> exit. Is it the program becoz of the client is using same identity to
> connect to the server making the server exit itself?
No. You have already diagnosed your problem:
>>> my server program will only allow one client program to connect.
Now you need to review your server program source code and figure out
WHY that is so. There is no inherent limitation which prevents a server
from accepting multiple connections from the same host (even from
localhost), so there is apparently a limitation imposed by your server
program's logic.
By the way, "becoz" is spelled b-e-c-a-u-s-e. This newsgroup is more
"professional" in tone than many others, and you might find that you
will annoy many of the folks in this newsgroup if you use cutsie
abbreviations (whereas you will annoy no one if you do not).
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 14 Jun 2006 01:35:41 -0700
From: "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>
Subject: Re: Running 2 client programs simultaneously
Message-Id: <1150274141.176619.114110@i40g2000cwc.googlegroups.com>
So it's my server program problem that prevent the multiple connections
from the same host? for your information, all the client and server
program i run is running as daemon. when i try to run the server on
another machine like 10.11.10.22 and the client at 10.11.10.11, it
creates no problem. However, when i put the server same as the client
at 10.11.10.11, the problem occur.
I realized that the connection is done but the connection is gone once
the second client connect to it and the error message that i can get is
"segmentation fault (core dumped)". I tried to look into the code and
now running the server program using different port number. The program
is fine. However, i believe running using different port number isn't
an ultimate solution.
Thanks for the remind. I will be aware of my usage of abbreviation!
usenet@DavidFilmer.com wrote:
> janicehwang1325@yahoo.com wrote:
> > However, my server program will only allow one client program to
> > connect. If there is another program from the same IP connect, it will
> > exit. Is it the program becoz of the client is using same identity to
> > connect to the server making the server exit itself?
>
> No. You have already diagnosed your problem:
> >>> my server program will only allow one client program to connect.
>
> Now you need to review your server program source code and figure out
> WHY that is so. There is no inherent limitation which prevents a server
> from accepting multiple connections from the same host (even from
> localhost), so there is apparently a limitation imposed by your server
> program's logic.
>
> By the way, "becoz" is spelled b-e-c-a-u-s-e. This newsgroup is more
> "professional" in tone than many others, and you might find that you
> will annoy many of the folks in this newsgroup if you use cutsie
> abbreviations (whereas you will annoy no one if you do not).
>
> --
> David Filmer (http://DavidFilmer.com)
------------------------------
Date: Wed, 14 Jun 2006 08:45:28 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Running 2 client programs simultaneously
Message-Id: <I0Qjg.10316$hN2.2085@trnddc05>
janicehwang1325@yahoo.com wrote:
> hi expert,
Where?
> Currently, I have a server program running localhost. Then i have 2
> separate client programs that will connect to the server at the same
> time. However, my server program will only allow one client program to
> connect. If there is another program from the same IP connect, it will
> exit.
Well, you are not telling us what kind of server you are talking about. HTTP
maybe?
If so, then your observation is rather strange, because normally web servers
would simply fork off a new thread or process to handle each incoming
request and they don't care about how many requests a single requestor
sends.
> Is it the program becoz of the client is using same identity to
> connect to the server making the server exit itself?
I've never heard of a program becoz, maybe you can ask the manufacturer of
this program?
Anyway, what does this have to do with Perl?
jue
------------------------------
Date: 14 Jun 2006 02:15:27 -0700
From: "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>
Subject: Re: Running 2 client programs simultaneously
Message-Id: <1150276527.342534.183140@h76g2000cwa.googlegroups.com>
for more information, my client and server program are both writing in
Perl using IO::Socket::SSL. Both of them will be running as daemon.The
server is actually split the log messages from different client and
save into database according to their type.
J=FCrgen Exner wrote:
> janicehwang1325@yahoo.com wrote:
> > hi expert,
>
> Where?
>
> > Currently, I have a server program running localhost. Then i have 2
> > separate client programs that will connect to the server at the same
> > time. However, my server program will only allow one client program to
> > connect. If there is another program from the same IP connect, it will
> > exit.
>
> Well, you are not telling us what kind of server you are talking about. H=
TTP
> maybe?
> If so, then your observation is rather strange, because normally web serv=
ers
> would simply fork off a new thread or process to handle each incoming
> request and they don't care about how many requests a single requestor
> sends.
>
> > Is it the program becoz of the client is using same identity to
> > connect to the server making the server exit itself?
>
> I've never heard of a program becoz, maybe you can ask the manufacturer of
> this program?
>=20
> Anyway, what does this have to do with Perl?
>=20
> jue
------------------------------
Date: Wed, 14 Jun 2006 01:28:22 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: The Nature of the "Unix Philosophy" (long)
Message-Id: <WCJjg.39282$%m5.5906@trnddc04>
Andrew wrote:
> Xah Lee wrote:
>> The Nature of the "Unix Philosophy"
Oh, PLEASE, not another one
+-------------------+ .:\:\:/:/:.
| PLEASE DO NOT | :.:\:\:/:/:.:
| FEED THE TROLLS | :=.' - - '.=:
| | '=(\ 9 9 /)='
| Thank you, | ( (_) )
| Management | /`-vvv-'\
+-------------------+ / \
| | @@@ / /|,,,,,|\ \
| | @@@ /_// /^\ \\_\
@x@@x@ | | |/ WW( ( ) )WW
\||||/ | | \| __\,,\ /,,/__
\||/ | | | jgs (______Y______)
/\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
==============================================================
jue
------------------------------
Date: Wed, 14 Jun 2006 02:29:18 -0000
From: SM Ryan <wyrmwif@tango-sierra-oscar-foxtrot-tango.fake.org>
Subject: Re: The Nature of the "Unix Philosophy" (long)
Message-Id: <128ut3uqitovuff@corp.supernews.com>
# Commercial software tends towards one huge tool that can be used to
Except for Linux and BSD, Unix is commercial software.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
You hate people.
But I love gatherings. Isn't it ironic.
------------------------------
Date: Wed, 14 Jun 2006 08:54:37 +0200
From: Yohan N. Leder <ynleder@nspark.org>
Subject: Re: UTF-8 subject in an email [Binary/Quoted-Printable]
Message-Id: <MPG.1ef9d11b611aa661989898@news.tiscali.fr>
In article <877j3k7jar.fsf@anfi.homeunix.net>, anfi@onet.eu says...
> Why do you use binary encoding instead of quoted-printable? [MIME-Q]
> Quoted-printable is the best choice for encoding of "mostly" ascii text.
>
I've tried both Q? and B? and both been ignored by Eudora at the
arrival.
------------------------------
Date: Wed, 14 Jun 2006 09:04:49 +0200
From: Yohan N. Leder <ynleder@nspark.org>
Subject: Re: UTF-8 subject in an email
Message-Id: <MPG.1ef9d380e4e96d52989899@news.tiscali.fr>
In article <e6nk1n.sk.1@news.isolution.nl>, rvtol+news@isolution.nl
says...
> Check the "Content" header fields too, you'll need ones like:
> Content-Type: text/plain; charset="UTF-8"
> Content-Transfer-Encoding: 8bit
> for the body to be recognized as encoded in UTF-8.
Already done, but now we know the responsible is Eudora which ignore the
charset.
> A compliant Subject-header can only have 7-bit characters, so you need
> to do
> use utf8 ;
> my $subject = encode( 'MIME_Header', 'Subject: boîte' ) ;
> Test:
> perl -MEncode -le 'print "Subject: " . encode("MIME-Header", "bo\x{00EE}te")'
> prints: Subject: =?UTF-8?B?Ym/DrnRl?=
>
Agreed, but sure now Eudora (as some others clients emails) is the only
responsible.
So, I've decided to check if convertible to ISO-8859-1 using encode()
with CHECK in eval{}, then do it if possible or take an alternative way
if not (like : sending text as attachment too, or build an HTML oriented
email ; not choosen at this time)
------------------------------
Date: 14 Jun 2006 02:03:46 -0700
From: "Xah Lee" <xah@xahlee.org>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1150275826.112536.280940@f6g2000cwb.googlegroups.com>
hi Joe,
Joe Marshall wrote:
=C2=AB Expressiveness isn't necessarily a good thing. For instance, in C,
you can express the addresses ...=C2=BB
we gotta be careful here, because soon we gonna say binaries are the
most expressive. For instance, in assembly, you can express the
registers and stuff.
Expressiveness, with respect to =E2=80=94 for lack of refined terms =E2=80=
=94
semantics, is a good thing, period. When discussing a language's
semantical expressiveness, it goes without saying that a =E2=80=9Cdomain=E2=
=80=9D
are understood, or needs to be defined. This is almost never mentioned
because it is very difficult. Put it in driveler's chant for better
understanding: we can't =E2=80=9Ccompare apples with oranges=E2=80=9D.
Let me give a example. Let's say i invented a language, where, there's
no addition of numbers, but phaserfy and realify with respective
operators ph and re. So, in my language, to do 1+2, you write =E2=80=9Cph 1
re ph 2=E2=80=9D, which means, to phaserfy 1, and phaserfy 2, then realify
their results, which results in 3. Now, this language is the most
expressive, because it can deal with concepts of phaserfy and realify
that no other lang can.
This may seem ridiculous, but is in fact a lot imperative languages do.
I won't go long here, but for instance, the addresses or references of
C and Perl is such. And in Java and few other OOP langs, there's
=E2=80=9Citerator=E2=80=9D and =E2=80=9Cenumerator=E2=80=9D things, are lik=
ewise immaterial.
As to OOP's iterator and enumerator things, and the general perspective
of extraneous concepts in languages, i'll have to write a essay in
detail some other day.
----
Thanks for the summary.
Is there no one else who are able to read that paper?
Xah
xah@xahlee.org
=E2=88=91 http://xahlee.org/
> Xah Lee wrote:
> > in March, i posted a essay "What is Expressiveness in a Computer
> > Language", archived at:
> > http://xahlee.org/perl-python/what_is_expresiveness.html
> > ...
> > On the Expressive Power of Programming Languages, by Matthias
> > Felleisen, 1990.
> > http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expre=
ssive-slides.pdf
Joe Marshall wrote:
> The gist of the paper is this: Some computer languages seem to be
> `more expressive' than
> others. But anything that can be computed in one Turing complete
> language can be computed in any other Turing complete language.
> Clearly the notion of
> expressiveness isn't concerned with ultimately computing the answer.
>
> Felleisen's paper puts forth a formal definition of expressiveness in
> terms of semantic
> equivilances of small, local constructs. In his definition, wholescale
> program transformation is
> disallowed so you cannot appeal to Turing completeness to claim program
> equivalence.
>
> Expressiveness isn't necessarily a good thing. For instance, in C, you
> can express the
> addresses of variables by using pointers. You cannot express the same
> thing in Java, and
> most people consider this to be a good idea.
------------------------------
Date: Tue, 13 Jun 2006 23:25:06 -0400
From: karl zero <karl_zero@free.net>
Subject: WIN32::PIPE bug ?
Message-Id: <jmLjg.30162$G97.561800@weber.videotron.net>
Hello list,
i am trying to use WIN32::pipe in order to setup basic client/server
communication. My problem is while sending a lot of data from the client
to the server, the perl process memory is fastly growing up but memory
is never freed and the perl process will eventualy exhaust all available
memory.
Is it a normal behavior and so did i miss something ?
Even using the code snipet available on Roth site,
http://www.roth.net/perl/pipe/, by slightly modifying it with an
infinite loop on both sides (one for reading, other for writing) it
suffices to reproduce the problem.
Is it a memory leakage ? i cannot reproduce the same behavior with the
same code ported to C++ so something to do with the perl XS ?
Any pointer someone ?
Thanks
Karl
------------------------------
Date: Wed, 14 Jun 2006 17:59:27 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: WIN32::PIPE bug ?
Message-Id: <448fc2ae$0$26423$afc38c87@news.optusnet.com.au>
"karl zero" <karl_zero@free.net> wrote in message
news:jmLjg.30162$G97.561800@weber.videotron.net...
> Hello list,
> i am trying to use WIN32::pipe in order to setup basic client/server
> communication. My problem is while sending a lot of data from the client
> to the server, the perl process memory is fastly growing up but memory
> is never freed and the perl process will eventualy exhaust all available
> memory.
.
.
> Is it a memory leakage ?
Sounds like it. Can you post some *minimal* server and client code that
demonstrates the problem ? ... preferably so that the server and client
script run on the same machine. I had a bit of a play with the module, but
got waylaid by other strange behaviour before I got to check for growing
memory usage.
I ran the following server script:
--- server.pl ---
use warnings;
use Win32::Pipe;
while(1) {
$pipe = new Win32::Pipe("mypipe");
if(!defined($pipe)) {die "Error 1"}
$ok = $pipe->Connect();
if(!$ok) {warn "Something is not right on the server side\n"}
$data = $pipe->Read();
print"Client sent: ", $data, "\n";
$pipe->Disconnect();
$pipe->Close();
}
__END__
--------------
And then tried the following client script (from a different cmd console on
the same machine):
--- client1.pl ---
use warnings;
use Win32::Pipe;
$cl_pipe = new Win32::Pipe("\\\\.\\pipe\\mypipe");
if(!defined($cl_pipe)) {die "Error 1"}
$ok = $cl_pipe->Write("Howdy! This is cool!");
if(!$ok) {warn "Something is not right on the client side\n"}
$cl_pipe->Close(); # makes no difference if I remove this line
__END__
----------------
The server script stays alive, but the client script simply connects once,
sends its message and exits. For some reason, every time I run the client
script, the server script outputs:
Client sent: Howdy! This is cool!
Something is not right on the server side
Use of uninitialized value in print at server.pl line 13.
Client sent:
Some how or other the blocking fails every second time ... and I don't see
much point in looking for memory leaks until I get that bit sorted out.
Maybe I'm doing something stupid - which is one reason that it would be
useful to see what you have been doing. (The other reason is that it would
have saved me the bother of writing test scripts :-)
Incidentally, I normally use IO::Socket for this sort of thing on Win32
(where I'm actually transferring files from one computer to another) and
have found it to be quite reliable .... not that I've ever checked for
memory leakage.
I've not seen questions about Win32::Pipe before - I wonder how extensively
it has been used.
For the cliet script did you try the open() option:
open( PIPE, "< \\\\server\\pipe\\My Named Pipe" );
If so, did that make any difference to the behaviour ?
Cheers,
Rob
------------------------------
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 9295
***************************************