[19260] in Perl-Users-Digest
Perl-Users Digest, Issue: 1455 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 6 21:05:30 2001
Date: Mon, 6 Aug 2001 18:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <997146307-v10-i1455@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 6 Aug 2001 Volume: 10 Number: 1455
Today's topics:
Re: Change in Perl ENV variables. <somewhere@in.paradise.net>
Re: Change in Perl ENV variables. (Abigail)
FAQ: How can I get the unique keys from two hashes? <faq@denver.pm.org>
Re: how to find free disk space (Win32) <slaven.rezic@berlin.de>
Re: launching a perl program not in a window <jurgenex@hotmail.com>
Re: launching a perl program not in a window <jurgenex@hotmail.com>
Re: launching a perl program not in a window <brentdax1@earthlink.net>
Re: launching a perl program not in a window <ow22@nospam-cornell.edu>
Re: Perl Logical Knot Problem <stephen.p.harris@worldnet.att.net>
Re: prompting and redirection with ssh (David Efflandt)
Re: q: launching a perl script from a perl script <brentdax1@earthlink.net>
Re: q: launching a perl script from a perl script <ow22@nospam-cornell.edu>
Re: Sending e-mail from a script in MS windows <dan@nospam_dtbakerprojects.com>
Re: Sending e-mail from a script in MS windows (Martien Verbruggen)
SOAP::Transport and forking servers... how to do it? landman@delete_this_part_of_the_address.mediaone.net
Re: SOAP::Transport and forking servers... how to do it <riepel@Zathras.Stanford.EDU>
Touch a file with specific timestamp? chiry@csua.Berkeley.EDU
Re: Touch a file with specific timestamp? (Abigail)
Re: Touch a file with specific timestamp? (Martien Verbruggen)
Re: Trouble Finding Parse::RecDescent for Perl 5.004 <bart.lateur@skynet.be>
Re: validate IP address (Alan Barclay)
Re: validate IP address (Martien Verbruggen)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 7 Aug 2001 08:03:41 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Re: Change in Perl ENV variables.
Message-Id: <pxEb7.5$r31.189496@news.interact.net.au>
"Tom Meyer" <tsmeyer@fnal.gov> wrote in message
news:3B6F06ED.41DF7CFD@fnal.gov...
> On an old version of Perl I was able to collect the environmental variable
"REMOTE_HOST" which was the IP name of the requesting machine. This was
done for internal auditing of web site usage. I upgraded machines, and my
version of Perl to 5.6.1 and "REMOTE_HOST" is now an empty string. I still
get the "REMOTE_ADDR" or the IP address but, as you can imagine, this gets
tedious looking up the machines by this method.
The environment variables you mention are supplied by your webserver. This
is not a Perl issue.
------------------------------
Date: 6 Aug 2001 23:34:51 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Change in Perl ENV variables.
Message-Id: <slrn9muadq.vbm.abigail@alexandra.xs4all.nl>
Tom Meyer (tsmeyer@fnal.gov) wrote on MMDCCCXCVII September MCMXCIII in
<URL:news:3B6F06ED.41DF7CFD@fnal.gov>:
|| On an old version of Perl I was able to collect the environmental variable "R
Since REMOTE_HOST is, as you write yourself, coming from the ENVIRONMENT
- the same environment you seem to have modified - wouldn't it be better
to first check the environment instead of blaming Perl first?
And, please, not everyone has 16 feet monitors. Keep your lines under
about 72 characters.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Tue, 07 Aug 2001 00:17:02 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How can I get the unique keys from two hashes?
Message-Id: <2sGb7.71$T3.171058176@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
How can I get the unique keys from two hashes?
First you extract the keys from the hashes into lists, then solve the
"removing duplicates" problem described above. For example:
%seen = ();
for $element (keys(%foo), keys(%bar)) {
$seen{$element}++;
}
@uniq = keys %seen;
Or more succinctly:
@uniq = keys %{{%foo,%bar}};
Or if you really want to save space:
%seen = ();
while (defined ($key = each %foo)) {
$seen{$key}++;
}
while (defined ($key = each %bar)) {
$seen{$key}++;
}
@uniq = keys %seen;
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
04.62
--
This space intentionally left blank
------------------------------
Date: 06 Aug 2001 23:31:51 +0200
From: Slaven Rezic <slaven.rezic@berlin.de>
Subject: Re: how to find free disk space (Win32)
Message-Id: <878zgwkh88.fsf@vran.herceg.de>
Paul Johnston <paul.johnston@dsvr.co.uk> writes:
> Some operating systems (e.g. FreeBSD) deliberately lie about the amount
> of free space, to save 8% or so of the disk for emergencies.
Not quite true --- only root may use the extra 8%. The extra space is
used for better performance. See the tunefs manpage.
Regards,
Slaven
--
Slaven Rezic - slaven.rezic@berlin.de
tksm - Perl/Tk program for searching and replacing in multiple files
http://ptktools.sourceforge.net/#tksm
------------------------------
Date: Mon, 6 Aug 2001 15:14:36 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: launching a perl program not in a window
Message-Id: <3b6f16dd$2@news.microsoft.com>
"Oliver" <ow22@nospam-cornell.edu> wrote in message
news:9kn24m$i8l$1@news01.cit.cornell.edu...
> ya that much is true, but its mostly a point of symantics, it doesnt
really
> matter to the end user whether the script is executed on the server or the
> client or on a totally unrelated computer, as long as they get what they
> want.
While this is generally true for the end user this is not case for you as a
programmer.
It better matters a damn whole lot to you!
Saves other people from guessing, saves you from explaining what you meant,
and helps you to get a good answer in the first round.
> fact that jurgen was able to correct my mistake means that he did
understand
> what i was trying to say anyway.
Did I? For me your original posting was a confusing mumble-jumble without
much sense. While trying to clear the fog I must have inadvertently
mentioned something that solved your problem....
jue
------------------------------
Date: Mon, 6 Aug 2001 15:17:49 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: launching a perl program not in a window
Message-Id: <3b6f1798$2@news.microsoft.com>
"Steffen Müller" <tsee@gmx.net> wrote in message
news:9kn1d8$21t$01$1@news.t-online.com...
> "Oliver" <ow22@nospam-cornell.edu> schrieb im Newsbeitrag
> news:9kn0nt$gsh$1@news01.cit.cornell.edu...
> [...]A CGI script
> returns HTML in most cases. Anyway, you can't run scripts via a browser.
You
> ask for the output of some script on the server. As web servers with perl
on
> them are nice servers, they run the scripts and return their output.
Not to mention that the most basic and most important information was
missing, too:
- Oliver never ever mentioned, that his script was running as a CGI program.
jue
------------------------------
Date: Mon, 06 Aug 2001 23:58:11 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: launching a perl program not in a window
Message-Id: <naGb7.16562$t41.139291@newsread2.prod.itd.earthlink.net>
"Steffen Müller" <tsee@gmx.net> wrote in message
news:9kn03t$es0$07$1@news.t-online.com...
> "Oliver" <ow22@nospam-cornell.edu> schrieb im Newsbeitrag
> news:9kmurv$eil$1@news01.cit.cornell.edu...
> > Hi, i was wondering if anyone knew the html code for launching a perl
> > program into a hidden frame or somthing, basically i have a perl program
> > that updates an html file, i want to call this perl program but not have
> it
> > actually launch the program into a window. so i cant just use the
standarf
> > href. okay thanks a lot
> >
> > oliver
>
...
>
> print 'Location: http://YOURSERVER/PATH/HTMLFILE.HTML'."\n\n";
> print 'URI: http://YOURSERVER/PATH/HTMLFILE.HTML'."\n\n";
print "Location: http://URL_HERE\n\n";
It's a common misunderstanding that URI eq Location. Also, only the
Location would be valid in that statement, as the two \n's would make the
browser think the headers were done.
--Brent Dax
brentdax1@earthlink.net
------------------------------
Date: Mon, 6 Aug 2001 17:52:26 -0700
From: "Oliver" <ow22@nospam-cornell.edu>
Subject: Re: launching a perl program not in a window
Message-Id: <9kne4q$33j$1@news01.cit.cornell.edu>
yea i posted it there first, but no one ever answers.
"Tintin" <somewhere@in.paradise.net> wrote in message
news:TvEb7.4$D01.188460@news.interact.net.au...
>
> "Oliver" <ow22@nospam-cornell.edu> wrote in message
> news:9kmurv$eil$1@news01.cit.cornell.edu...
> > Hi, i was wondering if anyone knew the html code for launching a perl
> > program into a hidden frame or somthing, basically i have a perl program
> > that updates an html file, i want to call this perl program but not have
> it
> > actually launch the program into a window. so i cant just use the
standarf
> > href. okay thanks a lot
>
> The Javascript ng is thata way ---->
>
>
------------------------------
Date: Mon, 06 Aug 2001 22:07:14 GMT
From: "Stephen Harris" <stephen.p.harris@worldnet.att.net>
Subject: Re: Perl Logical Knot Problem
Message-Id: <myEb7.36051$gj1.3357320@bgtnsc05-news.ops.worldnet.att.net>
"Michael Carman" <mjcarman@home.com> wrote in message
news:3B6EF86F.638CCC30@home.com...
> Stephen Harris wrote:
> >
> [Attributions lost. C'mon folks, learn how to quote!]
>
> > > > && $FORM{'zip'} !~ /^[0-9]{5}$/g &&
> > > > [...]
> > >
> > > What do you think that /g gains you?
> >
> > I think the /g prevents first match success in same length fields.
>
> Maybe you should read the documentation so that you *know* what /g does
> instead of guessing?
>
I don't understand how what you quoted contradicts what I wrote.
Nor do I understand how not using the /g would have improved my code.
I used the /g so that the program would continue to search after finding
a first instance match. I asked why my program did not work. Why does
/g prevent my program from working? Perhaps I am missing something
obvious, but I can find nothing in his comment nor your quote which
explains why /g prevents my program from working correctly. My idea
was that without the /g the program would stop searching after finding
the first local instance; therefore not succeeding in evaluating all fields.
In any event, how does the /g prevent the program from working and
what portion of perlop provides the reason why my use of /g prevented
the program from running as expected. I am new and this is not clear
after reading perlop the connection as to why I should have omitted /g.
I think my use of /g benefited my program. Practically, I experimented
with /g in several cases and found it improved error finding.
Awaiting clarification,
Stephen
> From perlop:
> The /g modifier specifies global pattern matching--that is,
> matching as many times as possible within the string. How it
> behaves depends on the context. In list context, it returns a list
> of the substrings matched by any capturing parentheses in the
> regular expression. If there are no parentheses, it returns a list
> of all the matched strings, as if there were parentheses around the
> whole pattern.
>
> In scalar context, each execution of m//g finds the next match,
> returning true if it matches, and false if there is no further
> match. The position after the last match can be read or set using
> the pos() function; see pos in the perlfunc manpage. A failed match
> normally resets the search position to the beginning of the string,
> but you can avoid that by adding the /c modifier (e.g. m//gc).
> Modifying the target string also resets the search position.
>
> -mjc
------------------------------
Date: Mon, 6 Aug 2001 23:46:14 +0000 (UTC)
From: see-sig@from.invalid (David Efflandt)
Subject: Re: prompting and redirection with ssh
Message-Id: <slrn9mub25.kn0.see-sig@typhoon.xnet.com>
On Mon, 06 Aug 2001, Billy \"Bob\" Bob <billy_dont_try@verizon.net> wrote:
> I tried this, and it worked like you showed. However, what happens if
> I redirect the output? When redirected I would like the prompt to
> show up to the user, but what they type to show up in the redirected
> file. I probably wasn't very clear on this in my original post. For
> example:
>
> $ ssh -t mainpc ./input.pl > a
> Prompt on /dev/pts/1
> Feed me: It works!
> $ cat a
> You entered: It works!
My mistake for not understanding about the redirection because of the tty
thing. Output the prompt to STDERR instead of STDOUT (STDIN is still
STDIN) and just print the final ouput to STDOUT:
#!/usr/bin/perl -w
use strict;
my($reply);
$| = 1;
print STDERR "Feed me: ";
if (defined($reply = <STDIN>)) { chomp $reply; } # single line
# while (defined($_ = <STDIN>)) { $reply .= $_; } # multiline
if ($reply) {
print "You entered: $reply\n";
} else {
print "No input received\n";
}
> ssh mainpc ./input2.pl > a
Feed me: Is this what you want?
> cat a
You entered: Is this what you want?
--
David Efflandt (Reply-To is valid) http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Tue, 07 Aug 2001 00:06:57 GMT
From: "Brent Dax" <brentdax1@earthlink.net>
Subject: Re: q: launching a perl script from a perl script
Message-Id: <BiGb7.2099$nb4.137596@newsread1.prod.itd.earthlink.net>
"Oliver" <ow22@nospam-cornell.edu> wrote in message
news:9kmvfk$f6q$1@news01.cit.cornell.edu...
> yea let me add to that, it works when i run the first perl script from the
> command line, but the second time around, the system call is not executed.
> thanks
That screams environment. Make sure that the web server's user (user
'nobody' if your web server is Apache) has permission to run the script and
that %ENV{PATH} includes the correct directory (or you are giving a full
path, like "/home/account/full/path/to/script.cgi"). Alternately, change
your system line to something like this:
if($sysret=system("script.cgi")) {
#error--find a way to output the value of $sysret to the browser
exit;
}
> "Ilya Martynov" <ilya@martynov.org> wrote in message
> news:87g0b47wfg.fsf@abra.ru...
> >
> > O> is it just
> > O> system ("fullpath/script.cgi");?
> >
> > O> that doesnt seem to be working for me. thanks
> >
> > It can be wrong path, wrong permissions and so on. Check return code
> > to find exact reason. See 'perldoc -tf system' for example.
------------------------------
Date: Mon, 6 Aug 2001 18:03:36 -0700
From: "Oliver" <ow22@nospam-cornell.edu>
Subject: Re: q: launching a perl script from a perl script
Message-Id: <9knepn$45n$1@news01.cit.cornell.edu>
yea im obviously missing somthing really basic because i have now
/cgi-bin/x.cgi:
#!/usr/bin/perl -w
print ("x");
(chmod 755 x.cgi)
x.html:
<a href="/cgi-bin/x.cgi">x</a>
and im still getting "internal server error" why could that be
"Brent Dax" <brentdax1@earthlink.net> wrote in message
news:BiGb7.2099$nb4.137596@newsread1.prod.itd.earthlink.net...
> "Oliver" <ow22@nospam-cornell.edu> wrote in message
> news:9kmvfk$f6q$1@news01.cit.cornell.edu...
> > yea let me add to that, it works when i run the first perl script from
the
> > command line, but the second time around, the system call is not
executed.
> > thanks
>
> That screams environment. Make sure that the web server's user (user
> 'nobody' if your web server is Apache) has permission to run the script
and
> that %ENV{PATH} includes the correct directory (or you are giving a full
> path, like "/home/account/full/path/to/script.cgi"). Alternately, change
> your system line to something like this:
>
> if($sysret=system("script.cgi")) {
> #error--find a way to output the value of $sysret to the browser
> exit;
> }
>
> > "Ilya Martynov" <ilya@martynov.org> wrote in message
> > news:87g0b47wfg.fsf@abra.ru...
> > >
> > > O> is it just
> > > O> system ("fullpath/script.cgi");?
> > >
> > > O> that doesnt seem to be working for me. thanks
> > >
> > > It can be wrong path, wrong permissions and so on. Check return code
> > > to find exact reason. See 'perldoc -tf system' for example.
>
>
>
------------------------------
Date: Mon, 06 Aug 2001 23:32:17 GMT
From: Dan Baker <dan@nospam_dtbakerprojects.com>
Subject: Re: Sending e-mail from a script in MS windows
Message-Id: <3B6F2949.4A40160D@nospam_dtbakerprojects.com>
Tintin wrote:
> > I ended up using MIME::Lite because can be set to work from both a win21
> > machine and/or a UNIX/LINUX server as well a being able to handle
> > attachments. One thing it does NOT do is send to multiple addresses
> > using either CC or BCC as far as I could tell.
>
> [snipped example]
>
> Of course it handles CC and BCC. The very first example in the
> documentation makes this obvious.
>
> $msg = MIME::Lite->new(
> From =>'me@myhost.com',
> To =>'you@yourhost.com',
> Cc =>'some@other.com, some@more.com',
> Subject =>'Helloooooo, nurse!',
> Type =>'image/gif',
> Encoding =>'base64',
> Path =>'hellonurse.gif'
> );
---------------
hhhmmm, last I tested, it did NOT work when sending from a win32
(windows98) machine running a localhost. It may work from UNIX/LINUX
servers, but not last time I tried it.
D
------------------------------
Date: Tue, 7 Aug 2001 10:23:24 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Sending e-mail from a script in MS windows
Message-Id: <slrn9mud7s.tjn.mgjv@martien.heliotrope.home>
On Mon, 06 Aug 2001 23:32:17 GMT,
Dan Baker <dan@nospam_dtbakerprojects.com> wrote:
>
>
> Tintin wrote:
>
>> > I ended up using MIME::Lite because can be set to work from both a win21
>> > machine and/or a UNIX/LINUX server as well a being able to handle
>> > attachments. One thing it does NOT do is send to multiple addresses
>> > using either CC or BCC as far as I could tell.
>>
>> [snipped example]
>>
>> Of course it handles CC and BCC. The very first example in the
>> documentation makes this obvious.
>>
>> $msg = MIME::Lite->new(
>> From =>'me@myhost.com',
>> To =>'you@yourhost.com',
>> Cc =>'some@other.com, some@more.com',
>> Subject =>'Helloooooo, nurse!',
>> Type =>'image/gif',
>> Encoding =>'base64',
>> Path =>'hellonurse.gif'
>> );
> ---------------
>
> hhhmmm, last I tested, it did NOT work when sending from a win32
> (windows98) machine running a localhost.
What does this mean? 'Running a localhost'? Every TCP/IP implementation
AFAIK has a 'localhost'...
> It may work from UNIX/LINUX
> servers, but not last time I tried it.
What didn't work? Any errors? At what point did it stop working?
Are you sure that you had your MTA set up correctly?
Martien
--
Martien Verbruggen |
Interactive Media Division | I took an IQ test and the results
Commercial Dynamics Pty. Ltd. | were negative.
NSW, Australia |
------------------------------
Date: Mon, 06 Aug 2001 23:16:19 GMT
From: landman@delete_this_part_of_the_address.mediaone.net
Subject: SOAP::Transport and forking servers... how to do it?
Message-Id: <7zFb7.50072$bU6.724861@typhoon.mw.mediaone.net>
Folks:
This should be an easy one. Of course I cannot find a simple solution.
I am using SOAP::Transport::HTTP, and specifically the
SOAP::Transport::HTTP::Daemon method to act as a simple SOAP server.
There are various reasons why I wish to avoid going through apache if at
all possible, so I am using it in standalone mode.
It works. Quite well.
The problem I am having is that I want to build a simple
forking/threading daemon using SOAP::Transport::HTTP::Daemon and I cannot
figure out how to do this. This is approximately what I want to do :
my $daemon= $transport_server
-> new (
LocalPort =>10101,
Listen =>10 ,
Reuse =>1
)
->dispatch_to('IPC'); ;
print "SOAP at ", join(':', $daemon->sockhost, $daemon->sockport), "\n";
print "waiting for connection ...\n";
while ($daemon->accept())
{
print "\t...got one\n";
defined($child=fork) or die "unable to fork: $!\n";
if ($child == 0)
{
#child process, will do the handling of the request
print "child process forked, handling request...\n";
$daemon ->handle;
}
else
{
# server process... stop listening to this socket,
print "server process waiting for new requests...\n";
and start listening for the next one...
$daemon->close;
}
}
The problems are simple. The $daemon ->handle method basically doesn't
seem to like the first connection (that gets lost into the accept
method). Then after it forks, it dies suddenly, as the $daemon->close
method is called.
Ok, I will admit some ignorance here. Is there a right way (outside of
apache) to do this? If it can be done, could someone provide a
clue/hint/code snippet to try?
If what I want is better handled by apache, would the mod_soap module be
better (easier to debug) than the mod_perl version or is it the other way
around?
Comments, suggestions, ideas are welcome to landman at mediaone dot net.
Thanks in advance.
------------------------------
Date: 06 Aug 2001 17:23:01 -0700
From: Rob Riepel <riepel@Zathras.Stanford.EDU>
Subject: Re: SOAP::Transport and forking servers... how to do it?
Message-Id: <mvyitg0vhui.fsf@Zathras.Stanford.EDU>
landman@delete_this_part_of_the_address.mediaone.net writes:
> This should be an easy one. Of course I cannot find a simple solution.
>
> I am using SOAP::Transport::HTTP, and specifically the
> SOAP::Transport::HTTP::Daemon method to act as a simple SOAP server.
> There are various reasons why I wish to avoid going through apache if at
> all possible, so I am using it in standalone mode.
>
> It works. Quite well.
>
> The problem I am having is that I want to build a simple
> forking/threading daemon using SOAP::Transport::HTTP::Daemon and I cannot
> figure out how to do this. This is approximately what I want to do :
>
>
>
> my $daemon= $transport_server
> -> new (
> LocalPort =>10101,
> Listen =>10 ,
> Reuse =>1
> )
> ->dispatch_to('IPC'); ;
> print "SOAP at ", join(':', $daemon->sockhost, $daemon->sockport), "\n";
>
> print "waiting for connection ...\n";
> while ($daemon->accept())
> {
> print "\t...got one\n";
> defined($child=fork) or die "unable to fork: $!\n";
> if ($child == 0)
> {
> #child process, will do the handling of the request
> print "child process forked, handling request...\n";
> $daemon ->handle;
> }
> else
> {
> # server process... stop listening to this socket,
> print "server process waiting for new requests...\n";
> and start listening for the next one...
> $daemon->close;
> }
> }
>
> The problems are simple. The $daemon ->handle method basically doesn't
> seem to like the first connection (that gets lost into the accept
> method). Then after it forks, it dies suddenly, as the $daemon->close
> method is called.
>
> Ok, I will admit some ignorance here. Is there a right way (outside of
> apache) to do this? If it can be done, could someone provide a
> clue/hint/code snippet to try?
>
> Comments, suggestions, ideas are welcome to landman at mediaone dot net.
This works for me:
# forkHTTP.pm - Forking SOAP HTTP daemon
package SOAP::Transport::HTTP::Daemon::Fork;
use strict;
use vars qw(@ISA);
use SOAP::Transport::HTTP;
@ISA = qw(SOAP::Transport::HTTP::Daemon);
sub handle {
my $self = shift->new;
my ($c, $r, $pid);
while ($c = $self->accept) {
# fork and let the kid do the work
next if $pid = fork; die "fork: $!\n" unless defined $pid;
# close the listening socket (kids never listen)
$self->close;
# process requests, then kill the poor kid (for not listening? 8^)
while ($r = $c->get_request) {
$self->request($r);
$self->SOAP::Transport::HTTP::Server::handle;
$c->send_response($self->response);
}
$c = undef;
exit;
} continue {
# close connection
$c = undef;
}
}
1;
__END__
=head1 NAME
forkHTTP - Forking SOAP HTTP daemon
=head1 SYNOPSIS
use forkHTTP;
$daemon = SOAP::Transport::HTTP::Daemon::Fork
-> new (LocalAddr => localhost, LocalPort => 8080, Reuse => 1)
-> dispatch_to('EXAMPLE');
print "Contact SOAP server at ", $daemon->url, "\n";
$daemon->handle;
=cut
------------------------------
Date: Mon, 6 Aug 2001 23:43:19 +0000 (UTC)
From: chiry@csua.Berkeley.EDU
Subject: Touch a file with specific timestamp?
Message-Id: <9kna2n$lgt$1@agate.berkeley.edu>
Hi, what's the simplest way to touch a file with a specific timestamp?
The time stamp I have is in a string format, like
"2001" "08" "14" (y m d)
"14" "25" "36" (h m s)
I looked around but couldn't find a touch function...
this is for running on Windows.
Thanks.
--
Raymond Chi
chiry@csua.Berkeley.EDU
------------------------------
Date: 7 Aug 2001 00:09:03 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Touch a file with specific timestamp?
Message-Id: <slrn9mucdu.vbm.abigail@alexandra.xs4all.nl>
chiry@csua.Berkeley.EDU (chiry@csua.Berkeley.EDU) wrote on MMDCCCXCVII
September MCMXCIII in <URL:news:9kna2n$lgt$1@agate.berkeley.edu>:
][
][ Hi, what's the simplest way to touch a file with a specific timestamp?
][ The time stamp I have is in a string format, like
][
][ "2001" "08" "14" (y m d)
][ "14" "25" "36" (h m s)
][
][ I looked around but couldn't find a touch function...
I bet you didn't grep the documentation for 'touch'...
Abigail
--
perl -we'$;=$";$;{Just=>another=>Perl=>Hacker=>}=$/;print%;'
# A young girl dies under
# a she-oak tree. A dragon
# beside a pond.
------------------------------
Date: Tue, 7 Aug 2001 10:20:18 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Touch a file with specific timestamp?
Message-Id: <slrn9mud22.tjn.mgjv@martien.heliotrope.home>
On Mon, 6 Aug 2001 23:43:19 +0000 (UTC),
chiry@csua.Berkeley.EDU <chiry@csua.Berkeley.EDU> wrote:
>
> Hi, what's the simplest way to touch a file with a specific timestamp?
perldoc -f utime
> The time stamp I have is in a string format, like
>
> "2001" "08" "14" (y m d)
> "14" "25" "36" (h m s)
Then you'll need to transform that into a time value. You could use, for
example:
perldoc -f Time::Local
Do read that manual. The arguments that timelocal() takes are slightly
different from what humans generally expect.
> I looked around but couldn't find a touch function...
On unixes you could always call /bin/touch, and you could get a binary
version for other platforms from other places, I suppose. The cygwin
project comes to mind for MSGates.
> this is for running on Windows.
I don't know whether utime is implemented on ActiveState's version of
Perl, for example, but you should probably give it a try. It depends a
bit on whether the Win API provides access to the file system to do
things like this.
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: Tue, 07 Aug 2001 00:13:08 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Trouble Finding Parse::RecDescent for Perl 5.004
Message-Id: <jmcumt8mh37s4ordej4ltbljnp4bde5t3p@4ax.com>
Brent Dax wrote:
>I don't think Parse::RecDescent will run on 5.004. Consider this a sign
>that 5.004 is out-of-date and you should upgrade to 5.005 or better--modules
>usually don't require a version just for the hell of it.
>
>5.005 is just as stable as 5.004 (if not more so) and has many useful new
>features, such as threads and precompiled regular expressions.
Oh great. That's a help if you want to run this on a Mac. Yes, indeed,
MacPerl's latest version is 5.004 (5.6.1 is in alpha).
--
Bart.
------------------------------
Date: 6 Aug 2001 22:38:36 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: validate IP address
Message-Id: <997137512.486518@elaine.furryape.com>
In article <9kn3j5$rrc$1@suaar1ab.prod.compuserve.com>,
Richard A. Evans <EvR@compuserve.com> wrote:
>Seems to me that the regex works as expected. It *should* error if $ip_addr
>is not in the form xxx.xxx.xxx.xxx where the xxx must be <255. Am I missing
>something?
You're missing that the from xxx.xxx.xxx.xx is not the only valid form for
ip addresses.
------------------------------
Date: Tue, 7 Aug 2001 09:52:13 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: validate IP address
Message-Id: <slrn9mubdd.tjn.mgjv@martien.heliotrope.home>
On Mon, 6 Aug 2001 10:01:10 -0400,
Jag Man <a0197620@MailAndNews.com> wrote:
> I have an IP variable with default value 000.000.000.000 I needs to verify
> that the input value for this variable is a valid IP address.
>
> Need a shortest possible subroutine.
First of all: Not every dotted quad is a valid IP address, and not every
valid IP address needs to be a dotted quad. What do _you_ mean by valid
ip address?
use Socket;
$ip = shift;
printf "$ip is%s a valid address\n", inet_aton($ip) ? "" : " not";
Be aware that inet_aton probably has very different ideas about what
constitutes a valid address than you do.
Martien
--
Martien Verbruggen |
Interactive Media Division | Freudian slip: when you say one thing
Commercial Dynamics Pty. Ltd. | but mean your mother.
NSW, Australia |
------------------------------
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 1455
***************************************