[23464] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5678 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 17 21:06:11 2003

Date: Fri, 17 Oct 2003 18:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 17 Oct 2003     Volume: 10 Number: 5678

Today's topics:
        Basic/???/???/Perl quote: "once a year/month/week/day" <nospam-abuse@ilyaz.org>
    Re: Emacs syntax highlight of Perl comments <michael.p.broida@boeing_oops.com>
        escape email quotes <kim@foo.com>
    Re: escape email quotes <REMOVEsdnCAPS@comcast.net>
    Re: escape email quotes <kuujinbo@hotmail.com>
    Re: How can i write the values of a form through a cgi  (JR)
    Re: Kill forked process on Windows 2000 (Bill)
    Re: Kill forked process on Windows 2000 <bart.lateur@pandora.be>
    Re: Need help with "substitute" operator.... <krahnj@acm.org>
    Re: OT: 'time' utilty for Win*? (!Cygwin) <bik.mido@tiscalinet.it>
    Re: Perl scripts for Unix on my windows machine <michael.p.broida@boeing_oops.com>
    Re: Perl scripts for Unix on my windows machine <michael.p.broida@boeing_oops.com>
    Re: Perl scripts for Unix on my windows machine <michael.p.broida@boeing_oops.com>
    Re: Perl scripts for Unix on my windows machine <ebohlman@earthlink.net>
    Re: really hard regex ;( <segraves_f13@mindspring.com>
    Re: Scope of \Q, \L, \U, etc. <michael.p.broida@boeing_oops.com>
    Re: Scope of \Q, \L, \U, etc. (Jay Tilton)
    Re: split operator <thierry.longer@wanadoo.fr>
        TIFF conversion with Image::Magick (Jesse Sheidlower)
        win32 interprocess communication on one machine <hekmanATgeo-slopeDOTcom@no.spam>
    Re: win32 interprocess communication on one machine <some@one.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 17 Oct 2003 20:16:50 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Basic/???/???/Perl quote: "once a year/month/week/day"
Message-Id: <bmpini$5ap$1@agate.berkeley.edu>


I googled for 15 min, but could not find the exact quote which was
going similar to that:

  Basic is good for people who program once a year, ??? for once a
  month, ??? for once a week; Perl is good if you use it dayly.

Any help?

Thanks,
Ilya


------------------------------

Date: Fri, 17 Oct 2003 18:50:41 GMT
From: "Michael P. Broida" <michael.p.broida@boeing_oops.com>
Subject: Re: Emacs syntax highlight of Perl comments
Message-Id: <3F903A01.A23F0A25@boeing_oops.com>

"Eric J. Roode" wrote:
> 
> "Michael P. Broida" <michael.p.broida@boeing_oops.com> wrote in
> news:3F8F196F.7116E5EF@boeing_oops.com:
> 
> > "Eric J. Roode" wrote:
> >>
> >> Are you using perl-mode or cperl-mode?  cperl-mode is far better than
> >> perl-mode.  Also, be sure to use the latest version.  cperl-mode 5.0 is
> >> quite excellent -- I don't think I've come across a situation yet where
> >> it highlights incorrectly.
> >
> >      OOOH!  I just tried cperl-mode and it does look nicer than
> >      perl-mode.  :)  Might take some getting used to, though.
> >
> >      Now, how do I make that the default for .pl and .pm files?
> 
> Add the following lines to your .emacs file:
> 
> (setq auto-mode-alist (cons '("\\.pl$"  . cperl-mode) auto-mode-alist))
> (setq auto-mode-alist (cons '("\\.pm$"  . cperl-mode) auto-mode-alist))
> (setq auto-mode-alist (cons '("\\.cgi$" . cperl-mode) auto-mode-alist))

	Great!  Thank you!  :)


------------------------------

Date: Fri, 17 Oct 2003 12:22:15 -0700
From: "Kimberly Baderhoefen" <kim@foo.com>
Subject: escape email quotes
Message-Id: <QhCdneA6KKh73A2iU-KYvQ@giganews.com>

My script is getting an email address passed to it as one of the arguments
through getopt. I take arguments from command line and send email to the
variable ($opt_email) when script is done. When I send email to the variable
that the email addess is stored in, it bounces because perl does not escape
the "@" symbol in the variable. I tried using quotemeta, but that escapes
the "." as well as the "@".  How do I escape only the "@" symbol in a scalar
variable?

$opt_email = (quotemeta($opt_email)); # escapes "@" AND "."

I am grateful for any assistance




------------------------------

Date: Fri, 17 Oct 2003 17:46:42 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: escape email quotes
Message-Id: <Xns9417BF098945Bsdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

"Kimberly Baderhoefen" <kim@foo.com> wrote in
news:QhCdneA6KKh73A2iU-KYvQ@giganews.com: 

> My script is getting an email address passed to it as one of the
> arguments through getopt. I take arguments from command line and send
> email to the variable ($opt_email) when script is done. When I send
> email to the variable that the email addess is stored in, it bounces
> because perl does not escape the "@" symbol in the variable. I tried
> using quotemeta, but that escapes the "." as well as the "@".  How do
> I escape only the "@" symbol in a scalar variable?
> 
> $opt_email = (quotemeta($opt_email)); # escapes "@" AND "."

How are you sending the mail?

What sort of escaping needs to be done?

Perl does not escape *any* data -- either you escape it yourself when you 
hardcode values into a program, or you can perform substitutions on data.

What is happening to the @ that shouldn't -- or, what isn't happening to it 
that should?

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP5BxVGPeouIeTNHoEQJbSgCgx8bMQfORxN01v26JdOB67hufLawAnRsg
RQzKrMdcXmj2DuuILRUZ0OwM
=pNDv
-----END PGP SIGNATURE-----


------------------------------

Date: Sat, 18 Oct 2003 08:33:52 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: escape email quotes
Message-Id: <bmpuda$rt4$1@pin3.tky.plala.or.jp>

Kimberly Baderhoefen wrote:
> My script is getting an email address passed to it as one of the arguments
> through getopt. I take arguments from command line and send email to the
> variable ($opt_email) when script is done. When I send email to the variable
> that the email addess is stored in, it bounces because perl does not escape
> the "@" symbol in the variable. I tried using quotemeta, but that escapes
> the "." as well as the "@".  How do I escape only the "@" symbol in a scalar
> variable?
> 
> $opt_email = (quotemeta($opt_email)); # escapes "@" AND "."
> 
> I am grateful for any assistance
> 
> 

$opt_email =~ s/(@)/\\$1/;

HTH - keith



------------------------------

Date: 17 Oct 2003 12:01:16 -0700
From: jorenders@hotmail.com (JR)
Subject: Re: How can i write the values of a form through a cgi script in a txt file.
Message-Id: <4096148f.0310171101.6e57cf63@posting.google.com>

Tore Aursand <tore@aursand.no> wrote in message news:<pan.2003.10.16.20.26.44.319093@aursand.no>...
> On Thu, 16 Oct 2003 12:57:41 -0700, JR wrote:
> >>> How can i write the values of a form through a cgi script in a txt file.
>  
> >> What have you tried so far?  What doesn't work?
>  
> > #!/usr/bin/perl
> 
> Should be:
> 
>   #!/usr/bin/perl
>   #
>   use strict;
>   use warnings;
> 
> > print "Content-type:text/html\n\n";
> > 
> > read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> > @pairs = split(/&/, $buffer);
> > foreach $pair (@pairs) {
> >     ($name, $value) = split(/=/, $pair);
> >     $value =~ tr/+/ /;
> >     $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> >     $FORM{$name} = $value;
> > }
> 
> Should be:
> 
>   use CGI;
> 
>   my $cgi = CGI->new();
>   print $cgi->header(-type => 'text/html');
> 
> > open (EEP,"passwords.txt");foreach $key (keys(%FORM)) {
> >     print EEP "$key = $FORM{$key}<br>";
> > }
> 
> Should be:
> 
>   my $params = $cgi->Vars();
>   open( EEP, '>passwords.txt' ) || die "$!";
>   foreach my $key ( keys %$params ) {
>       print EEP $key . ' = ' . $params{$key} . '<br';
>   }
>   close( EEP );
> 
> But why do you want to write some HTML to STDOUT, while the form data gets
> written to a text file?
> 
> Summary:
> 
>   perldoc CGI
>   perldoc -f open

I tried your code but i get the follow error

Status: 302 Found Location:
/bin/error?error=Your%20script%20produced%20this%20error%3A%20%3Cbr%3EUndefined%20subroutine%20CGI%3A%3AVars%20at%20CGI.pm%20line%20349.
URI: /bin/error?error=Your%20script%20produced%20this%20error%3A%20%3Cbr%3EUndefined%20subroutine%20CGI%3A%3AVars%20at%20CGI.pm%20line%20349.
Content-type: text/html


------------------------------

Date: 17 Oct 2003 12:33:54 -0700
From: wherrera@lynxview.com (Bill)
Subject: Re: Kill forked process on Windows 2000
Message-Id: <239ce42f.0310171133.4000742d@posting.google.com>

Stéphane Métais <stephane.metais-pourriel@laposte.net> wrote in message news:<3f8fc6c9$0$27032$626a54ce@news.free.fr>...
> Hello,
> 
> I am writing a perl script using fork().
> The parent process manages the GUI (with Tk) while the child executes 
> some work (the 2 processes communicate through a pipe)
> 
> But i am facing 3 issues :
> 1) When terminating, the child causes the following error :
>      Unable to register TclNotifier window class
>      Tcl_Panic at my_script line xxx.

This should not happen. I'm crossposting this thread to c.l.p.tk for
folks there to advise.


------------------------------

Date: Fri, 17 Oct 2003 22:37:29 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Kill forked process on Windows 2000
Message-Id: <fdr0pv8hldblon6md885ca96a33da6rif9@4ax.com>

Stéphane Métais wrote:

>So my question : does the "kill" command works properly on Windows 2000 
>? If yes, how ?

Maybe it does, maybe it doesn't, but AFAIK, fork() is emulated, using
threads. In short: (I think) the parent and the child are actually
threads in the same process. That could be the cause of your problems.

Using Win32::Process, you can really launch a separate program for the
child. See this node on Perlmonks for a starting point. Good luck.

	<http://perlmonks.org/?node_id=192421>

-- 
	Bart.


------------------------------

Date: Fri, 17 Oct 2003 18:52:39 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Need help with "substitute" operator....
Message-Id: <3F903A60.6CB26328@acm.org>

Brian McCauley wrote:
> 
> > John W. Krahn wrote:
> >
> > > $str =~ s/\\(\*)|\*.*/$1/g;
> 
> Oh, and John's isn't really the shortest anyhow if you have warnings
> enabled (which, of course, you should).
> 
> If you have warnings enabled John's becomes:
> 
> {
>   no warnings 'uninitialized';
>   $str =~ s/\\(\*)|\*.*/$1/g;
> }

Or:

$str =~ s/\\(\*)|\*.*/$1||''/eg;



John
-- 
use Perl;
program
fulfillment


------------------------------

Date: Fri, 17 Oct 2003 22:18:03 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: OT: 'time' utilty for Win*? (!Cygwin)
Message-Id: <vvh0pvo83saed8j7l37cdk1hbttmj3emrf@4ax.com>

On Fri, 17 Oct 2003 10:58:24 GMT, Bart Lateur <bart.lateur@pandora.be>
wrote:

>>I know this is OT, but since I use 'time' under Linux for quick tests
>>of my perl scripts, I'm asking here...
>
>Quick tests on you perl scripts? Timing tests? Look at the following
>Perl modules:

OK... was it hard to understand that I was (partially!) cheating to
find help from knowledgeable people on this ng? :-)

> - Benchmark
> - Time::HiRes

Well, I know them and have used them on some occasions. But to be
fair, (i) it is just so easy to type 'time cmd' whatever cmd can be,
(2) I cheated in the sense that I don't happen to use 'time' *only*
with perl scripts, nay, there have been indeed cases when I made
comparisons with it between shell scripts, perl scripts and
executables.

Oh, in the end I think it's a useful utility in the *nix word that I'd
be glad to have available also under Windows, so if by any chance you
can give useful information, I'll be very grateful to you!


TIA,
Michele
-- 
# This prints: Just another Perl hacker,
seek DATA,15,0 and  print   q... <DATA>;
__END__


------------------------------

Date: Fri, 17 Oct 2003 18:44:52 GMT
From: "Michael P. Broida" <michael.p.broida@boeing_oops.com>
Subject: Re: Perl scripts for Unix on my windows machine
Message-Id: <3F9038A4.85FA3C12@boeing_oops.com>

Eric Bohlman wrote:
> 
> "Michael P. Broida" <michael.p.broida@boeing_oops.com> wrote in
> news:3F8F1622.70C8B275@boeing_oops.com:
> 
> >> Windows can use "/" as the directory separator too.
> >
> >      Inconsistently, from my experience.  Within Perl code,
> >      yes, either way works well (most of the time) because
> >      Perl itself is handling it.  Though I did run into one
> >      case where my Perl script choked on mixed "/" and "\"
> >      in a single filespec.  Outside of Perl, Windows usually
> >      hates the forward slash (or maybe it hates ME when I
> >      use forward slashes!).
> 
> Specifically, the Windows file system has no problem at all with forward
> slashes, but the Windows shell does.  So you can't use them when typing at
> the command line or when invoking external programs from Perl (or any other
> language) code.

	Excellent clarification.  Thanks!  :)


------------------------------

Date: Fri, 17 Oct 2003 18:46:30 GMT
From: "Michael P. Broida" <michael.p.broida@boeing_oops.com>
Subject: Re: Perl scripts for Unix on my windows machine
Message-Id: <3F903906.1EA295EA@boeing_oops.com>

James Willmore wrote:
> 
> "Michael P. Broida" <michael.p.broida@boeing_oops.com> wrote in message news:<3F8F17A3.69E7019D@boeing_oops.com>...
> 
> > > perlport is the FAQ I was eluding to in my previous post.
> >
> >       Ah, thanks.  Is there some (simple) way to get a list of all
> >       the "xxxx" that can be used in "perldoc xxxx"?  I mean "perlre",
> >       "perltut", "perlop", etc, but is there one that will give a
> >       list of all the rest??  Without knowing the "xxxx", it's
> >       often hard (for me anyway) to find info with perldoc.
> 
> perldoc perl -or- perldoc perlfaq

	Exactly what I needed.  Thanks!  That will help
	me a lot and SOON!  :)


------------------------------

Date: Fri, 17 Oct 2003 18:48:14 GMT
From: "Michael P. Broida" <michael.p.broida@boeing_oops.com>
Subject: Re: Perl scripts for Unix on my windows machine
Message-Id: <3F90396E.CAE9F53E@boeing_oops.com>

Tad McClellan wrote:
> 
> Michael P. Broida <michael.p.broida@boeing_oops.com> wrote:
> 
> >       Ah, thanks.  Is there some (simple) way to get a list of all
> >       the "xxxx" that can be used in "perldoc xxxx"?
> 
> I just do:
> 
>    gopod
>    ls
> 
> where I have an alias like this defined:
> 
>    gopod='cd /usr/local/lib/perl5/5.8.0/pod'

	Well, I didn't specify it before, but I'm on a Windows
	system here and don't have any Unix boxes around.  :)
	I'll have to stick with "perldoc".

> For just the list:
> 
>    perldoc perl
> 
> For more detail on what's covered in each:
> 
>    perldoc perltoc

	Thanks!  That will help a ton!  :)


------------------------------

Date: 17 Oct 2003 19:00:12 GMT
From: Eric Bohlman <ebohlman@earthlink.net>
Subject: Re: Perl scripts for Unix on my windows machine
Message-Id: <Xns94179059ABEADebohlmanomsdevcom@130.133.1.4>

"Michael P. Broida" <michael.p.broida@boeing_oops.com> wrote in 
news:3F90396E.CAE9F53E@boeing_oops.com:

> Tad McClellan wrote:
>> where I have an alias like this defined:
>> 
>>    gopod='cd /usr/local/lib/perl5/5.8.0/pod'
> 
>      Well, I didn't specify it before, but I'm on a Windows
>      system here and don't have any Unix boxes around.  :)
>      I'll have to stick with "perldoc".

You can use a batch file to achieve the same effect.  Slightly more work to 
create, but just as easy to use afterwards.


------------------------------

Date: Sat, 18 Oct 2003 00:06:22 GMT
From: "Bill Segraves" <segraves_f13@mindspring.com>
Subject: Re: really hard regex ;(
Message-Id: <2u%jb.1484$W16.318@newsread2.news.atl.earthlink.net>

"Thomas" <sctommi@gmx.net> wrote in message
news:5a1109df.0310170850.52ab47c7@posting.google.com...
> hi community...
> i have a hard work with a "really good" regex -
> my regex should substitute/insert (in pdf) something like
> /V () with my new value...

If you mean to replace instances of

    /V (old_value)

with

    /V (new_value)

in a PDF file, your efforts are likely misguided, as a PDF file is not
intended to be edited in this fashion. While you may be able to make the
substitutions you desire in some cases, your efforts will often be
frustrated by the generation of invalid PDF files.

You'll enjoy greater success if you use the import/export (FDF, XFDF), and
submit methods that are officially supported for PDFs.

IMO, your objective is more appropriate for newsgroup comp.text.pdf, where
you'll find a number of experts willing to guide you on legitimate issues
with the use of PDF files.

Good luck.

Bill Segraves




------------------------------

Date: Fri, 17 Oct 2003 19:14:58 GMT
From: "Michael P. Broida" <michael.p.broida@boeing_oops.com>
Subject: Re: Scope of \Q, \L, \U, etc.
Message-Id: <3F903FB2.13D48592@boeing_oops.com>

Edi Weitz wrote:
> 
 <snip>
> 
>   edi@bird:~ > perl -le '$a="Aa-"; print "\L$a\Q$a\E$a"'
>   aa-aa\-aa-
>   edi@bird:~ > perl -le '$a="Aa-"; print "\L$a\U$a\E$a"'
>   aa-AA-Aa-
> 
> Now the \E ends the scope of both \L and \U, the string behind \E
> remains unmodified.

	Since \U and \L are opposites, I think it's more probable
	that the \U ends the scope of the \L, and the \E ends the
	scope of whatever is the most recent.  The \U and \L each
	kinda imply the end of the other one.

		Mike


------------------------------

Date: Fri, 17 Oct 2003 23:34:35 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Scope of \Q, \L, \U, etc.
Message-Id: <3f907225.474919095@news.erols.com>

Edi Weitz <edi@agharta.de> wrote:

: man perlop says:
: 
:            \L          lowercase till \E
:            \U          uppercase till \E
:            \E          end case modification
:            \Q          quote non-word characters till \E
:
: However, it doesn't seem to be that simple:

When investigating how Perl gets its DWIM, squeezing code through the
B::Deparse backend complements the test/hypothesize cycle very well.

:   edi@bird:~ > perl -le '$a="Aa-"; print "\Q$a\L$a\E$a"'
:   Aa\-aa\-Aa\-

Deparsed:  print("\Q$a\L$a\E$a\E");

:   edi@bird:~ > perl -le '$a="Aa-"; print "\L$a\Q$a\E$a"'
:   aa-aa\-aa-

    print("\L$a\Q$a\E$a\E");

: These two cases seem to imply

and B::Deparse confirms

: that it isn't as simple as "till \E" but
: that the scopes of these modifiers can be nested - in the first case
: the scope of \Q extendes beyond the \E, in the second case the scope
: of \L extends beyond the \E.
:
: But not if we replace \Q with \U: 
: 
:   edi@bird:~ > perl -le '$a="Aa-"; print "\L$a\Q$a\E$a"'
:   aa-aa\-aa-
:   edi@bird:~ > perl -le '$a="Aa-"; print "\L$a\U$a\E$a"'
:   aa-AA-Aa-

    print("\L$a\E\U$a\E$a");
 
: Now the \E ends the scope of both \L and \U,

Not quite what's going on, but the conclusion is consistent with
observed behavior.  The effect of \L is terminated before the \U begins.

So \Q can nest inside \U or \L,
and \U or \L can nest inside \Q,
but \U or \L cannot nest inside each other--one will be terminated
before the next begins.

: And what about this one? 
: 
:   edi@bird:~ > perl -le '$a="Aa-"; print "\Q$a\L$a\E$a"'
:   Aa\-aa\-Aa\-
:   edi@bird:~ > perl -le '$a="Aa-"; print "\U\Q$a\L$a\E$a"'
:   AA\-aa-Aa-
:
: By placing \U in front of the string the scope of \Q suddenly ends
: at \L? How's that?

That's an interesting one.  The deparse is very enlightening.

    print("\U\Q$a\E\E\L$a\E$a");

The \U gets terminated before \L since they don't nest,
and since the \Q is inside the \U, they both get terminated.

: Am I missing any rules which could explain this behaviour or are we
: just looking at implementation bugs?

It doesn't look like a bug.  I don't see an explanation of what's really
going on in perlop.  Maybe it could stand to have a brief note added.



------------------------------

Date: Fri, 17 Oct 2003 22:20:40 +0200
From: "Thierry" <thierry.longer@wanadoo.fr>
Subject: Re: split operator
Message-Id: <bmpitm$kb6$1@news-reader5.wanadoo.fr>

Change the commas nested between the brakets first by another separator,
then use the split command, eventually you put back the commas.
T

"Benedikt Feldhaus" <software@werthmesstechnik.de> a écrit dans le message
de news: bmo3kn$ng4rt$1@ID-119432.news.uni-berlin.de...
> Hi,
>
> I have this line
> "a, b, c, [11, 22, 33], d"
> I want to split this line, not splitting the values in brackets.
> My result should be
> a
> b
> c
> [11, 22, 33]
> d
>
> Any ideas?
>
> Benedikt
>
>




------------------------------

Date: 17 Oct 2003 16:00:19 -0400
From: jester@panix.com (Jesse Sheidlower)
Subject: TIFF conversion with Image::Magick
Message-Id: <bmphoj$7q0$1@panix2.panix.com>


I've been sent some files in TIFF format, with each file
supposedly consisting of several hundred small images
in different "frames". Each file is about 750K or so.

First of all, I've tried to view these images in several
programs, including xloadimage, the GIMP, GQView, and
some others, and there's no indication that they contain
anything more than a single image. 

Second, and Perl-related, I've tried to convert these to PNG
or some other format using Image::Magick, and it is not
working. I used a very simple test script, that works on
standard TIFF files, with the suggested approach of

  $x = $img->Read('image_A.tiff');
  warn $x if $x;

  $x = $img->Write('image_A.png');
  warn $x if $x;

but when I run this, after about 30 seconds of working, I get
a "Killed" response; it doesn't get to the first "warn" stage
at all, let alone give me the nice error messages the docs
promise. I get an identical response using "convert" on the
commandline. I've looked through Martien's book with no luck.

Any suggestions for converting these files? Optimally
I suppose I'd like to get each "frame" saved as a
separate file, but right now I'll settle for finding
out what's going on.

Thanks.

Jesse Sheidlower


------------------------------

Date: Fri, 17 Oct 2003 14:17:37 -0600
From: "Nathaniel Hekman" <hekmanATgeo-slopeDOTcom@no.spam>
Subject: win32 interprocess communication on one machine
Message-Id: <T9Yjb.8352$f7.450584@localhost>

I have a parent process which spawns off several child processes using
Win32::Process.  The parent is just a controller, the children are perl
scripts doing the actual work I'm trying to accomplish.  The parent has a
long list of jobs to do, launches three children to handle the first three
jobs, and whenever any child finishes the parent launches another child with
the next job, and so on until they're all done.  (Ideally I'd like the
children to be threads instead of separate processes, but from what I can
see ActivePerl doesn't support threads yet on Windows.)

Unfortunately, if I launch these child processes too quickly one after
another, I get errors on the screen saying "could not extract perl runtime"
or something along those lines.  If I put a 2-3 second delay between
launching each child I don't get that problem, but of course it slows down
the job.

I'd like to change the design, and launch three children immediately, then
feed them jobs.  When one finishes a job it keeps running and the parent
gives another job to do.  That would avoid shutting down and recreating
processes, and would avoid having to use that 2-second delay.

I realise I could do this using sockets, but that seems like overkill (and a
security risk) since the children and parent are running on the same
computer.  What else would you suggest?

Thanks for any ideas.


Nate Hekman
Calgary, Alberta, Canada




------------------------------

Date: Fri, 17 Oct 2003 20:24:00 GMT
From: Anand <some@one.com>
Subject: Re: win32 interprocess communication on one machine
Message-Id: <AdYjb.3214$8x2.1892443@newssrv26.news.prodigy.com>

You can use unnamed pipes for parent-child communication. Another 
alternative would be to use signals.

--Anand

Nathaniel Hekman wrote:
> I have a parent process which spawns off several child processes using
> Win32::Process.  The parent is just a controller, the children are perl
> scripts doing the actual work I'm trying to accomplish.  The parent has a
> long list of jobs to do, launches three children to handle the first three
> jobs, and whenever any child finishes the parent launches another child with
> the next job, and so on until they're all done.  (Ideally I'd like the
> children to be threads instead of separate processes, but from what I can
> see ActivePerl doesn't support threads yet on Windows.)
> 
> Unfortunately, if I launch these child processes too quickly one after
> another, I get errors on the screen saying "could not extract perl runtime"
> or something along those lines.  If I put a 2-3 second delay between
> launching each child I don't get that problem, but of course it slows down
> the job.
> 
> I'd like to change the design, and launch three children immediately, then
> feed them jobs.  When one finishes a job it keeps running and the parent
> gives another job to do.  That would avoid shutting down and recreating
> processes, and would avoid having to use that 2-second delay.
> 
> I realise I could do this using sockets, but that seems like overkill (and a
> security risk) since the children and parent are running on the same
> computer.  What else would you suggest?
> 
> Thanks for any ideas.
> 
> 
> Nate Hekman
> Calgary, Alberta, Canada
> 
> 



------------------------------

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 5678
***************************************


home help back first fref pref prev next nref lref last post