[24593] in Perl-Users-Digest
Perl-Users Digest, Issue: 6769 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 6 03:05:48 2004
Date: Tue, 6 Jul 2004 00: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)
Perl-Users Digest Tue, 6 Jul 2004 Volume: 10 Number: 6769
Today's topics:
cgi_aim.pl script ssl errors <johnrowell@earthlink.net>
Re: Cleanup file path <Joe.Smith@inwap.com>
Re: Cleanup file path (Peter J. Acklam)
Re: Digest::Base HELP! <tadmc@augustmail.com>
equality test for multiple variables <matthew.garrish@sympatico.ca>
Re: equality test for multiple variables <uri@stemsystems.com>
Re: equality test for multiple variables <Joe.Smith@inwap.com>
Re: equality test for multiple variables <Eugene.Mikheyev@kiev.com.com.ua>
File::Find and filehandles won't open <nospam@nospam.net>
Re: File::Find and filehandles won't open (Peter J. Acklam)
Re: File::Find and filehandles won't open <Joe.Smith@inwap.com>
Re: finding every combination of n values at y position (Anno Siegel)
how install Perl into windows? <gp@nospm.hr>
Re: how install Perl into windows? <matthew.garrish@sympatico.ca>
Re: Newbie queries <mritty@gmail.com>
Re: Newbie queries <tadmc@augustmail.com>
Re: Newbie queries <tadmc@augustmail.com>
Re: Newbie queries <postmaster@castleamber.com>
Re: Newbie queries <postmaster@castleamber.com>
Re: Newbie queries <matthew.garrish@sympatico.ca>
Re: Newbie queries <postmaster@castleamber.com>
Re: Newbie: How to I extract word <nilram@hotpop.com>
pipes from forked processes (Corey_G)
Re: pipes from forked processes <troc@pobox.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 06 Jul 2004 03:19:27 GMT
From: "John Rowell" <johnrowell@earthlink.net>
Subject: cgi_aim.pl script ssl errors
Message-Id: <3ToGc.6222$R36.186@newsread2.news.pas.earthlink.net>
Hello,
I'm trying to implement Authorize.net's AIM system on my website for
processing online credit card orders. This requires transmitting credit card
numbers from my website's secure server directly to Authorize.net. So I am
trying to use their sample script, cgi_aim.pl. I thought I had configured
everything properly, but it gives me this error message:
__________________________________________________
Library www-perl (LWP) v5.65 installed
We were unable to communicate with the authorizing site. Please try again.
Total number of characters in the Authorize.Net gateway response string: 0
Total number of separators in the Authorize.Net gateway response string: 0
Response Code:
__________________________________________________
Any ideas what could be causing this?
Thanks,
John
------------------------------
Date: Mon, 05 Jul 2004 21:14:04 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Cleanup file path
Message-Id: <wwjGc.29606$XM6.4872@attbi_s53>
Yves Martin wrote:
> pjacklam@online.no (Peter J. Acklam) writes:
>
> My aim is not to get the real path of a file BUT to clean up file
> paths according to the following examples:
>
> ~/dir1/../dir2 -> ~/dir2
On my system, ~/src = /home/jms/src but
~/src/../dir2 = /home/common/sources/dir2, not /home/jms/dir2.
Why would you want to use an algorithm that is guarenteed to
return wrong data when symlinks are use? The only way to get
completely accurate results is check the filesystem on the
server (something that cannot be done on a proxy).
-Joe
------------------------------
Date: 06 Jul 2004 00:06:21 +0200
From: pjacklam@online.no (Peter J. Acklam)
Subject: Re: Cleanup file path
Message-Id: <pt7ap0rm.fsf@online.no>
Joe Smith <Joe.Smith@inwap.com> wrote:
> On my system, ~/src = /home/jms/src but
> ~/src/../dir2 = /home/common/sources/dir2, not /home/jms/dir2.
>
> Why would you want to use an algorithm that is guarenteed to
> return wrong data when symlinks are use?
It's not guaranteed to be wrong. For instance, it won't be wrong
if the symlink is to a directory within the same directory as the
symlink.
So the problem isn't that it is guaranteed to fail, but that it
isn't guaranteed to succeed. Of course, that is hardly any
better.
Peter
--
#!/local/bin/perl5 -wp -*- mode: cperl; coding: iso-8859-1; -*-
# matlab comment stripper (strips comments from Matlab m-files)
s/^((?:(?:[])}\w.]'+|[^'%])+|'[^'\n]*(?:''[^'\n]*)*')*).*/$1/x;
------------------------------
Date: Mon, 5 Jul 2004 11:52:01 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Digest::Base HELP!
Message-Id: <slrncej1ph.t51.tadmc@magna.augustmail.com>
root <root@slate.comm.ad.roke.co.uk> wrote:
^^^^ ^^^^
You are not really running your newsreader as the superuser, are you?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 6 Jul 2004 00:36:01 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: equality test for multiple variables
Message-Id: <J_pGc.14982$JG5.481220@news20.bellglobal.com>
Just curious if anyone has a more elegant way to check whether multiple
values are equal. For example, given:
$a = $b = $c = $d = $e = 'test';
is there anything better than:
if ( ($a eq $b) && ($b eq $c) && ($c eq $d) && ($d eq $e) ) { ... }
It would be nice (cleaner) if you could simply test if $a eq $b eq $c eq $d,
but that obviously won't work.
Matt
------------------------------
Date: Tue, 06 Jul 2004 04:52:00 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: equality test for multiple variables
Message-Id: <x76591vits.fsf@mail.sysarch.com>
>>>>> "MG" == Matt Garrish <matthew.garrish@sympatico.ca> writes:
MG> Just curious if anyone has a more elegant way to check whether multiple
MG> values are equal. For example, given:
MG> $a = $b = $c = $d = $e = 'test';
MG> is there anything better than:
MG> if ( ($a eq $b) && ($b eq $c) && ($c eq $d) && ($d eq $e) ) { ... }
MG> It would be nice (cleaner) if you could simply test if $a eq $b eq
MG> $c eq $d, but that obviously won't work.
use List::Util ;
min( $a, $b, $c, $d, $e ) == max( $a, $b, $c, $d, $e ) ;
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 06 Jul 2004 05:26:33 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: equality test for multiple variables
Message-Id: <cKqGc.15108$JR4.777@attbi_s54>
Uri Guttman wrote:
>>>>>>"MG" == Matt Garrish <matthew.garrish@sympatico.ca> writes:
>
>
> MG> Just curious if anyone has a more elegant way to check whether multiple
> MG> values are equal. For example, given:
>
> MG> $a = $b = $c = $d = $e = 'test';
>
> MG> is there anything better than:
>
> MG> if ( ($a eq $b) && ($b eq $c) && ($c eq $d) && ($d eq $e) ) { ... }
>
> MG> It would be nice (cleaner) if you could simply test if $a eq $b eq
> MG> $c eq $d, but that obviously won't work.
>
> use List::Util ;
>
> min( $a, $b, $c, $d, $e ) == max( $a, $b, $c, $d, $e ) ;
I expect that you meant to post this instead:
minstr( $a, $b, $c, $d, $e ) eq maxstr( $a, $b, $c, $d, $e ) ;
-Joe
------------------------------
Date: Tue, 6 Jul 2004 09:19:26 +0300
From: "Eugene Mikheyev" <Eugene.Mikheyev@kiev.com.com.ua>
Subject: Re: equality test for multiple variables
Message-Id: <ccdgck$207s$1@news.univ.kiev.ua>
> > use List::Util ;
> >
> > min( $a, $b, $c, $d, $e ) == max( $a, $b, $c, $d, $e ) ;
>
> I expect that you meant to post this instead:
>
> minstr( $a, $b, $c, $d, $e ) eq maxstr( $a, $b, $c, $d, $e ) ;
>
You really think this is more elegant? And, of course, this is fast...
------------------------------
Date: Mon, 05 Jul 2004 20:19:21 GMT
From: "Jeff Thies" <nospam@nospam.net>
Subject: File::Find and filehandles won't open
Message-Id: <dJiGc.2871$sD4.143@newsread3.news.atl.earthlink.net>
I'm doing something like this:
use File::Find;
sub doThis{
open FH,'fileA, or die $!; # just to prove it can be opened!!!
close FH or die $!;
find(\&process,'some_path');
}
sub process{
open FH2, 'fileA' or die "problem FH2: $!"; # won't open now
...
}
That's dieing like this: "problem FH2: No such file or directory... "
Can I not open filehandles in find? What's wrong?
I used to do what I wanted with opendir and grep, but I need to read the
subfolders. Can I get a list of files that process returns true on? I don't
want that to be a global array.
Jeff
------------------------------
Date: 05 Jul 2004 22:45:43 +0200
From: pjacklam@online.no (Peter J. Acklam)
Subject: Re: File::Find and filehandles won't open
Message-Id: <llhyw5c8.fsf@online.no>
"Jeff Thies" <nospam@nospam.net> wrote:
> I'm doing something like this:
>
> use File::Find;
>
> sub doThis{
> open FH,'fileA, or die $!; # just to prove it can be opened!!!
^
That comma shouldn't be there and you're missing a closing quote.
Perhaps you should post the actual code, not just "something like"
it.
> close FH or die $!;
>
> find(\&process,'some_path');
> }
>
> sub process{
> open FH2, 'fileA' or die "problem FH2: $!"; # won't open now
> ...
> }
>
> That's dieing like this: "problem FH2: No such file or directory... "
("dying")
> Can I not open filehandles in find?
Yes, you can.
> What's wrong?
Remember that process() is called for directories *and files*.
You probably want to use
sub process {
return unless -d; # skip non-directories
...
open FH2, ...
}
Peter
--
#!/local/bin/perl5 -wp -*- mode: cperl; coding: iso-8859-1; -*-
# matlab comment stripper (strips comments from Matlab m-files)
s/^((?:(?:[])}\w.]'+|[^'%])+|'[^'\n]*(?:''[^'\n]*)*')*).*/$1/x;
------------------------------
Date: Mon, 05 Jul 2004 21:26:47 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: File::Find and filehandles won't open
Message-Id: <rIjGc.29643$XM6.9151@attbi_s53>
Jeff Thies wrote:
> Can I not open filehandles in find? What's wrong?
Notice that you would get the same sort of failure when using:
open FH,'FileA' or die;
chdir "some/other/directory";
open FH2,'FileA' or die "FileA does not exist in some/other/directory";
Read the docs on File::Find looking for what it says about how the
current directory changes while find() is running.
-Joe
------------------------------
Date: 5 Jul 2004 21:14:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: finding every combination of n values at y positions
Message-Id: <cccgc5$6l8$1@mamenchi.zrz.TU-Berlin.DE>
Steve (another one) <y66y@56yu4b6.com> wrote in comp.lang.perl.misc:
> John W. Krahn wrote:
> > "Steve (another one)" wrote:
> >
> >>I have just wasted a crazy amount of time trying to populate an array
> >>containing every combination of n values at y positions. It feels as
> >>though it should be trivial and the sort of thing I do every day, but in
> >>fact I could not find the simple solution that surely must exist.
> >>
> >>Below is my best attempt - it will also explain the task if I haven't
> >>been clear - can someone tell me if there is a simpler way of doing it.
> >>
> >>[snip]
> >
> >
> > You could do it like this:
> >
> > #!/usr/bin/perl
> > use warnings;
> > use strict;
> >
> > my $min_value = 1;
> > my $max_value = 4;
> > my $number_of_positions = 3;
> >
> > my $glob = ( '{' . join( ',', $min_value .. $max_value ) . '}' ) x
> $number_of_positions;
> >
> > $individual = 0;
> > print $individual++, " - @$_\n" for map [ /./g ], glob $glob;
> >
> > __END__
> >
> >
> > :-)
> >
> > John
> cool, what a brilliant way to do it :-)
It can also be considered a counting problem.
Consider the number system whose base is $base = $max_value - $min_value + 1.
Enumerate all numbers with $number_of_positions digits in this system.
(There will be $base**$number_of_positions such numbers.) Increment each
digit individually by $min_value. That yields the required set of
combinations.
The glob is a clever hack that does the required counting. A more
direct way is this:
my @digits = ( $min_value) x $number_of_positions;
my $individual = 0;
while ( 1 ) {
print $individual++, " - @digits\n";
last unless grep $_ < $max_value, @digits;
for ( reverse @digits ) { # increment with carry
last if ++ $_ <= $max_value;
$_ = $min_value;
}
}
Anno
------------------------------
Date: Tue, 6 Jul 2004 01:42:59 +0200
From: "PHP2" <gp@nospm.hr>
Subject: how install Perl into windows?
Message-Id: <cccp3q$s7d$1@ls219.htnet.hr>
how install Perl into windows? is it enough?
Install ActivePerl into 'C:\Perl' directory.
Add 'C:\Perl\bin' to the existing path
I can not see bin.. I am cop ActivePerl unziped files to 'C:\Perl'..
how test anmy scrip on Windows? I am new on windows OS..
------------------------------
Date: Mon, 5 Jul 2004 20:15:39 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: how install Perl into windows?
Message-Id: <FamGc.11930$JG5.401446@news20.bellglobal.com>
"PHP2" <gp@nospm.hr> wrote in message news:cccp3q$s7d$1@ls219.htnet.hr...
> how install Perl into windows? is it enough?
>
> Install ActivePerl into 'C:\Perl' directory.
> Add 'C:\Perl\bin' to the existing path
>
> I can not see bin.. I am cop ActivePerl unziped files to 'C:\Perl'..
>
> how test anmy scrip on Windows? I am new on windows OS..
>
Sounds like you have the source code. Try the msi version here:
http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl
Matt
------------------------------
Date: Mon, 5 Jul 2004 15:54:02 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Newbie queries
Message-Id: <20040705155031.J22150@barbara.cs.rpi.edu>
On Mon, 5 Jul 2004, J=FCrgen Exner wrote:
> P.R.Brady wrote:
>
> Your command shell (even if it's just DOS) and the Perl interpreter
>
> > A possibly related question - why am I entreated to put the
>
> > first line of my script as:
> > #!c:\perl\perl.exe -w (I'm running under windoze)?
>
> Will simply be ignored by DOS but doesn't cause any harm either
Not quite. The line isn't ignored entirely. The Perl interpreter will
obey any switches, such as -w in this example, that are listed after the
shebang, even though the shebang isn't especially necessary when running
under Windows.
Paul Lalli
------------------------------
Date: Mon, 5 Jul 2004 12:04:17 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Newbie queries
Message-Id: <slrncej2gh.t51.tadmc@magna.augustmail.com>
P.R.Brady <iss025@bangor.ac.uk> wrote:
> Q1: Is there an index to the FAQ?
perldoc perlfaq
(You didn't think to try that already?)
> If not , how do you find your way
> round it?
I use the "-q" switch to "perldoc", or:
1) find out where the raw POD files got installed:
perldoc -l perlfaq
2) make my own index:
cd <directory from step #1>
grep ^= perlfaq[1-9].pod >faq.headlines
3) search the index
grep <something> faq.headlines
> Q2: How do I exit gracefully from a program?
^^^^
That is a SAQ (Self Answering Question):
perldoc -f exit
> Die is a crash close, but
> is there a 'clean' finish,
Did you read the documentation for the function you are using?
perldoc -f die
"See also exit(), warn(), and the Carp module."
> Q3: I start my scripts typically with 'perl -w myprog.pl'.
> How do I supply run time parameters to my program?
Just type them in at the end of the command line that you already have.
perl -w myprog.pl arg0 arg1 ...
> What puts them in
> @ARGV?
perl's start-up code does that for you before running the code
that you have given it.
> A possibly related question - why am I entreated to put the
> first line of my script as:
> #!c:\perl\perl.exe -w (I'm running under windoze)?
To enable warnings (the old way).
A more modern way is to put this near the top instead:
use warnings;
You can read all about it with:
perldoc warnings
> Q4: How do I declare global variables so that 'use strict;' is satisfied?
"Coping with Scoping":
http://perl.plover.com/FAQs/Namespaces.html
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 5 Jul 2004 15:11:06 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Newbie queries
Message-Id: <slrncejdeq.u9a.tadmc@magna.augustmail.com>
John Bokma <postmaster@castleamber.com> wrote:
> Jürgen Exner wrote:
>
>>>first line of my script as:
>>>#!c:\perl\perl.exe -w (I'm running under windoze)?
>>
>> Will simply be ignored by DOS but doesn't cause any harm either
>
> But needed if you are using Apache webserver
But nobody (other than you) said anything about the web.
In fact, the OP was asking about the command line, implying that
there is no CGI involved here...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 05 Jul 2004 15:48:58 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Newbie queries
Message-Id: <40e9bebb$0$202$58c7af7e@news.kabelfoon.nl>
Tad McClellan wrote:
> John Bokma <postmaster@castleamber.com> wrote:
>
>>Jürgen Exner wrote:
>>
>>>>first line of my script as:
>>>>#!c:\perl\perl.exe -w (I'm running under windoze)?
>>>
>>>Will simply be ignored by DOS but doesn't cause any harm either
>>
>>But needed if you are using Apache webserver
>
> But nobody (other than you) said anything about the web.
I added it as a reminder, one day that command line tool will be turned
into a neat CGI thingy ;-)
> In fact, the OP was asking about the command line, implying that
> there is no CGI involved here...
I am not here for the OP alone. I stumbled into this quite recently, I
thought that even Apache would use the binding between perl.exe and the
.pl extension. Not so.
Also the "ignored" statement was incorrect, but someone else explained that.
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Mon, 05 Jul 2004 15:51:05 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Newbie queries
Message-Id: <40e9bf3e$0$202$58c7af7e@news.kabelfoon.nl>
Tad McClellan wrote:
> John Bokma <postmaster@castleamber.com> wrote:
>
>>Jürgen Exner wrote:
>>
>>
>>>>first line of my script as:
>>>>#!c:\perl\perl.exe -w (I'm running under windoze)?
>>>
>>>Will simply be ignored by DOS but doesn't cause any harm either
>>
>>But needed if you are using Apache webserver
>
>
>
> But nobody (other than you) said anything about the web.
>
> In fact, the OP was asking about the command line, implying that
> there is no CGI involved here...
"Q3: I start my scripts *typically* with 'perl -w myprog.pl'.
How do I supply run time parameters to my program? What puts them in
@ARGV? A possibly *related* question - why am I entreated to put
the first line of my script as:
#!c:\perl\perl.exe -w (I'm running under *windoze*)?
"
So, when you run it under *windoze*, using Apache, you need the she-bang.
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Mon, 5 Jul 2004 20:28:04 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Newbie queries
Message-Id: <immGc.12047$JG5.404257@news20.bellglobal.com>
"John Bokma" <postmaster@castleamber.com> wrote in message
news:40e9bebb$0$202$58c7af7e@news.kabelfoon.nl...
> Tad McClellan wrote:
>
> > John Bokma <postmaster@castleamber.com> wrote:
> >
> >>Jürgen Exner wrote:
> >>
> >>>>first line of my script as:
> >>>>#!c:\perl\perl.exe -w (I'm running under windoze)?
> >>>
> >>>Will simply be ignored by DOS but doesn't cause any harm either
> >>
> >>But needed if you are using Apache webserver
> >
> > But nobody (other than you) said anything about the web.
>
> I added it as a reminder, one day that command line tool will be turned
> into a neat CGI thingy ;-)
>
> > In fact, the OP was asking about the command line, implying that
> > there is no CGI involved here...
>
> I am not here for the OP alone. I stumbled into this quite recently, I
> thought that even Apache would use the binding between perl.exe and the
> .pl extension. Not so.
>
So change the default:
http://httpd.apache.org/docs-2.0/mod/core.html#scriptinterpretersource
Matt
------------------------------
Date: Mon, 05 Jul 2004 19:47:24 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Newbie queries
Message-Id: <40e9f69d$0$863$58c7af7e@news.kabelfoon.nl>
Matt Garrish wrote:
> "John Bokma" <postmaster@castleamber.com> wrote in message
> news:40e9bebb$0$202$58c7af7e@news.kabelfoon.nl...
>
>>Tad McClellan wrote:
>>
>>>John Bokma <postmaster@castleamber.com> wrote:
>>>
>>>
>>>>Jürgen Exner wrote:
>>>>
>>>>
>>>>>>first line of my script as:
>>>>>>#!c:\perl\perl.exe -w (I'm running under windoze)?
>>>>>
>>>>>Will simply be ignored by DOS but doesn't cause any harm either
>>>>
>>>>But needed if you are using Apache webserver
>>>
>>>But nobody (other than you) said anything about the web.
>>
>>I added it as a reminder, one day that command line tool will be turned
>>into a neat CGI thingy ;-)
>>
>>>In fact, the OP was asking about the command line, implying that
>>>there is no CGI involved here...
>>
>>I am not here for the OP alone. I stumbled into this quite recently, I
>>thought that even Apache would use the binding between perl.exe and the
>>.pl extension. Not so.
>
> So change the default:
>
> http://httpd.apache.org/docs-2.0/mod/core.html#scriptinterpretersource
Thanks, although the security warning sounds like fun :-(
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: 05 Jul 2004 16:56:57 -0500
From: Dale Henderson <nilram@hotpop.com>
Subject: Re: Newbie: How to I extract word
Message-Id: <87k6xiglsm.fsf@camel.tamu-commerce.edu>
>>>>> "JS" == Joe Smith <Joe.Smith@inwap.com> writes:
JS> Dale Henderson wrote:
>> An equivalent way to do this is: (my $project = $string) =~
>> s/.*Project:([^,]+),.*/$1/; However, this makes $project
>> pointless since the replacement modifies $string to be the $1
>> and then $project is assigned the value of $string.
JS> No, it does not.
JS> It copies the value of $string to the variable $project first,
JS> and then performs the substitution on $project, leaving
JS> $string untouched.
Guess I should I have tested that too.
Thanks for the correction.
--
Dale Henderson
"Imaginary universes are so much more beautiful than this stupidly-
constructed 'real' one..." -- G. H. Hardy
------------------------------
Date: 5 Jul 2004 18:58:41 -0700
From: corey-nospam@test-tools.net (Corey_G)
Subject: pipes from forked processes
Message-Id: <7ef3e932.0407051758.49727747@posting.google.com>
I have some code that forks processes which then go off and do some
work. I am trying to make it so child processes can communicate back
to the parent that spawned them. From what I have read, it looks like
I want to use Pipes.
I also want to make sure this is portable to Windows. In the perlfork
documentation, it states: "The open(FOO, "|-") and open(BAR, "-|")
constructs are not yet implemented. This limitation can be easily
worked around in new code by creating a pipe explicitly." which then
goes on to give some sample code that doesn't work.. great.
So I am now looking at using either IO::Pipe or POE:Pipe to do this
for me. Documentation for both is pretty sparse and the samples
aren't enough to get me going.
Does anyone have a sample piece of code using either of these modules
along with forking?
-Corey Goldberg
------------------------------
Date: Tue, 06 Jul 2004 03:04:35 GMT
From: Rocco Caputo <troc@pobox.com>
Subject: Re: pipes from forked processes
Message-Id: <slrncek5rv.hdf.troc@eyrie.homenet>
On 5 Jul 2004 18:58:41 -0700, Corey_G wrote:
>
> So I am now looking at using either IO::Pipe or POE:Pipe to do this
> for me. Documentation for both is pretty sparse and the samples
> aren't enough to get me going.
If you're using POE, you may want to look at POE::Wheel::Run. Also
IPC::Run if you're not. Both modules implement the pipe/fork/exec
pattern, although the POE one does for spawning processes from within
that framework.
--
Rocco Caputo - http://poe.perl.org/
------------------------------
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 6769
***************************************