[7218] in Perl-Users-Digest
Perl-Users Digest, Issue: 843 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 11 10:17:39 1997
Date: Mon, 11 Aug 97 07:00:40 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 11 Aug 1997 Volume: 8 Number: 843
Today's topics:
adressing arrays denis@mathi.uni-heidelberg.de
Best way to connect to PostgreSQL 6.1.1 <abagi@coral.idk.com.pl>
Bidirectional Communication, Comm.pl (J%org Knappen)
Creating a user <cmcadam@icl.co.za>
Re: DBM Equivalent for NT (Danny Aldham)
etrn.pl from sendmail distribution <debelts@itz-koeln.de>
Finding Files under Windows <shieling@dircon.co.uk>
FTP <cmcadam@icl.co.za>
Re: help programing needed ( Thomas Lachlan XMS x4206 )
Help with 'if'. <page@pageg.demon.co.uk>
Re: Help with 'if'. makler@man.torun.pl
Re: How do you determine program runtime? (Danny Aldham)
Re: How do you determine program runtime? (Jim Trocki)
Re: How to make Perl Regular expressions "Rightmost is (Dean Inada)
Re: How to secure data? (Danny Aldham)
Re: How to secure data? <sanford@halcyon.com>
Re: info from dead child-process in SIGN{'CHLD'} (robert)
Re: Learn the SECRET to Attract Women Easily (Koos Pol)
Re: lib/io_sock.t test failure (Neil Briscoe)
Need documentation on (TOP) formats <martt@elsevier.nl>
Numbers to strings with preceeding 000's (Brian Lavender)
Re: Numbers to strings with preceeding 000's (Daniel E. Macks)
Perl 5.004_01 on AIX 4.2.1 <courcoul@campus.qro.itesm.mx>
Re: perl for win32, Win32::ODBC, and IIS on NT 4.0 (Danny Aldham)
Re: perl in NT (Danny Aldham)
Re: Problem with Open3 (Marek Rouchal HL CAD SYS Tel. 25849)
Re: Q: Recompiling Modules during execution <bholzman@mail.earthlink.net>
Re: Sorting this file is killing me (Thomas Wernitz)
using system() during html page, IIS 3 <ronen_lazar@ccm.jer.intel.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 11 Aug 1997 09:52:48 +0200
From: denis@mathi.uni-heidelberg.de
Subject: adressing arrays
Message-Id: <33EEC4D0.41C6@mathi.uni-heidelberg.de>
hallo,
i tried to adress the elementes of adresse.
adressing them with $xxx[13] for example works, but if i use a variable
it doesnot work any more...
does anyone knom the answer?
bye
denis
------------------------------
Date: 11 Aug 1997 12:14:59 GMT
From: Andrzej =?US-ASCII?Q?Bagi=F1ski?= <abagi@coral.idk.com.pl>
Subject: Best way to connect to PostgreSQL 6.1.1
Message-Id: <5smvo3$c5g$1@korweta.task.gda.pl>
What is the best way to work with PostgreSQL database using Perl?
I want to use it to build Internet shop, so I need somehow
add/modify/delete data to/in database. All of it will be based on Perl
scripts that will get the data from html pages as well as get data from
database and present it in html.
It would be great to find that someone is using PostgreSQL+Perl to do
something very similar to what I'm going to do.
Andrzej
--
_ _| __ \ | / | Andrzej Bagiqski | e-mail: abagi@idk.com.pl
| | | ' / | -----------------------------|-------------------------
| | | . \ |
___|____/ _|\_\ |
------------------------------
Date: 11 Aug 1997 09:35:52 GMT
From: knappen@iphcip1.Physik.Uni-Mainz.DE (J%org Knappen)
Subject: Bidirectional Communication, Comm.pl
Message-Id: <5smmdo$d2i$1@esmeralda.zdv.Uni-Mainz.DE>
Keywords: Comm.pl, Bidirectional Communication
In an application I have to do bidirectional communication to a shell
programm. Unfortunately I cannot apply the usual trick
`echo $arguments > command|`
since the arguments must not be visible by the ps command (they contain
unencrypted passwords).
So I tried the Comm.pl module as described on page 345 of the blue camel book.
However, on the Stuttgart CPAN mirror I found Comm.pl_1.5beta of 1995; and
this does not work as the example given in the book. Is there a newer version
of Comm.pl available which works as described in the book?
--J"org Knappen
------------------------------
Date: Mon, 11 Aug 1997 12:59:02 +0200
From: Clive McAdam <cmcadam@icl.co.za>
Subject: Creating a user
Message-Id: <33EEF076.278C6907@icl.co.za>
I want to be able to add a user (with his home directory) to the Solaris
OS running on a SUN box, using Perl 5 as the backend and a standard web
interface on the client end.
Can anyone help me with some code on how to do this?
Thanx in advance
Clive McAdam
cmcadam@icl.co.za
------------------------------
Date: 10 Aug 1997 21:08:57 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: DBM Equivalent for NT
Message-Id: <5sm38p$3qj$1@lennon.postino.com>
In article <19970808182701.OAA20457@ladder02.news.aol.com>, cowbys@aol.com
(COWBYS) wrote:
# Does anyone know of an equivalent of DBM for NT ?
# OR
# besides associative arrays, a way of using NT Perl (Perl for Win32) to
# search a file consisting of fixed length records and pulling out certain
# records, sort of like an associative array but there are multiple fields
# in each record, not just a key and a value...
#
# any help appreciated. please reply to dave_fortenberry@attcapital.com
Perl5.004_01 builds with gnuwin32 from cygnus with SDBM included. I have
some scripts that use AnyDBM_File and they seem to work fine on NT4.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail.
------------------------------
Date: Mon, 11 Aug 1997 10:45:52 +0200
From: Holger Debelts <debelts@itz-koeln.de>
Subject: etrn.pl from sendmail distribution
Message-Id: <33EED13F.4032552B@itz-koeln.de>
Dear Perlers,
I want to use etrn.pl from the sendmail distribution to get my mail from
a mailhost running sendmail 8.8.5. I use a pc with Sun Solaris 2.5.1 and
Perl 5.003.
Starting the script with etrn.pl mailhost i get Broken Pipe.
Debugging the script i found, that connect(S, $that) makes the broken
pipe.
bind(S, $this)
|| die "bind $hostname,0: $!";
$0 = "$av0 - connect to $server";
print "debug = $debug server = $server\n" if $debug > 8;
if (! connect(S, $that)) {
^^^^^^^^^^^^^^^^^^^^
$0 = "$av0 - $server: could not connect: $!\n";
}
Whats wrong now? Is there a bug in my Solaris or is there a bug in Perl?
------------------------------
Date: Mon, 11 Aug 1997 11:32:41 +0100
From: "Reuters Ltd." <shieling@dircon.co.uk>
Subject: Finding Files under Windows
Message-Id: <33EEEA49.1051@dircon.co.uk>
Is there a way of using perl to search through directories to find file
paths with Windows NT4?
Thanks in advance
------------------------------
Date: Mon, 11 Aug 1997 13:01:31 +0200
From: Clive McAdam <cmcadam@icl.co.za>
Subject: FTP
Message-Id: <33EEF10A.1124C060@icl.co.za>
How can I let users FTP files into their home directories using Perl and
a web interface?
------------------------------
Date: 11 Aug 1997 08:27:47 GMT
From: etltsln@etlxd30.ericsson.se ( Thomas Lachlan XMS x4206 )
Subject: Re: help programing needed
Message-Id: <5smie3$69p@newstoo.ericsson.se>
Marcine Uhler (mrt1@webtv.net) wrote:
: i am an attorney and autioneer i am seeking a partime programmer to
: asist me in the programming and the redesign of auction web sites and
: realted projects i have no experience in programming but understand how
: to sell thanks mrt1@webtv.net
: Marc R. Tow
: (714) 975-0544 office
: (714) 975-0547 office fax
Well for someone so accomplished at selling I'm surprised I don't
find your propostion attractive.
------------------------------
Date: Mon, 11 Aug 1997 13:24:43 +0100
From: Page <page@pageg.demon.co.uk>
Subject: Help with 'if'.
Message-Id: <33EF048A.456F93E4@pageg.demon.co.uk>
Hi all,
I am a complete Perl novice, and I am attempting to create a script to
perform some simple operations on data from a www form amd then mail it
to me. My problem is that I am trying to insert an "if" statement into
my script so that if fields are empty they are not displayed in the
emails. The code I am trying to use is below:
> print "Email: $FORM{'Email'}\n";
>
> if ($FORM{'SubjectEnquiry'} eq "") {
> goto A;
> exit;
> }
> print "Specific Subject of Enquiry: $FORM{'SubjectEnquiry'}\n";
> A
>
> print "Detail of Enquiry: $FORM{'DetailEnquiry'}\n";
>
(I have included the lines either side of the statement), but when I
run the script through a debugger it gives the following error:
> syntax error in file /cgi-bin/pageg/xx-test.pl at line 29, next token "print "
> Execution of /cgi-bin/pageg/xx-test.pl aborted due to compilation errors.
>
Can anyone tell me what I'm doing wrong please.
Thanks
Paul Scott
page@page-group.co.uk
------------------------------
Date: 11 Aug 1997 13:05:00 GMT
From: makler@man.torun.pl
Subject: Re: Help with 'if'.
Message-Id: <11Aug1997.130500.6890.NWWW@flis.man.torun.pl>
Page <page@pageg.demon.co.uk> writes:
>Hi all,
>I am a complete Perl novice, and I am attempting to create a script to
>perform some simple operations on data from a www form amd then mail it
>to me. My problem is that I am trying to insert an "if" statement into
>my script so that if fields are empty they are not displayed in the
>emails. The code I am trying to use is below:
>
>> print "Email: $FORM{'Email'}\n";
>>
>> if ($FORM{'SubjectEnquiry'} eq "") {
>> goto A;
>> exit;
>> }
>> print "Specific Subject of Enquiry: $FORM{'SubjectEnquiry'}\n";
>> A
>>
>> print "Detail of Enquiry: $FORM{'DetailEnquiry'}\n";
>>
> (I have included the lines either side of the statement), but when I
>run the script through a debugger it gives the following error:
>
>> syntax error in file /cgi-bin/pageg/xx-test.pl at line 29, next token "print "
>> Execution of /cgi-bin/pageg/xx-test.pl aborted due to compilation errors.
There is A but there is not ':' (colon sign) after A.
This should be
A:
P.K.
--
makler@man.torun.pl
------------------------------
Date: 10 Aug 1997 21:30:46 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: How do you determine program runtime?
Message-Id: <5sm4hm$44g$1@lennon.postino.com>
Scott Card (ils@pipcom.com) wrote:
: How can i determine the running time of a program?
: I have a cron cgi program and need to know exactly how many
: milliseconds it runs until it terminates.
You might want to look at the benchmark module, which I believe
comes with the standard distribution.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail.
------------------------------
Date: 11 Aug 1997 06:48:50 GMT
From: trockij@transmeta.com (Jim Trocki)
Subject: Re: How do you determine program runtime?
Message-Id: <5smcki$6iv$1@palladium.transmeta.com>
In article <33ee7756.10233296@news.pipcom.com>,
Scott Card <ils@pipcom.com> wrote:
>How can i determine the running time of a program?
>
>I have a cron cgi program and need to know exactly how many
>milliseconds it runs until it terminates.
There's also the gettimeofday(2) system call that has very high resolution
timing:
require "syscall.ph";
$timeval = pack ("ll", 0, 0);
$tzone = pack ("ll", 0, 0);
syscall &SYS_gettimeofday, $timeval, $tzone;
($sec, $usec) = unpack ("ll", $timeval);
print $sec, " ", $usec, "\n";
--
Jim Trocki
Computer System and Network Engineer
Transmeta Corporation
Santa Clara, CA trockij@transmeta.com
------------------------------
Date: 11 Aug 1997 08:35:30 GMT
From: dmi@delta1.deltanet.com (Dean Inada)
Subject: Re: How to make Perl Regular expressions "Rightmost is greediest"?
Message-Id: <5smisi$ncn$1@news01.deltanet.com>
In article <33EB5CC2.6E2622D@absyss.fr>, Doug Seay <seay@absyss.fr> wrote:
>
>My solution was to reverse the string, build the search pattern
>backwards and see if that matches. If so, reverse each of the matched
Reversing the string seems easy enough.
Reversing the search pattern seems non-trivial.
Ignoreing the problem of dealing with (?x), (?=), @{[]}, \1, \G, etc.,
I've gotten as far as:
sub revex{
local($_) = @_;
my $re;
my @a;
my @o;
($re = $_) =~ s{(
(\()
|
(\))
|
(
\\.
|
\[^?\\?.(-?(\\.|[^]]))*\]
|
[^()\\[]*
)
)}
($2\Q$1\E$3)sgx;
$re = '\B\b' if( $re eq quotemeta($_) );
$re = join '|',(map quotemeta($_),/$re/g),
qw(\\\\. \[^?\\\\?.(?:-?(?:\\\\.|[^]]))*\] [$@]\w+);
join '|',
map {
join '',
reverse
map {s/^\((\?\w*[^)])?(.*)\)/"($1".revex($2).')'/seg&&'',$_}
/((?:$re|.)(?:[*+?]|{[\d,]+})?\??)/gs
} /((?:$re|[^|])+)/g;
}
Can anyone take it from here?
------------------------------
Date: 10 Aug 1997 20:56:41 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: How to secure data?
Message-Id: <5sm2hp$3kv$1@lennon.postino.com>
Scott Card (ils@pipcom.com) wrote:
: After data on a form has been submitted what's the best way
: to lock the data away securly? The script is being executed by
: NOBODY so any permission changes can be undone by NOBODY.
chmod the file to 600, then chown to you . Of course, this is
a one-way function, NOBODY cannot access it again.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail.
------------------------------
Date: 10 Aug 1997 23:34:12 -0700
From: Sanford Morton <sanford@halcyon.com>
Subject: Re: How to secure data?
Message-Id: <m320416xej.fsf@halcyon.com>
ils@pipcom.com (Scott Card) writes:
>
> On Sat, 9 Aug 1997 13:27:53 -0700, Tom Phoenix <rootbeer@teleport.com>
> wrote:
>
> >On Sat, 9 Aug 1997, Scott Card wrote:
> >
> >> After data on a form has been submitted what's the best way
> >> to lock the data away securly?
> >
> >You're closing the barn door after the horse has escaped if the data were
> >sent insecurely over the web. But you may want one of the PGP interface
> >modules or something similar from CPAN. Hope this helps!
> >
> >
> It doesn't matter if the data is secure during transmission. What i
> wish to do is after the user presses the Submit button save the data
> in a file that cannot be changed by the user (NOBODY) or any other
> user except me.
>
If you're on a public server, PGP or other encryption can help to
prevent read access to server written files, but not write access. Of
course, if it's encrypted, you'd need to study the script to
meaningfully alter your data file, unless you simply erase it. Your
web server won't later be able to read it though, since you won't store
the private key on the server.
To safeguard write access, I think mailing it to yourself may be the
best or only solution. Your mail spools are 600. You could also use
procmail and a custom perl script to process the mail to a 600 data
file in your 700 home directory, or if your web pages need to read it,
a 604 data file in your web directory.
--------
Sanford Morton, Ph.D. CGI Resources
sanford@halcyon.com http://www.halcyon.com/sanford/cgi/
------------------------------
Date: 11 Aug 1997 10:49:13 +0200
From: robert@ICK.il.fontys.nl (robert)
Subject: Re: info from dead child-process in SIGN{'CHLD'}
Message-Id: <5smjm9$aa@bsd1.hqehv-internal.ilse.net>
Kristoff Bonne <kristoff.bonne@mpl108.is.belgacom.be>:
>Is there a way for the SIGN{'CHLD'}-subroute of the father-process to
>find out WHAT child-process generated the signal. (the PID would be
>ideal).
Sure, check out the 'wait' and 'waitpid' functions in the perlfunc
manpage.
robert
------------------------------
Date: 11 Aug 1997 05:38:59 GMT
From: koos_pol@nl.compuware.com.NO_JUNK_MAIL (Koos Pol)
Subject: Re: Learn the SECRET to Attract Women Easily
Message-Id: <5sm8hj$o2u@news.nl.compuware.com>
In <Pine.GSO.3.96.970808073746.9049K-100000@kelly.teleport.com>, Tom Phoenix <rootbeer@teleport.com> writes:
>On 8 Aug 1997, Clay Irving wrote:
>
>> In <5s20ih$2e1@chronicle.concentric.net> Want More
>> Dates???<tracy78@kilgrona.com> writes:
>>
>> >Learn the SECRET to Attract Women Easily
>>
>> >The SCENT(tm) Pheromone Sex Attractant For Men to Attract Women
>>
>> Damn. All this time I thought the secret was Perl...
>
>I can get all the dates I want with Perl.
>
> perl -e 'for (1..10) { print localtime(1e8*($_+rand))."\n" }'
>
Please Tom, contain yourself! Not in public!
Koos Pol
----------------------------------------------------------------------
S.C. Pol
PC Systems Administrator
Compuware Europe B.V.
email: Koos_Pol@nl.compuware.com
------------------------------
Date: 11 Aug 1997 11:25:22 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: lib/io_sock.t test failure
Message-Id: <memo.19970811122522.26013B@skep.compulink.co.uk.cix.co.uk>
In article <5sl31k$bkg$1@joe.rice.edu>, jpc@tango.cs.rice.edu (John Paul
Campbell) wrote:
> I'm installing perl5.004_01 and everthing was fine except that when I ra
> n
> the test for lib/io_sock.t, I got the following:
>
> 1..5
> ok 1
> Bad file descriptor at lib/io_sock.t line 55.
>
>
> Line 55 has:
>
> $sock = IO::Socket::INET->new(PeerPort => $port,
> Proto => 'tcp',
> PeerAddr => 'localhost'
> ) or die "$!";
>
> everything else passes.
>
> I'm installing under FreeBSD2.2.2
>
> If anyone can help, please reply by mail as well.
>
I had exactly this problem under Solaris 2.4. The fix was to ensure that
you use only the system libraries, have no references to /opt/gnu or
/usr/ucb.
Regards
Neil
------------------------------
Date: Mon, 11 Aug 1997 08:53:30 +0200
From: Marten Trautwein <martt@elsevier.nl>
Subject: Need documentation on (TOP) formats
Message-Id: <33EEB6EA.1CF48F5D@elsevier.nl>
Hi,
Can anyone recommend documentation on formats and top-of-page formats?
Neither the purple nor the blue Camel book discusses the subject in
(enough) detail. Alas, the FAQ http://www.perl.com/perl/faq/ also does
not help.
I have the following problem (cf. comp.lang.perl.misc:66269). When I
initialize the format of a filehandle, the top-of-page format is
suddenly
changed accordingly on the first write. The Camel books do not describe
this kind of functionality.
Marten Trautwein,
m.trautwein@syllogic.nl,
Syllogic B.V., Houten, The Netherlands
------------------------------
Date: Mon, 11 Aug 1997 07:25:01 GMT
From: brian@brie.com (Brian Lavender)
Subject: Numbers to strings with preceeding 000's
Message-Id: <33eebd53.15639777@nntp.netcruiser>
I have a list
@list = 1..30;
I want to make this list into a list of strings so the strings are in
the format.
@stringlist =
('001','002','003','004','005','006','007','008','009','010','011','012',...,'029','030');
How do I do this?
Brian
----------------
Brian Lavender
Sacramento,CA
Brie Business Directory - Napa Valley http://www.brie.com/bbd/
(916) 443-6195
"Moving sucks"
------------------------------
Date: 11 Aug 1997 10:45:58 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: Numbers to strings with preceeding 000's
Message-Id: <5smqh6$ca1$1@netnews.upenn.edu>
Brian Lavender (brian@brie.com) said:
: I have a list
: @list = 1..30;
:
: I want to make this list into a list of strings so the strings are in
: the format.
: @stringlist =
: ('001','002','003','004','005','006','007','008','009','010','011','012',...,'029','030');
:
: How do I do this?
Looks like a job for sprintf (pr printf). Might want to check the
manpages to choose the best formatting string for your situation, but
printf "%.3i",1;
gives me '001'.
: "Moving sucks"
Maybe ask the Perl Porters to help? *G*
dan
--
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks
------------------------------
Date: Mon, 11 Aug 1997 00:09:44 -0600
From: "Juan M. Courcoul" <courcoul@campus.qro.itesm.mx>
Subject: Perl 5.004_01 on AIX 4.2.1
Message-Id: <33EEACA8.C686B323@campus.qro.itesm.mx>
I'm urgently in need of getting Perl up and running on a couple of IBM
PowerPC Unix boxes running AIX 4.2.1. So far, it compiles without errors
(but a few warnings) using AIX's own xlc compiler. It passes all tests
without errors and installs cleanly, but it doesn't work reliably.
Running a simple account verifying script, which loads /etc/passwd on a
couple of hashes, it bombs when exiting the while loop with a coredump.
I tried recompiling with gcc 2.7.2.2 (which also compiled & verified
cleanly), and it did not pass a bunch of tests, mainly the database
tests, POSIX and lib/opcode.
Is there any gotcha that I'm overlooking ? Believe me, I would much
rather work on my Solaris box, but the higher-ups insist we go the IBM
way... :(
TIA for any and all pointers and help.
John Courcoul
Monterrey Tech,
Queretaro, Mexico
------------------------------
Date: 10 Aug 1997 21:20:01 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: perl for win32, Win32::ODBC, and IIS on NT 4.0
Message-Id: <5sm3th$3vu$1@lennon.postino.com>
Wes James (wesj@ext.usu.edu) wrote:
: I can run a perl script at the command prompt but when I try to run
: the script in a browser it gives me a compile error - the compile
: error is the line with "use Win32::ODBC"
: How do I get the ODBC perl module to work in a perl script on a web
: server?
You don't tell us what the compile time error is, but my guess is that
Win32::ODBC is not found. Check your environment variables %ENV while
running from the server, probably a path problem.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail.
------------------------------
Date: 10 Aug 1997 21:16:23 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: perl in NT
Message-Id: <5sm3mn$3vn$1@lennon.postino.com>
Petri Backstrom (petri.backstrom@icl.fi) wrote:
: Anyway, make sure you have the latest Perl release (the
: one from http://www.activeware.com, for example).
: Then see the Perl for Win32 Frequently Asked Questions (FAQ)
: list at:
The perl binary from activeware leaves much to be desired. If you
must use a prepackage binary, use the one from ftp.cdrom.com/pub/
perl/CPAN/ports/nt/Gurusamy_Sarathy . It includes a bunch of modules,
and MakeMaker, which will let you add modules that do not compile into
the binary. Activewares binary is missing MakeMaker, and most of the
libraries. But you can roll-your-own perl, with the gnuwin32 dev kit
from www.cygnus.com and latest.tar from any CPAN site.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail.
------------------------------
Date: 11 Aug 1997 09:23:15 +0200
From: Marek.Rouchal@-nospam-HL.Siemens.DE (Marek Rouchal HL CAD SYS Tel. 25849)
Subject: Re: Problem with Open3
Message-Id: <5smel3$vu@limbo.HL.Siemens.DE>
> I'm using the IPC::Open3 module to read and write to a command. The
> problem that I am having has to do with reading from the STDERR pipe
> when nothing is coming through that stream. The script will hang when I
> try to do this when no errors have occurred on the command.
>
> I thought that perhaps I could check errno through the $! variable and
> then read from the pipe only if an error did occur, but it seems that
> this value does not get reset or cleared if the command was successful.
Your script seems ok to me. Try using the fcntl() function (see perlfunc(1))
to make the filehandle non-blocking. You may have to use select() and
sysread(), too to get reasonable behaviour: You may have to take into
account that the command takes a while before returning any success/failure
messages.
Hope this helps!
Marek
PS. To reply by Email, please remove -nospam- from the addresses. Thank you.
+--------------------------------------------------------------------+
Marek Rouchal
SIEMENS AG Phone : +49 89/636-25849
HL CAD SYS Fax : +49 89/636-23650
Balanstr. 73 mailto:Marek.Rouchal@-nospam-hl.siemens.de
81541 Muenchen PCmail:Marek.Rouchal.PC@-nospam-hl.siemens.de
+--------------------------------------------------------------------+
------------------------------
Date: Mon, 11 Aug 1997 00:05:34 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Aaron Bawcom <aaron@bawcom.net>
Subject: Re: Q: Recompiling Modules during execution
Message-Id: <33EE8F8E.962E06C2@mail.earthlink.net>
> Is it possible to ask Perl to recompile the MyClass module during
> run-time?
> I tried doing a 'require MyClass;' in the while loop but the originally
> compiled
> code is used instead of any new code that was introduced since the
> module was 'require'd.
>From perlfunc:
require EXPR
require
Demands some semantics specified by EXPR, or by $_ if EXPR is not
supplied. If EXPR is numeric, demands that the current version of Perl
($] or $PERL_VERSION) be equal or greater than EXPR.
Otherwise, demands that a library file be included if it hasn't
already been included. The file is included via the do-FILE mechanism,
which is essentially just a variety of eval() . Has semantics similar to
the following subroutine:
[snip]
Note that the file will not be included twice under the same specified
name.
[Hmm, let's look up "do EXPR":]
do EXPR
Uses the value of EXPR as a filename and executes the contents of
the file as a Perl script. Its primary use is to include subroutines
from a Perl subroutine library.
do 'stat.pl';
is just like
eval `cat stat.pl`;
except that it's more efficient, more concise, keeps track of the
current filename for error messages, and searches all the -I libraries
if the file isn't in the current directory (see also the @INC array in
Predefined Names). It's the same, however, in that it does reparse the
file every time you call it, so you probably don't want to do this
inside a loop.
Hope this helps!
Benjamin Holzman
------------------------------
Date: 11 Aug 1997 03:14:48 GMT
From: thomas_wernitz@tait.co.nz (Thomas Wernitz)
Subject: Re: Sorting this file is killing me
Message-Id: <5sm038$lrh@gatekeeper.tait.co.nz>
In article <871064792.31232@dejanews.com>, paries@advicom.net wrote:
> Marge Simpson|100.00
> bart Simpson|1000.00
> joe simth|300.00
>
> I need to read in this file and the sort the pairs by field 2 and then
> load into either an array of arrays or hash.
Hi,
how about this:
@source = <>; # slurp in the file
map {push @sorted, [$1 => $2]}
sort {(split(/\|/,$a))[1] <=> (split(/\|/,$b))[1]} @source;
HTH,
Thomas
------------------------------
Date: Mon, 11 Aug 1997 13:21:12 +0300
From: Ronen Lazar <ronen_lazar@ccm.jer.intel.com>
Subject: using system() during html page, IIS 3
Message-Id: <33EEE797.A5954244@ccm.jer.intel.com>
Hi,
My question regards NT OS and IIS 3.0:
The IIS 3 does problems with running a batch file, so I wanted to write
a 3 lines perl script that will run the batch file. Something like:
print "HTTP 200 OK\n";
print "Content-Type: text/html\n\n";
system ("c:\inetsrv\scripts\get_data.bat");
While trying to run it from a command prompt, it runs well, but the
trouble begin while trying to run the script from the html.
Even when I try something simpler such as 'system("echo hello")', the
server seems to ignore it .
Think you can spare some cyber ink on this one?
thanks, Ronen
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 843
*************************************