[7200] in Perl-Users-Digest
Perl-Users Digest, Issue: 825 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 7 23:52:02 1997
Date: Thu, 7 Aug 97 20:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 7 Aug 1997 Volume: 8 Number: 825
Today's topics:
alarm/signal funkiness in child process [LONG] (John Klassa)
Bad file number <mas@aa.csg.com>
binding to a particular IP address in Perl <MoNoLiTH+@CMU.EDU>
Re: C++ Documentation via Perl <johnsone@camax.com>
Re: comparing for a range of number - easiest way to do <ajohnson@gpu.srv.ualberta.ca>
Compiling/Installing Perl <chrisd@erg.sri.com>
Re: EASY PROBABLY: removing names from paths (Matthew Cravit)
Filter-1.12 for NT <qeren@dotshop.com>
Re: free perl interpreter (Matthew Burnham)
Re: Head of CGI Department (Tad McClellan)
Re: Help executing SCSI commands. (Stefan Frank (sf))
Re: how do I entries in a text file in PERL? (Tad McClellan)
How to create more than object at once? (Oliver Hellberg)
Re: How to create more than object at once? <nnyxcu@ny.ubs.com>
Re: How to send the constructor parameters to the base <jstern@world.northgrum.com>
Re: HTTP proxy server in perl? (Michael Fuhr)
Re: JAPH (was: function pointer dereferencing) <merlyn@stonehenge.com>
looking for ksh 2 perl <jdenny@jeppesen.com>
No Perls of wisdom here... <nospam@webfuture.com>
Re: passing command line arguments to script in debugge <rootbeer@teleport.com>
Re: PID (Charles DeRykus)
Re: Pre-forking server example needed (Steffen Beyer)
Request for example select()-server (James Weisberg)
Sorting With Perl <perrella@ehsn23.cen.uiuc.edu>
Re: Substitution/Read/Write (infinite loop?) (Jonathan Feinberg)
Re: translating accented characters to non-accented cha <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 Aug 1997 18:24:08 GMT
From: klassa@gumby.ivc.com (John Klassa)
Subject: alarm/signal funkiness in child process [LONG]
Message-Id: <5sd3s8$44p$1@vortex.ivc.com>
[ This is under Solaris, with a recent Perl (not sure if it was 5.004,
but it was definitely Perl 5) and the ARS module for working with a
Remedy database. The problem isn't database-specific, though, I don't
think. ]
I was recently writing a daemon to monitor data flowing in a couple of
different directions... Periodically (every 30 seconds), it was to check an
incoming spool directory for data to be written into the Remedy database,
then turn around & check the Remedy database for trouble tickets to be
written into an outgoing spool directory.
There were several places where the code might possibly get stuck waiting
for the database server to respond one way or another. I wrote a simple
SIG{ALRM} handler whose job was to print a message (like "I'm dying!") to an
already-open log file, close the log file, and then exec an external shell
script which would fire up the daemon again. (I could have had the daemon
start itself up directly, but I was working with legacy startup/shutdown
code which checked to see if a copy of the daemon script was already
running.)
In a nutshell, then, let's say that daemon.pl is the script that implements
the daemon, and daemon-restart.sh is the (Bourne) shell script that simply
erases a couple of tmp files and fires off a new copy of the daemon script.
I wrapped each call to something database-dependent with an alarm() pair, as
in:
alarm(10);
$result = database_call($parm1, $parm2);
alarm(0);
My intent was to have my SIGALRM handler called whenever a database call
took longer than 10 seconds to complete, so that the current daemon process
would kill itself off & exec "daemon-restart.sh" to fire off a new daemon.
What I found was that the alarm/signal behavior in the new daemon (which
would have been effectively, a child process of the original daemon process)
was incorrect and unpredictable. SIGALRM never got received, and sleep()
calls didn't work correctly. In the original, everything worked nicely; in
the child, no such luck.
When I took out the code to exec daemon-restart.sh, and added a periodic
monitor (via cron) so that new daemons were *not* children of the original
daemon, things worked nicely.
Is there some obvious thing going on here that's quite expected (for
everyone except me :-)), or is this unusual enough for me to investigate
further?
Thanks!
John
--
John Klassa <><
------------------------------
Date: Thu, 07 Aug 1997 18:24:02 -0400
From: "Michael S." <mas@aa.csg.com>
Subject: Bad file number
Message-Id: <33EA4B02.4464@aa.csg.com>
greetings,
I'm tring to execute a csh script from perl5 using system()
system("/dir/cshscript"); , and I countinue to get
/dev/fd/#: Bad file number.
I would appreciate some assistance.
------------------------------
Date: Thu, 7 Aug 1997 14:12:33 -0400
From: Aveek Datta <MoNoLiTH+@CMU.EDU>
Subject: binding to a particular IP address in Perl
Message-Id: <EnuV0FK00iWR04RFQ0@andrew.cmu.edu>
Allright. My Linux box has two IPs, and I'd like to have a server run on
only one of those IPs. Let's say the IP is 1.1.1.1
I think I will have to edit the 'bind' statement in my server config and
change INADDR_ANY, but I don't know how to set it up.
Can someone tell me how to bind to only one IP of the server instead of
all IPs?
Thanks
Aveek
Network Administrator, Monolith Internet Services [TM] _ _ _ _ Aveek
SysAdmin, Carnegie Mellon Univ ITC _ __ ___ _ _ ___| (_) |_| |_Datta
Personal Website @ datta.ml.org _| ' \/ _ \ ' \/ _ \ | | _| ' \ _
All opinions are ONLY mine. (_)_|_|_\___/_||_\___/_|_|\__|_||_(_)
[Get a free domain for your website or machine at http://www.ml.org]
------------------------------
Date: Thu, 07 Aug 1997 14:46:01 -0500
From: Eric Foster-Johnson <johnsone@camax.com>
To: Chris Brosz <brosz@ug.eds.com>
Subject: Re: C++ Documentation via Perl
Message-Id: <33EA25F9.3C14@camax.com>
Chris Brosz wrote:
>
> Is anyone aware of some Perl scripts that will take C++
> header files and produce HTML for documenting the class ?
>
Chris,
If it doesn't have to be written in Perl, you might want to
look at:
Cocoon
http://www.cs.umn.edu/~kotula/cocoon/cocoon.htm
Cxref
http://www.gedanken.demon.co.uk/cxref/index.html
DOC++
http://www.zib.de/Visual/software/doc++/index.html
In Perl, look for the C::Scan module (this won't do what you
want, but it might be a good starting point).
Good luck,
-Eric
--
Eric Foster-Johnson http://www.pconline.com/~erc/
CAMAX, SDRC's CAM Business
7851 Metro Parkway phone: +1 612 854 5300 fax: +1 612 854 6644
Minneapolis, MN 55425 USA johnsone@camax.com
------------------------------
Date: Thu, 07 Aug 1997 20:12:43 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: comparing for a range of number - easiest way to do it?
Message-Id: <33EA728B.3CB8E43F@gpu.srv.ualberta.ca>
Ronald Fischer wrote:
>
> Hi
> not a very important question, but I am curious ....
>
> does someone know an easier way to write
> die "foo" if ($x <= $a or $x >= $b);
> provided that
> $a <= $b
> and $a and $b are integers,
> and $b not very much greater as $a (i.e. that the usage of $a..$b
> would be practical)?
I don't think the range operator is going to give an easier
statement for your purpose...but you could turn around the
statement from 'die if $x is outside range' to '$x is
in range or die':
$x>$a && $x<$b || die "foo";
I dunno if you find it easier though.
regards
andrew
------------------------------
Date: Thu, 07 Aug 1997 14:18:59 -0700
From: Christian DeKonink <chrisd@erg.sri.com>
Subject: Compiling/Installing Perl
Message-Id: <33EA3BC3.FC8@erg.sri.com>
Hi,
I can't seem to compile perl on any Solaris 2.5 Sparc system.
Here is the output I get from make. Does anybody have a solution to this
problem?
Making DynaLoader (static)
Writing Makefile for DynaLoader
mkdir ../../lib/auto/DynaLoader
cp DynaLoader.pm ../../lib/DynaLoader.pm
AutoSplitting DynaLoader (../../lib/auto/DynaLoader)
cp dl_dlopen.xs DynaLoader.xs
../../miniperl -I../../lib -I../../lib ../../lib/ExtUtils/xsubpp
-noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs >xstmp.c
&& mv xstmp.c DynaLoader.c
gcc -c -I/usr/local/include -B/usr/ccs/bin -O -DVERSION=\"1.02\"
-DXS_VERSION=\"1.02\" -I../.. -DPERL_CORE -DLIBC="/lib/libc.so"
DynaLoader.c
gcc: file path prefix `/usr/ccs/bin' never used
rm -rf ../../lib/auto/DynaLoader/DynaLoader.a
ar cr ../../lib/auto/DynaLoader/DynaLoader.a DynaLoader.o && :
../../lib/auto/DynaLoader/DynaLoader.a
chmod 755 ../../lib/auto/DynaLoader/DynaLoader.a
Skipping lib/auto.a (directory does not exist)
gcc -L/usr/local/lib -o perl perlmain.o
lib/auto/DynaLoader/DynaLoader.a lib/auto.a libperl.a `cat ext.libs`
-lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt
gcc: lib/auto.a: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `perl'
Thanks in advance,
Chris
--
Chris Dekonink chrisd@erg.sri.com
SRI International Phone: 415-859-4485
333 Ravenswood Drive Fax: 415-859-2683
Menlo Park, CA 94025
------------------------------
Date: 7 Aug 1997 13:18:39 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Re: EASY PROBABLY: removing names from paths
Message-Id: <5sdaiv$82h$1@shell3.ba.best.com>
In article <33EA2414.4901@nzsf00.epa.ericsson.se>,
Ross Williamson <enzrowi@nzsf00.epa.ericsson.se> wrote:
>Or instead of rindex you can use something like
>
>$filename =~ m/(.*)\/(.*)$/;
Another way you can do this (TMTOWTDI) is like the following:
$filename = "/foo/bar/baz/quux";
$basename = (split(/\//, $filename))[-1];
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Thu, 07 Aug 1997 16:30:49 -0400
From: Carine Boneh <qeren@dotshop.com>
Subject: Filter-1.12 for NT
Message-Id: <33EA3079.146B0785@dotshop.com>
I try to install the module Filter-1.12. Everything seems to be fine but
when I run nmake I have the following:
Exec.c
Exec.xs(145) : error C2065: 'F_GETFL' : undeclared identifier
Exec.xs(151) : error C2065: 'O_NONBLOCK' : undeclared identifier
Exec.xs(152) : error C2065: 'F_SETFL' : undeclared identifier
Exec.xs(363) : warning C4113: 'long (__cdecl *)(void)' differs in
parameter list
s from 'long (__cdecl *)(int ,struct sv *,int )'
NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
Can somebody help me?
Thank you
Qeren
------------------------------
Date: Thu, 07 Aug 1997 17:25:23 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: free perl interpreter
Message-Id: <33e9d96d.1336564@news.enterprise.net>
"Ekim E. YARDIMLI" <tetnys@ibm.net> wrote:
>i've just started learning perl and currently i'm not being ablo to test
>what i write, i plan to get a virtual web host that does support perl,
>but until then i was wondering if there exists a free server where
>people can run their scripts?
I see you're on a Win16 platform, so OmniHTTPd which I use (from
http://www.fas.harvard.edu/~glau/httpd/) work work on your system. Do a
search on Yahoo for windows httpd or something, or look on TUCOWS.
--
Matthew Burnham, Manager, MindWeb | danew@enterprise.net
Commercial web design and hosting, reasonable rates
UKP24/Mb/Year for DIY space | mindweb@pobox.co.uk
FTP, CGI, password protection, etc. too!
http://www.mindweb.co.uk/
------------------------------
Date: Wed, 6 Aug 1997 17:00:14 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Head of CGI Department
Message-Id: <e5sas5.pfn.ln@localhost>
Rishi Bhattacharya (rbhattac@jetson.uh.edu) wrote:
: Hello,
: I am currently starting a new project and am looking for someone to head
: the CGI department of my site.
: My current team consists of experienced proffessionals, ranging from IBM
^^^^^^^^^^^^^^
professionals who:
1) spam ("real spam" ie. the classic definition, not the colloquial one)
2) post off topic articles
3) don't have a spell checker (minor point ;-)
Where do I sign up?
: software developers to NASA engineers. We are already getting numerous
: requests for advertising space, even before the site is complete. The
: ideal applicant will have two very important traits : 1) A plethora of
: experience in designing and writing java. 2) A reasonable amount of time
^^^^^^^^^^^^
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 6 Aug 1997 20:21:46 GMT
From: frank@cip.informatik.uni-wuerzburg.de (Stefan Frank (sf))
Subject: Re: Help executing SCSI commands.
Message-Id: <5samcq$rr1@winx03.informatik.uni-wuerzburg.de>
mbayang@houston.geoquest.slb.com wrote:
: Hi,
: Is it possible to execute SCSI comands from Perl? I am trying to
: get information of off a scsi tape drive. Thanks.
You can use the ioctl system call on the corresponding device. The
following code ejects a SCSI cd (at least on my Linux PC):
open DEV, '/dev/audiocd';
ioctl DEV, 0x5309, $res;
Regards,
-- Stefan
: --
: Martin K. Bayang
: Internet: mbayang@houston.geoquest.slb.com
------------------------------
Date: Wed, 6 Aug 1997 17:25:23 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: how do I entries in a text file in PERL?
Message-Id: <jktas5.smn.ln@localhost>
Suhail Warsi (swarsi@zeus.nmp.com) wrote:
: How can I delete data (some, not all) from a text file using PERL? I
: find it easy enough to write to and read from a text file, but can't
: figure out how to delete.
I think you are probably looking for this Frequently Asked Question
from the Perl FAQ, part 5:
"How do I change one line in a file/delete a line in a file/insert a
line in the middle of a file/append to the beginning of a file?"
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 07 Aug 1997 21:01:49 GMT
From: oliver.hellberg@fernuni-hagen.de (Oliver Hellberg)
Subject: How to create more than object at once?
Message-Id: <33ea360b.8986057@newshost.rz.hu-berlin.de>
Hello, Perl-Expertsr!
I've got a problem ... well, actually two problems. The first one: my
bad English, the second one:
I'm not able to create two objects within the same class.
An example to try to show what I mean:
#! /usr/bin/perl -w
package Paket; # Paket, that's German for package
sub new {
my $type = shift;
my $self = {};
$self{inhalt} = shift;
bless ($self, $type);
return $self;
}
sub drucke { # Well, "drucke", that's print
my $self = shift;
print "$self: $self{inhalt} \n";
}
package main;
$first = Paket->new(5);
$second = Paket->new(15);
$first->drucke();
$second->drucke();
The result: Even if I get two different values for (on? in?) $self,
the program gives me 15 for $self{inhalt} each time (twice).
What am I doing wrong? Do I have a blackout?
Thanks for any helpful answers
Oliver Hellberg
oliver.hellberg@fernuni-hagen.de
------------------------------
Date: Thu, 07 Aug 1997 18:15:51 -0400
From: Glen Culbertson <nnyxcu@ny.ubs.com>
To: Oliver Hellberg <oliver.hellberg@fernuni-hagen.de>
Subject: Re: How to create more than object at once?
Message-Id: <33EA4917.6828@ny.ubs.com>
Oliver Hellberg wrote:
>
> Hello, Perl-Expertsr!
>
> I've got a problem ... well, actually two problems. The first one: my
> bad English, the second one:
>
> I'm not able to create two objects within the same class.
>
> An example to try to show what I mean:
>
> #! /usr/bin/perl -w
>
> package Paket; # Paket, that's German for package
>
> sub new {
> my $type = shift;
> my $self = {};
> $self{inhalt} = shift;
$self->{inhalt} = shift;
> bless ($self, $type);
> return $self;
> }
>
> sub drucke { # Well, "drucke", that's print
> my $self = shift;
> print "$self: $self{inhalt} \n";
print "$self: $self->{inhalt} \n";
> }
>
> package main;
>
> $first = Paket->new(5);
> $second = Paket->new(15);
> $first->drucke();
> $second->drucke();
>
> The result: Even if I get two different values for (on? in?) $self,
> the program gives me 15 for $self{inhalt} each time (twice).
>
> What am I doing wrong? Do I have a blackout?
In your original version, $self becomes a (scalar) reference to a hash,
while $self{inhalt} is a particular value for the %self hash in the
package. $self is unrelated to %self.
>
> Thanks for any helpful answers
>
> Oliver Hellberg
> oliver.hellberg@fernuni-hagen.de
------------------------------
Date: Thu, 7 Aug 1997 23:04:58 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: How to send the constructor parameters to the base class?
Message-Id: <33EA549A.72F9@world.northgrum.com>
Sylvain St.Germain wrote:
>
> I have a ClassB that inherit from ClassA. ClassB would like to
> give its constructor parameters to its ancestor... But how?
>
> package ClassA;
> sub new {
> my $type = shift;
> my $self = {};
> print "@_\n";
> return bless $self, $type;
> }
>
> ...
>
> package ClassB;
> @ISA = qw(ClassA);
>
> sub new {
> my $type = shift;
> my $self = {};
> print "@_\n";
> return bless $self, $type;
> }
>
> ...
>
> package main;
> $a = ClassB->new("Params");
>
> The output is simply...
> Params
I take it you're asking why Perl doesn't call ClassA::new for
you when you call ClassB::new. If so, the answer is "because." :-)
Perl is unlike C++ in this regard. If you want ClassB::new
to call ClassA::new, you have to put a call to ClassA::new
in ClassB::new yourself.
But don't call ClassA::new directly. That will cause a maintenance
headache someday when you change your @ISA assignment to
"@ISA=qw(SomeOtherClass);"
Instead, let Perl figure out which class's "new" to call for
you. Replace ClassB's
my $self = {};
with
my $self = ClassB->SUPER::new(@_);
This causes Perl to find and call the "superclass's" "new",
regardless of what the superclass is called.
--
Jim Stern -- Views here are my own, not Northrop Grumman's. (El
Segundo, CA)
------------------------------
Date: 7 Aug 1997 18:23:27 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: HTTP proxy server in perl?
Message-Id: <5sdotv$o3b@flatland.dimensional.com>
darrellb@hhcl.com (Darrell Berry) writes:
> Can anyone point me at one? Nothing fancy, I just want the skeleton to
> play with...in particular I am looking for proxy code which can build a
> database of visited links, rather than offer a caching service, but
> anything I can hack is fine ;-)
You could start with HTTP::Daemon, one of the libwww modules. But
why not just install a real proxy like Squid and glean what you want
from its logs?
> pls email responses...
Don't you think others might be interested in the answer as well? :-)
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: 06 Aug 1997 21:03:09 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: eric.arnold@sun.com (Eric Arnold)
Subject: Re: JAPH (was: function pointer dereferencing)
Message-Id: <8c90yeprlu.fsf@gadget.cscaper.com>
>>>>> "Eric" == Eric Arnold <eric.arnold@sun.com> writes:
Eric> Well, you won't be able to redefine just q(), since the call for the above
Eric> stuff looks like:
Eric> &{" "}( 1, 2 );
And scarier:
*{"()"} = sub { print "Just another Perl hacker," };
"()"->("()");
Yes, you need 5.004, but anyone running downrev Perl versions is just ripe
for a bad-guy attack. (Thanks for Chip adding that syntax!)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 390 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Thu, 07 Aug 1997 10:34:46 -0600
From: John Denny <jdenny@jeppesen.com>
Subject: looking for ksh 2 perl
Message-Id: <33E9F921.F022EA2F@jeppesen.com>
I've got a bunch of ksh scripts that I want to convert to perl and
damned if I can find a ksh2perl. Before I write one has anybody already
done it? And if so where would I find this wonderful piece of work?
John
------------------------------
Date: Thu, 07 Aug 1997 19:06:53 -0500
From: Matthew <nospam@webfuture.com>
Subject: No Perls of wisdom here...
Message-Id: <33EA631C.97F33B7B@webfuture.com>
Actually, quite the opposite...
I've heard that Perl Version 5.00x supports classes (or at least some OO
stuff). Is this true. If whoever replies would be so kind as to give an
example, I would be extremely grateful.
Thanks,
Matthew
**********************************************************
Doing my bit for the consulting community...
Free resume e-mailing service at http://www.webfuture.com/resumail
(by way of thanks for all the questions I've had answered in newsgroups)
**********************************************************
------------------------------
Date: Thu, 7 Aug 1997 13:35:00 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Bret D Weinraub <bweinra@uswest.com>
Subject: Re: passing command line arguments to script in debugger
Message-Id: <Pine.GSO.3.96.970807132618.12163T-100000@kelly.teleport.com>
On Thu, 7 Aug 1997, Bret D Weinraub wrote:
> How do I debug a perl script AND pass that script command line
> arguments?
perl -d my_script arg1 arg2 arg3
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 6 Aug 1997 22:20:52 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: PID
Message-Id: <EEIJEt.5zw@bcstec.ca.boeing.com>
In article <Pine.GSO.3.96.970806125652.20561A-100000@epic12.Stanford.EDU>,
Qiang Dai <dq@leland.Stanford.EDU> wrote:
> How do I get the process ID for a process created by
> the open statement like this?
>
> open(FIN, './myprog |');
>
my $pid = open(...);
> Is it possible to communicate with the process created
> this way?
>
>
Yes. The pipe already enables you to read stdout
from the piped process.
Do you have other communication in mind?
HTH,
--
Charles DeRykus
ced@carios2.ca.axe_this.boeing.com
------------------------------
Date: 7 Aug 1997 20:53:59 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Pre-forking server example needed
Message-Id: <5sdcl7$p0q$1@en1.engelschall.com>
Robert Sturrock <rns@ariel.ucs.unimelb.EDU.AU> wrote:
> Does anyone have any examples of server code (in Perl) that "pre-fork()s"
> a number of child processes, and then uses those children to service
> client requests when they arrive. Similar to the way servers like
> squid operate, but in Perl?
YES! :-)
Go ask Ralf S. Engelschall: <rse@en.muc.de>
He's done that for a Web Crawler for a Search Engine.
Yours sincerely,
--
Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
"There is enough for the need of everyone in this world,
but not for the greed of everyone." - Mahatma Gandhi
>> Unsolicited commercial email goes directly to /dev/null <<
------------------------------
Date: 7 Aug 1997 17:03:05 -0500
From: chadbour@sashimi.wwa.com (James Weisberg)
Subject: Request for example select()-server
Message-Id: <5sdgmp$ks@miso.wwa.com>
Can someone point me to an example TCP/IP server written in
Perl which uses select() on multiple filehandles? All the
examples I see fork a child process to connect to the client.
I would like to see an example of multiple clients connecting
to one server and using select() to return the socket fd of
the client making the request.
Any info highly appreciated.
------------------------------
Date: Thu, 7 Aug 1997 15:10:46 -0500
From: perrella andrew c <perrella@ehsn23.cen.uiuc.edu>
Subject: Sorting With Perl
Message-Id: <Pine.SOL.3.95.970807150943.14036A-100000@ehsn23.cen.uiuc.edu>
Hello,
I am working on a phone book script. Basically I have everything
working well except that I would like to sort the entries. Here is the
deal.
THe program displays the phone book entries in HTML table format.
The entries themselves are stored in a users data file
A typical datafile entry looks like this:
<tr><td>First_name<td>Last_Name<td>Phone#<td>fax<td>address
<td>city<td>state<td>zip<td>Country
<tr><td>Comments:<td colspan=8>Comments
Currently I slurp them into a string $user_data and output that string
along with the rest of the HTML code.
I would like to break the string apart, sort the entries by first name and
recombine them into a new string $sorted_data which could then be
outputed with the other html.
I can split $user_data entries into a list array with
@temp = split (/<tr><td>/, $user_data);
for($i=0; $i < @temp; $i+=2){
$data_array[$i] = $temp[$i] . $temp[$i + 1];
}
$data_array[$i] = $temp[$i] . $temp[$i + 1];
}
but I don't know how to sort that array. Actually $i+=2 might not be the
excact code for incrementing $i by two, so I may need to correct that as
well.
Any Ideas?
Thanks,
Andrew Perrella
perrella@uiuc.edu
------------------------------
Date: 7 Aug 1997 23:10:05 GMT
From: jdf@pobox.com (Jonathan Feinberg)
Subject: Re: Substitution/Read/Write (infinite loop?)
Message-Id: <5sdkkd$c0r$1@gte2.gte.net>
rootbeer@teleport.com said...
> In the code you posted, I also saw the possibility that your code could
> die(), which, in a CGI script, could cause you to see a "document contains
> no data" message. You may want to trap the die, or an error message that
> it produces, so that you can see what the error message says.
I'll add that CGI::Carp redirects the output of "warn" and "die"
into your httpd's error logs. Very handy for debugging.
Get CGI.pm from CPAN.
--
Jonathan Feinberg jdf@pobox.com Sunny Manhattan, NY
------------------------------
Date: Thu, 7 Aug 1997 13:22:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: a-sylvim@microsoft.com
Subject: Re: translating accented characters to non-accented chars
Message-Id: <Pine.GSO.3.96.970807131801.12163R-100000@kelly.teleport.com>
On Thu, 7 Aug 1997 a-sylvim@microsoft.com wrote:
> My problem is I have a file that has ascii characters above 128
> (accented characters, etc). I need to translate these to non-accented
> chars, for example, e with an accent should become just plain e. I was
> thinking of creating a function with a long list of one-to-one
> translations with s/// , but it seems like there must be an easier way.
An easier way (and faster, too!) would be to use one tr/// instead of many
s/// commands. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 825
*************************************