[16766] in Perl-Users-Digest
Perl-Users Digest, Issue: 4178 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 30 14:10:42 2000
Date: Wed, 30 Aug 2000 11:10:20 -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: <967659019-v9-i4178@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 30 Aug 2000 Volume: 9 Number: 4178
Today's topics:
Re: method="get" (brian d foy)
Re: method="get" (brian d foy)
Re: Parsing a Excell table - or - a "Tab New_Line" text <bart.lateur@skynet.be>
Partner Required. Perl Programmer <Rob@barbados.cc>
Re: Partner Required. Perl Programmer <uri@sysarch.com>
Re: Partner Required. Perl Programmer <uri@sysarch.com>
pattern matching question <bruno.pagis@usa.alcatel.com>
Re: pattern matching question <lr@hpl.hp.com>
Re:Partner Required. Perl Programmer <Rob@barbados.cc>
Starting another CGI fram a running CGI <mail@MAPLe-Soft.de>
Re: Starting another CGI fram a running CGI (Rafael Garcia-Suarez)
Re: Starting another CGI fram a running CGI <mail@MAPLe-Soft.de>
Re: Starting another CGI fram a running CGI <mail@MAPLe-Soft.de>
Re: Starting another CGI fram a running CGI <tdb198@ecs.soton.ac.uk>
Re: Starting another CGI fram a running CGI (Rafael Garcia-Suarez)
Re: Starting another CGI fram a running CGI mj.stevenson@auckland.ac.nz
Re: Starting another CGI fram a running CGI <mail@MAPLe-Soft.de>
Re: Starting another CGI fram a running CGI <mail@MAPLe-Soft.de>
Re: Starting another CGI fram a running CGI <mail@MAPLe-Soft.de>
Re: TMTOWTDI - but how best to do this ?? reg_exp@my-deja.com
Re: TMTOWTDI - but how best to do this ?? (Anno Siegel)
Re: TMTOWTDI - but how best to do this ?? <bart.lateur@skynet.be>
Re: Trouble setting arrays and hashes in namespace $thi <superior@island.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 30 Aug 2000 11:50:37 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: method="get"
Message-Id: <brian-ya02408000R3008001150370001@news.panix.com>
In article <39AC8A56.9F4F2022@shentel.net>, Albert Dewey <timewarp@shentel.net> posted:
> I have to agree with Bart in that CGI.pm is way more than I need. I too use
> templates for my html and forms. Much easier for me to deal with as I am
> totally fluent with html and my pages are always tables nested in tables
> within tables and the only way you can get the look I use is with straight
> html written in notepad.
maybe that's the only way *you* can get it, but that doesn't mean
that a program can't produce the same output.
futhermore, i contend that notepad is likewise not special.
> For my menus, data, and content I use place markers
> (typically $Content for the main content, etc...) and use Perl to stuff my
> templates with whatever is needed at the time. The part of CGI.pm I do take
> full advantage of is in the parsing of the uploaded data from my forms.
if you don't like all of the CGI.pm cruft, there are lighter CGI
parsers available from CPAN.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Wed, 30 Aug 2000 11:53:43 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: method="get"
Message-Id: <brian-ya02408000R3008001153430001@news.panix.com>
In article <Pine.GHP.4.21.0008301128550.12815-100000@hpplus03.cern.ch>, "Alan J. Flavell" <flavell@mail.cern.ch> posted:
> On Wed, 30 Aug 2000, Bart Lateur wrote:
>
> > But I do think that CGI.pm is overkill.
>
> It's a point of view, but some of the alternatives turn out to be
> worse. Don't overlook CGI.pm's use of autoloading.
self-loading, that is. all of that data is still in the module
rather than in separate files for each function. although that bloat
is almost insignificant to an apache process size, it's not needed
since there are lightweight parsers without the extra baggage. i
prefer CGI::Request for CGI things (which i hardly do anymore) or
just the builtin mod_perl features. :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Wed, 30 Aug 2000 16:57:50 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Parsing a Excell table - or - a "Tab New_Line" text file?
Message-Id: <g1fqqs45t6vpmloj5dc8lo9bdr4blt3pa4@4ax.com>
Etienne Laverdiere wrote:
>But I have notice that my parsing cannot read a field containing more than
>255 characters.
>I have a "description" field that usualy contain more than 255 characters.
>Where could I set the "retreiving field type"?
Cells in older Excel versions could not contain more than 255
characters. I've noticed in Excel 97, that if a cell contains more text,
that it starts acting weird. The visual representation on screen of the
cell becomes a long string of "#####" characters, and you can edit the
text only in the text box above the grid. And if you copy the grid and
paste as text, that cell will look like "####" in the pasted text, too.
In short: it's just a patch, and not a very succesful one. I wouldn't
expect that there even is a solution for your problem.
--
Bart.
------------------------------
Date: Wed, 30 Aug 2000 16:09:03 GMT
From: Rob <Rob@barbados.cc>
Subject: Partner Required. Perl Programmer
Message-Id: <39AD3155.148AD1EE@barbados.cc>
From: cgi.resourceindex.com
Description:
Partner needed to continue and complete
a DB based site with
large potential. Project is half done
and previous Partner has
too much work from his other business to
complete this one.
Arrangement is "sweat equity" 50%
ownership for your programming
input. All other expenses, and work
covered by other Partner.
Requirements:
Here are a few things we were working
with: Apache with mod_perl
An SQL database the latest perl DBI
module the latest perl DBD
module to match the SQL database the
latest perl CGI module Perl
5.005_02 or newer.
Contact
Rob Gouriluk
Rob@Barbados.cc
------------------------------
Date: Wed, 30 Aug 2000 16:39:26 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Partner Required. Perl Programmer
Message-Id: <x7wvgyr9dt.fsf@home.sysarch.com>
>>>>> "R" == Rob <Rob@barbados.cc> writes:
R> From: cgi.resourceindex.com
R> Description:
R> Partner needed to continue and complete
why would anyone
R> a DB based site with
work for someone
R> large potential. Project is half done
who can't be bothered
R> and previous Partner has
to wrap his post correctly
R> too much work from his other business to
R> complete this one.
R> Arrangement is "sweat equity" 50%
and who offers sweat equity in
something which is
R> ownership for your programming
R> input. All other expenses, and work
not described in any way
R> covered by other Partner.
shape or form.
R> Requirements:
R> Here are a few things we were working
owning 50% of vaporware
R> with: Apache with mod_perl
is still nothing.
R> An SQL database the latest perl DBI
i will now wait
R> module the latest perl DBD
for the dhabot to kick in (hi dha!)
R> module to match the SQL database the
R> latest perl CGI module Perl
R> 5.005_02 or newer.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 30 Aug 2000 16:53:40 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Partner Required. Perl Programmer
Message-Id: <x7og2ar8q3.fsf@home.sysarch.com>
>>>>> "R" == Rob <Rob@barbados.cc> writes:
R> More readable:
still off topic. post in a jobs group or to the perl jobs list (linked
from pm.org)
R> Partner needed to continue and complete a DB based site with large
R> potential. Project is half done and previous Partner has too much
R> work from his other business to complete this one.
so he bailed? doesn't sound promising.
R> Arrangement is "sweat equity" 50% ownership for your programming
R> input. All other expenses, and work covered by other Partner.
english please. my hourly rate is an expense to you. ownership of what?
another stupid web site? i can own thousands of those. wanna buy one?
R> A relaxed easy going attitude.
for sweat equity you should have that. and a fat savings account.
R> also here are a few things we were working with:
people who won't pay you for your work.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 30 Aug 2000 16:21:16 GMT
From: Bruno Pagis <bruno.pagis@usa.alcatel.com>
Subject: pattern matching question
Message-Id: <20000830.16211646@FA918059.aur.alcatel.com>
--------------=_4D4800BA555006AA2284
Content-Description: filename="text1.txt"
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi,
I'd like to extract anything between </td> and <a href in a string. I=20=
simply don't know how to say "take anything until you find <a href" when=
I=20
describe the pattern:
$text =3D~ s#</td>(.*)<a href#$1# # doesn't work because .* will match=
=20
anything
$text =3D~ s#</td>(.*(?=3D<a href))<a href#$1# # will not work either :=
-(
I have a way to say [^<] to exclude a character, but what I miss is a wa=
y=20
to exclude a string, something like [^(<a href)]. See what I mean ?
Or maybe I cannot do it this way. But then, how?
Your help welcome. Thanks. BRUNO.
--------------=_4D4800BA555006AA2284
Content-Description: filename="text1.html"
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"CONTENT-TYPE" CONTENT=3D"text/html; charset=3Diso-8=
859-1">
<TITLE>pattern matching question</TITLE>
<META NAME=3D"GENERATOR" CONTENT=3D"StarOffice/5.2 (Win32)">
<META NAME=3D"CREATED" CONTENT=3D"20000830;12085832">
<META NAME=3D"CHANGEDBY" CONTENT=3D"Bruno Pagis">
<META NAME=3D"CHANGED" CONTENT=3D"20000830;12211547">
</HEAD>
<BODY>
<P>Hi,</P>
<P>I'd like to extract anything between </td> and <a href in a=
string. I simply don't know how to say "take anything until you
find <a href" when I describe the pattern:</P>
<P>$text =3D~ s#</td>(.*)<a href#$1# # doesn't work because .=
*
will match anything</P>
<P>$text =3D~ s#</td>(.*(?=3D<a href))<a href#$1# # will no=
t
work either :-(</P>
<P><BR><BR>
</P>
<P>I have a way to say [^<] to exclude a character, but what I miss
is a way to exclude a string, something like [^(<a href)]. See what
I mean ?</P>
<P>Or maybe I cannot do it this way. But then, how?</P>
<P>Your help welcome. Thanks. BRUNO.</P>
</BODY>
</HTML>
--------------=_4D4800BA555006AA2284--
------------------------------
Date: Wed, 30 Aug 2000 10:10:11 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: pattern matching question
Message-Id: <MPG.1416dfcf22fc74098acfe@nntp.hpl.hp.com>
In article <20000830.16211646@FA918059.aur.alcatel.com> on Wed, 30 Aug
2000 16:21:16 GMT, Bruno Pagis <bruno.pagis@usa.alcatel.com> says...
> --------------=_4D4800BA555006AA2284
> Content-Description: filename="text1.txt"
> Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable
Please post your question again using plain text, and someone is likely
to answer it.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 30 Aug 2000 16:32:50 GMT
From: Rob <Rob@barbados.cc>
Subject: Re:Partner Required. Perl Programmer
Message-Id: <39AD36E7.779FE93A@barbados.cc>
More readable:
From: cgi.resourceindex.com
Description:
Partner needed to continue and complete a DB based site with large
potential. Project is half done and previous Partner has too much work from
his other business to complete this one.
Arrangement is "sweat equity" 50% ownership for your programming input. All
other expenses, and work covered by other Partner.
Requirements:
A relaxed easy going attitude.
also here are a few things we were working with:
Apache with mod_perl
An SQL database the latest perl DBI
module the latest perl DBD
module to match the SQL database the
latest perl CGI module Perl 5.005_02 or newer.
Contact
Rob Gouriluk
Rob@Barbados.cc
------------------------------
Date: Wed, 30 Aug 2000 17:16:35 +0200
From: "Martin Plücker" <mail@MAPLe-Soft.de>
Subject: Starting another CGI fram a running CGI
Message-Id: <8oj8ip$4km$11$1@news.t-online.com>
Hi!
I have a little prblem and I hope some of you can help me. So here it is:
Ich have two CGIs a and b. CGI a is called by a browser. Then a schould
start b, a CGI that takes very long to finish, with some parameters. a
should then run on normally, not caring about b in any way, and return
something to the refering browser.
The problem is that with system() CGI a waits for b to finish and return.
But b takes very long (about an hour) and the refering user should see some
message immediately.
Is there any way to solve this problem and to run b completely dissociated
from a? Example code?
Thaks
Martin
------------------------------
Date: Wed, 30 Aug 2000 15:39:06 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Starting another CGI fram a running CGI
Message-Id: <slrn8qqapo.9h2.rgarciasuarez@rafael.kazibao.net>
Martin Plücker wrote in comp.lang.perl.misc:
>Hi!
>
>I have a little prblem and I hope some of you can help me. So here it is:
>
>Ich have two CGIs a and b. CGI a is called by a browser. Then a schould
>start b, a CGI that takes very long to finish, with some parameters. a
>should then run on normally, not caring about b in any way, and return
>something to the refering browser.
As I understand, 'b' is not a CGI, it is a program (because it does not
seem to use the CGI interface).
>The problem is that with system() CGI a waits for b to finish and return.
>But b takes very long (about an hour) and the refering user should see some
>message immediately.
>
>Is there any way to solve this problem and to run b completely dissociated
>from a? Example code?
If you're on UNIX, use the functions fork and exec:
my $pid = fork;
die unless defined $pid;
$pid or exec('b') or die "Can't exec b\n";
If you're on Windows, I don't know... and the next time you have a
system-related question, tell us what OS you have.
--
Rafael Garcia-Suarez
------------------------------
Date: Wed, 30 Aug 2000 17:41:29 +0200
From: "Martin Plücker" <mail@MAPLe-Soft.de>
Subject: Re: Starting another CGI fram a running CGI
Message-Id: <8oja1g$55b$11$1@news.t-online.com>
You're right. I forgot the OS, sorry....
Its a Linux machine. And b is a Perl program.
Martin
Rafael Garcia-Suarez <rgarciasuarez@free.fr> schrieb in im Newsbeitrag:
slrn8qqapo.9h2.rgarciasuarez@rafael.kazibao.net...
> Martin Plücker wrote in comp.lang.perl.misc:
> >Hi!
> >
> >I have a little prblem and I hope some of you can help me. So here it is:
> >
> >Ich have two CGIs a and b. CGI a is called by a browser. Then a schould
> >start b, a CGI that takes very long to finish, with some parameters. a
> >should then run on normally, not caring about b in any way, and return
> >something to the refering browser.
>
> As I understand, 'b' is not a CGI, it is a program (because it does not
> seem to use the CGI interface).
>
> >The problem is that with system() CGI a waits for b to finish and return.
> >But b takes very long (about an hour) and the refering user should see
some
> >message immediately.
> >
> >Is there any way to solve this problem and to run b completely
dissociated
> >from a? Example code?
>
> If you're on UNIX, use the functions fork and exec:
>
> my $pid = fork;
> die unless defined $pid;
> $pid or exec('b') or die "Can't exec b\n";
>
> If you're on Windows, I don't know... and the next time you have a
> system-related question, tell us what OS you have.
>
> --
> Rafael Garcia-Suarez
------------------------------
Date: Wed, 30 Aug 2000 17:53:30 +0200
From: "Martin Plücker" <mail@MAPLe-Soft.de>
Subject: Re: Starting another CGI fram a running CGI
Message-Id: <8ojao1$5fm$11$1@news.t-online.com>
Hi!
I'm a newbie. And I don't kwon how to du that. My code is now:
print "Content-type: text/html\n\n";
print "hello";
my $pid = fork;
die unless defined $pid;
$pid or exec('perl b.pl') or print "Can't exec b\n";
It still waits for b to finish. 'hello' is returned after b has done its
work.
What is wrong with it?
Thanks
Martin
------------------------------
Date: Wed, 30 Aug 2000 17:02:14 +0100
From: Tim Brody <tdb198@ecs.soton.ac.uk>
Subject: Re: Starting another CGI fram a running CGI
Message-Id: <Pine.LNX.4.10.10008301659370.24281-100000@servalan.ecs.soton.ac.uk>
On Wed, 30 Aug 2000, Martin Pl=FCcker wrote:
> I have a little prblem and I hope some of you can help me. So here it is:
>=20
> Ich have two CGIs a and b. CGI a is called by a browser. Then a schould
> start b, a CGI that takes very long to finish, with some parameters. a
> should then run on normally, not caring about b in any way, and return
> something to the refering browser.
> The problem is that with system() CGI a waits for b to finish and return.
> But b takes very long (about an hour) and the refering user should see so=
me
> message immediately.
>=20
> Is there any way to solve this problem and to run b completely dissociate=
d
> from a? Example code?
Assuming your CGI script is running under Unix you can:
`b &`; or
system("b &");
Appended "&" causes that script to be put into "background mode", allowing
a to continue.
Tim.
------------------------------
Date: Wed, 30 Aug 2000 16:08:00 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Starting another CGI fram a running CGI
Message-Id: <slrn8qqcfu.9jk.rgarciasuarez@rafael.kazibao.net>
Martin Plücker wrote in comp.lang.perl.misc:
>Hi!
>
>I'm a newbie. And I don't kwon how to du that. My code is now:
>
>print "Content-type: text/html\n\n";
>print "hello";
>my $pid = fork;
>die unless defined $pid;
>$pid or exec('perl b.pl') or print "Can't exec b\n";
>
>It still waits for b to finish. 'hello' is returned after b has done its
>work.
>What is wrong with it?
My fault. Standard output is still open on the child. This version will work:
#!/usr/bin/perl
$|=1; # see 'man perlvar' for this
print "Content-type: text/plain\n\n";
print "hello";
my $pid = fork;
die unless defined $pid;
$pid or do { close STDOUT; exec('/usr/bin/perl /path/to/b.pl'); };
print "Finish";
The perlipc manpage can be useful, as the fork and exec entries in the
perlfunc manpage.
--
Rafael Garcia-Suarez
------------------------------
Date: Wed, 30 Aug 2000 16:37:32 GMT
From: mj.stevenson@auckland.ac.nz
Subject: Re: Starting another CGI fram a running CGI
Message-Id: <39ad38cd.1748031596@news.chello.nl>
On Wed, 30 Aug 2000 17:53:30 +0200, "Martin Plücker"
<mail@MAPLe-Soft.de> wrote:
>Hi!
>
>I'm a newbie. And I don't kwon how to du that. My code is now:
>
>print "Content-type: text/html\n\n";
>print "hello";
>my $pid = fork;
>die unless defined $pid;
>$pid or exec('perl b.pl') or print "Can't exec b\n";
You need to close STDOUT in the child.
------------------------------
Date: Wed, 30 Aug 2000 18:43:01 +0200
From: "Martin Plücker" <mail@MAPLe-Soft.de>
Subject: Re: Starting another CGI fram a running CGI
Message-Id: <8ojdks$6mu$11$1@news.t-online.com>
Unfortunately tha doesn't work. b is not executed. The paths to per and b
are correct.
Why doesn't tha function.
Martin
Rafael Garcia-Suarez <rgarciasuarez@free.fr> schrieb in im Newsbeitrag:
slrn8qqcfu.9jk.rgarciasuarez@rafael.kazibao.net...
> Martin Plücker wrote in comp.lang.perl.misc:
> >Hi!
> >
> >I'm a newbie. And I don't kwon how to du that. My code is now:
> >
> >print "Content-type: text/html\n\n";
> >print "hello";
> >my $pid = fork;
> >die unless defined $pid;
> >$pid or exec('perl b.pl') or print "Can't exec b\n";
> >
> >It still waits for b to finish. 'hello' is returned after b has done its
> >work.
> >What is wrong with it?
>
> My fault. Standard output is still open on the child. This version will
work:
>
> #!/usr/bin/perl
> $|=1; # see 'man perlvar' for this
> print "Content-type: text/plain\n\n";
> print "hello";
> my $pid = fork;
> die unless defined $pid;
> $pid or do { close STDOUT; exec('/usr/bin/perl /path/to/b.pl'); };
> print "Finish";
>
> The perlipc manpage can be useful, as the fork and exec entries in the
> perlfunc manpage.
>
> --
> Rafael Garcia-Suarez
------------------------------
Date: Wed, 30 Aug 2000 18:47:13 +0200
From: "Martin Plücker" <mail@MAPLe-Soft.de>
Subject: Re: Starting another CGI fram a running CGI
Message-Id: <8ojdso$6ru$11$1@news.t-online.com>
Oh yes!
Now it works verry well. Exactly what I needed!
Thank you very much. You were a great help.
Martin
Rafael Garcia-Suarez <rgarciasuarez@free.fr> schrieb in im Newsbeitrag:
slrn8qqcfu.9jk.rgarciasuarez@rafael.kazibao.net...
> Martin Plücker wrote in comp.lang.perl.misc:
> >Hi!
> >
> >I'm a newbie. And I don't kwon how to du that. My code is now:
> >
> >print "Content-type: text/html\n\n";
> >print "hello";
> >my $pid = fork;
> >die unless defined $pid;
> >$pid or exec('perl b.pl') or print "Can't exec b\n";
> >
> >It still waits for b to finish. 'hello' is returned after b has done its
> >work.
> >What is wrong with it?
>
> My fault. Standard output is still open on the child. This version will
work:
>
> #!/usr/bin/perl
> $|=1; # see 'man perlvar' for this
> print "Content-type: text/plain\n\n";
> print "hello";
> my $pid = fork;
> die unless defined $pid;
> $pid or do { close STDOUT; exec('/usr/bin/perl /path/to/b.pl'); };
> print "Finish";
>
> The perlipc manpage can be useful, as the fork and exec entries in the
> perlfunc manpage.
>
> --
> Rafael Garcia-Suarez
------------------------------
Date: Wed, 30 Aug 2000 18:48:26 +0200
From: "Martin Plücker" <mail@MAPLe-Soft.de>
Subject: Re: Starting another CGI fram a running CGI
Message-Id: <8ojdv1$6sp$11$1@news.t-online.com>
There is still one littel question left.
How can a give b some parameters with the exec function?
Thanx
Martin
Rafael Garcia-Suarez <rgarciasuarez@free.fr> schrieb in im Newsbeitrag:
slrn8qqcfu.9jk.rgarciasuarez@rafael.kazibao.net...
> Martin Plücker wrote in comp.lang.perl.misc:
> >Hi!
> >
> >I'm a newbie. And I don't kwon how to du that. My code is now:
> >
> >print "Content-type: text/html\n\n";
> >print "hello";
> >my $pid = fork;
> >die unless defined $pid;
> >$pid or exec('perl b.pl') or print "Can't exec b\n";
> >
> >It still waits for b to finish. 'hello' is returned after b has done its
> >work.
> >What is wrong with it?
>
> My fault. Standard output is still open on the child. This version will
work:
>
> #!/usr/bin/perl
> $|=1; # see 'man perlvar' for this
> print "Content-type: text/plain\n\n";
> print "hello";
> my $pid = fork;
> die unless defined $pid;
> $pid or do { close STDOUT; exec('/usr/bin/perl /path/to/b.pl'); };
> print "Finish";
>
> The perlipc manpage can be useful, as the fork and exec entries in the
> perlfunc manpage.
>
> --
> Rafael Garcia-Suarez
------------------------------
Date: Wed, 30 Aug 2000 15:44:41 GMT
From: reg_exp@my-deja.com
Subject: Re: TMTOWTDI - but how best to do this ??
Message-Id: <8oja52$jga$1@nnrp1.deja.com>
thanks for that Abe, however could you tell me what the => operator
does in this line:
$sum += $_ for map /(\d)/g => map { ($i++ % 2 + 1) * $_ } /(\d)/g;
i thought the => operator was used only for hashes.... i cant
understand it's usage here, is it documented in the faqs ??
thanks a lot,
-reg_exp
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 30 Aug 2000 16:01:14 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: TMTOWTDI - but how best to do this ??
Message-Id: <8ojb4a$j0t$1@lublin.zrz.tu-berlin.de>
<reg_exp@my-deja.com> wrote in comp.lang.perl.misc:
>thanks for that Abe, however could you tell me what the => operator
>does in this line:
>$sum += $_ for map /(\d)/g => map { ($i++ % 2 + 1) * $_ } /(\d)/g;
>
>i thought the => operator was used only for hashes.... i cant
>understand it's usage here, is it documented in the faqs ??
The FAQs may be honored by your assumption, but they are not the
place where language featured are documented. The details are
in perlop, where => is described as a synonym for the comma operator.
(There's more.) So sometimes => is also called the "fat comma".
Anno
------------------------------
Date: Wed, 30 Aug 2000 17:23:42 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: TMTOWTDI - but how best to do this ??
Message-Id: <gpfqqsg524jrdrk5qeupb0kj3sp6d493on@4ax.com>
reg_exp@my-deja.com wrote:
>for each digit of an eight digit number, multiply the digits
>alternately by 1 and 2 and sum each digit of the result. subtract the
>result from the next highest number divisible by 10 and make a 9 digit
>number with the original 8 digit number + the calculated digit.
This sounds somewhat like a checksum for credit card numbers and/or
barcodes.
$string = '049977473';
my $mult = 1;
my $total = 0;
for my $i (0 .. 7) {
my $add = $mult * substr($string, $i, 1);
$total += ($add % 9) || ($add && 9); # add all digits
} continue {
$mult ^= 3; # swap 1 and 2
}
$string .= (10 - $total % 10);
--
Bart.
------------------------------
Date: Wed, 30 Aug 2000 09:41:12 -0700
From: "Matthew Fox" <superior@island.net>
Subject: Re: Trouble setting arrays and hashes in namespace $this_namespace
Message-Id: <8ojdlm02kr@enews4.newsguy.com>
----- Original Message -----
From: <nobull@mail.com>
Newsgroups: comp.lang.perl.misc
Sent: Wednesday, August 30, 2000 12:44 AM
Subject: Re: Trouble setting arrays and hashes in namespace $this_namespace
> "Matthew Fox" <superior@island.net> writes:
>
> > Subject: Trouble setting arrays and hashes in namespace $this_namespace
>
> Nothing to do with arrays or hashes in your post. Please use the
> subject line to describe the content of the post.
>
> > $namespace = "NAME";
> > ${"${namespace}::db"} = "foo";
> >
> > I had hoped this would make $NAME::db contain "foo".
>
> It does.
>
> > However, $NAME::db just ends up undefined.
>
> I am unable to reproduce this.
>
> > Does anyone have any ideas?
>
> Always post a short but complete, strict[1], warning-free script that
> when you run it actually produces the symptoms you describe. I'm
> guessing that your actual code is more complex and contain BEGIN
> blocks and suchlike that cause statements to be executed in a
> different order from the one you are expecting.
Sorry, I did not give a relevant example. I did want to assign the value
(which was actually an array reference) to an array. I was also trying to
set a hash in the same way. For example,
$namespace = "NAME";
$i = 0;
while ($glued_line = <FH>) { # GO THROUGH EACH LINE IN THE DATABASE
# $glued_line is one line out of a file and is in the format x)(x)(x\n
chomp($glued_line); # GET RID OF NEWLINE AT END
@record_fields = split(/\)\(/,$glued_line);
${"${namespace}::id_by_names{$record_fields[1]}"} = $record_fields[0];
${"${namespace}::db[$i]"} = [ @record_fields ];
++$i; # AUTOINCREMENT $i
} # END OF FILEHANDLE LOOP
I was hoping that %NAME::id_by_names would be defined and that @NAME::db
would be a multidimensional array.
> [1] Obviously since this is a question about symbolic refs you'd need
> to have a "no strict 'refs'" in there.
>
Yes, I have that.
Sorry for completely disobeying USENET protocol. I'm new to newsgroups.
> > Also,
>
> This is an unrelated question. Please do not put two or more
> unrelated questions in the same post. Post each separately with a
> relevant subject line in each case.
>
> > can I just substitute a variable for a file handle? For example,
> >
> > open($var,"foo.txt");
>
> Yes.
>
> > Or do I have to do something fancier than just the variable name?
>
> The variable must contain a reference to a filehandle (or a typeglob).
>
> $var = IO::Handle->new();
>
> In 5.6 I seem to recall you can omit this bit as open() autovivifies
> $var into an IO handle.
>
> > Does it have something to do with typeglobs?
>
> That's an alternative, somewhat old-fashioned way.
>
> See: perldoc perldata/"Typeglobs and Filehandles"
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 4178
**************************************