[11632] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5232 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 26 05:02:33 1999

Date: Fri, 26 Mar 99 02:00:20 -0800
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, 26 Mar 1999     Volume: 8 Number: 5232

Today's topics:
    Re: :t/85s*) 8j.F59%~<F=F;s (Kim Saunders)
        Bijeenkomst Nederlandse Perl Mongers, 6 april 1999 (Johan Vromans)
    Re: Date/Time calculation: % through current month? <cassell@mail.cor.epa.gov>
    Re: Date/Time calculation: % through current month? <tony@crux.blackstar.co.uk>
    Re: Date/Time calculation: % through current month? <tony@blackstar.co.uk>
    Re: Date/Time calculation: % through current month? (Larry Rosler)
    Re: don't understand ||= operator ran@netgate.net
    Re: drawing pixels in Perl? (Kim Saunders)
    Re: Help: CGI.PM: Table of textfield ? <Tony.Curtis@vcpc.univie.ac.at>
    Re: HELP: Confused about Hash Table. <cassell@mail.cor.epa.gov>
        How to convert Julian date to week day?? hk1973@my-dejanews.com
    Re: How to know that a pipe opened for writing is broke (Sam Holden)
        How to know that a pipe opened for writing is broken? ( <ppa@itmasters.com>
    Re: Looking For a Module? <kaelin@himalia.talarian.com>
        No clues to Win32::NetResource problem? <gehring@politik.uni-mainz.de>
        Perl Error DBI.pm in @INC <simon_ng@twtsg.com.sg>
    Re: Perl script ignoring system() command (Tad McClellan)
    Re: Precisions - How does NT do the fork() for an open  <ppa@itmasters.com>
    Re: Running a perl script as a daemon.... (Tad McClellan)
    Re: Standard Deviation <cassell@mail.cor.epa.gov>
        Storable-0.6@3 (Tom Mornini)
        system() redirecting output <SRodighiero@crema.unimi.it>
    Re: Values of 'true' and 'false'? <Philip.Newton@datenrevision.de>
        WHO KNOWS THE ANSWER? terrafly@yahoo.com
    Re: WHY: open (HPIPE, "| notexistfile") or die "..."; D <ppa@itmasters.com>
    Re: WHY: open (HPIPE, "| notexistfile") or die "..."; D (Sam Holden)
        Win32 Perl changing Service Account for NT-Services <christian.jacob@sercon.de>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 26 Mar 1999 05:58:39 GMT
From: kims@tip.net.au (Kim Saunders)
Subject: Re: :t/85s*) 8j.F59%~<F=F;s
Message-Id: <36fb21e7.2372638@news.apex.net.au>

>What we have here folks is the 1999 obscure code winner, hands down!

Or perhaps the most secure encryption ever??? (quick, let's get
distributed.net onto it!)

KimS


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

Date: 26 Mar 1999 09:17:53 +0100
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Bijeenkomst Nederlandse Perl Mongers, 6 april 1999
Message-Id: <m2oglgoea6.fsf@phoenix.squirrel.nl>

[English version follows the dutch text]

Amsterdam.pm staat voor de "Amsterdamse Perl Mongers", een groep van
gebruikers van Perl. In tegenstelling tot wat de naam suggereert is
Amsterdam.pm niet beperkt tot alleen Amsterdam, maar functioneert, tot
er meer gebruikersgroepen in Nederland zijn, als Nederlandse
gebruikersgroep.

Amsterdam.pm organiseert informele bijeenkomsten waar Perl gebruikers
kunnen samenkomen en informatie en gebruikservaringen met betrekking
tot Perl kunnen uitwisselen. Deze bijeenkomsten vinden plaats op elke
eerste dinsdag van de maand. De voertaal binnen Amsterdam.pm is in
pricipe Nederlands, maar indien nodig zal Engels worden gebruikt, b.v.
om te communiceren met niet-Nederlandssprekende aanwezigen.

De eerstvolgende bijeenkomst vindt plaats op 6 april 1999.
De agenda voor deze bijeenkomst is, zoals gewoonlijk, informeel:

  18:00-18:30   Verzamelen bij Maximiliaan op de Nieuwmarkt
  19:00-20:30   Etentje in een restaurant ergens in de buurt
  21:00-.....   Voortzetting bij Maximiliaan's -- discussies, etc.

Bezoek onze Web site http://www.Amsterdam.pm.org voor meer details.

[English version]

Amsterdam.pm stands for the Amsterdam Perl Mongers. We're basically a
Perl user group. Despite its name, it is not local to the Amsterdam
environment, but it welcomes Perl mongers from all over the
Netherlands. 

Amsterdam.pm organises informal meetings where Perl users can meet,
and exchange information and experiences with regard to using Perl.
The meetings are held every first Tuesday of the month.
Although the preferred language for communication is Dutch, English
will be spoken if necessary.

Our next meeting is April 6th, 1999.
It will have the following informal agenda:

  18:00-18:30   Gathering at Maximiliaan's on the Nieuwmarkt
  19:00-20:30   Dinner in a restaurant somewhere near the Nieuwmarkt
  21:00-.....   Discussions and such at Maximiliaan's

See http://www.Amsterdam.pm.org for more details.


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

Date: Thu, 25 Mar 1999 21:53:36 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Date/Time calculation: % through current month?
Message-Id: <36FB20E0.455B1369@mail.cor.epa.gov>

Larry Rosler wrote:
> 
> In article <36FAD142.28CD09D2@mail.cor.epa.gov> on Thu, 25 Mar 1999
> 16:13:54 -0800, David L. Cassell <cassell@mail.cor.epa.gov >says...
> > Tony Bowden wrote:
> ...
> > It's still a nice piece of code.  You could fix it simply by testing
> > whether $month=11 (December), and if so use $month=1 and $year+1 .
                                                       ^
                                                       0

Oy veysmere!  That's two in an afternoon.  Not close to my
record, of course...  :-)  And after I just finished blathering
about this in my previous post.  I gotta go back to caffeinated
sodas...

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 26 Mar 1999 06:43:16 GMT
From: Tony Bowden <tony@crux.blackstar.co.uk>
Subject: Re: Date/Time calculation: % through current month?
Message-Id: <922430578.108520@news.tibus.net>

David L. Cassell <cassell@mail.cor.epa.gov> wrote:
: Well, an easy way to do end_of_month - start_of_month is to populate an array 
: with the number of seconds in each month.  That way you won't have to use
: timelocal() and localtime() so often.  

: @end_to_start=(31,28,31,30,31,30,31,31,30,31,30,31);  # number of days
: $end_to_start[1]=29 if ($year % 4 == 0);   # works between 1901 and 2099
: @end_to_start *= 24*60*60;                 # and now it's in secs


Interesting ... 

It goes against the grain slightly to build an array that I'll only need
one elemet of, especially as I'll still have to do one call to find out
what month it currently is, so it all boils down to which is 'better',
between pre-building the seconds in every month, or dealing with December
to January rollovers. I haven't benchmarked, but I'd guess the second
is quicker, and to my mind, more elegant.

But yes, this would work too.

Thanks,

Tony
-- 
-----------------------------------------------------------------------------
 Tony Bowden | tony@blackstar.co.uk               http://www.blackstar.co.uk/
  Black Star |    The UK's Biggest Video & DVD store * Free Postage Worldwide
-----------------------------------------------------------------------------
 


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

Date: 26 Mar 1999 06:46:30 GMT
From: Tony Bowden <tony@blackstar.co.uk>
Subject: Re: Date/Time calculation: % through current month?
Message-Id: <922430772.686879@news.tibus.net>

Larry Rosler <lr@hpl.hp.com> modified:
:> : $sec=$min=$hour=0; $day=1; $month=2; $year=1999;
:> : $march1st=timelocal($sec,$min,$hour,$day,$month,$year);
:> : $april1st=timelocal($sec,$min,$hour,$day,$month+1,$year);

into

: my ($month, $year) = (localtime(my $now = time))[4, 5];
: my $this = timelocal(0, 0, 12, 1, $month, $year);
: ++$month > 11 and ($month, $year) = (0, $year + 1);
: my $next = timelocal(0, 0, 12, 1, $month, $year);

Before the 'constant'
: my $equation = ($now - $this) / ($next - $this);
: printf "%.3f\n", $equation;

Now, this solves the problem very neatly indeed, but I'm confused as to
why the months start at noon ...

Thanks,

Tony
-- 
-----------------------------------------------------------------------------
 Tony Bowden | tony@blackstar.co.uk               http://www.blackstar.co.uk/
  Black Star |    The UK's Biggest Video & DVD store * Free Postage Worldwide
-----------------------------------------------------------------------------


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

Date: Thu, 25 Mar 1999 23:20:54 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Date/Time calculation: % through current month?
Message-Id: <MPG.1164d53096d72849897d2@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <922430772.686879@news.tibus.net> on 26 Mar 1999 06:46:30 
GMT, Tony Bowden <tony@blackstar.co.uk >says...
> Larry Rosler <lr@hpl.hp.com> modified:
 ...
> : my $this = timelocal(0, 0, 12, 1, $month, $year);
> : ++$month > 11 and ($month, $year) = (0, $year + 1);
> : my $next = timelocal(0, 0, 12, 1, $month, $year);
 ...
> Now, this solves the problem very neatly indeed, but I'm confused as to
> why the months start at noon ...

Because you caught the post before I cancelled it and resubmitted it 
with midnight.  It was a braino about which little more need be said -- 
except that it leads to an incorrect answer.  :-(

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personl/Larry_Rosler/
lr@hpl.hp.com


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

Date: 26 Mar 1999 07:51:14 GMT
From: ran@netgate.net
Subject: Re: don't understand ||= operator
Message-Id: <7dfe9i$rki$1@remarQ.com>

In <Pine.BSF.3.96.990325130952.11408A-100000@butterfly.inna.net>, Jane Dudley <jdudley@inna.net> writes:

>(Hey, I'm a mechanical engineer.  Either there IS water flowing in that 
>pipe OR there isn't.  There ain't no logical or bitwise flow about it). 
> Can someone make up a simple example to illustrate the difference?

The bitwise OR only makes sense if there's more than one "pipe".

Here's a "mechanical engineering" example:  you have multiple water
supplies, for redundancy, that feed into a common pipe.  For the
"logical" OR (or AND),  it doesn't matter which,  or how many,  of those
incoming feeds are on:  either you have water coming out,  or you don't.

Now, suppose you get a call from supllier "B" saying "Hey, some idiot
just spilled some gasoline in our reservoir".  Your output can now have 
multiple possible "values":  no water,  clean water,  or contaminated
water.  In that case,  you'd use a "bitwise" operator to examine or 
control the individual feeds (or bits in the byte/word).

In writing Perl programs,  you'd mostly use the bitwise ops if you were
doing something like setting flags in a control block for a system call, 
or setting bits in a byte for an I/O device.  In the case of an OR,  you
*could* take advantage of the (lack of) short-circuiting to save a few 
keystrokes when you're controlling program flow.  But hubris and 
laziness aren't always virtues,  and that sort of trick has a nasty
tendency to come back and bite you when you least want it to.

Ran




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

Date: Fri, 26 Mar 1999 05:47:53 GMT
From: kims@tip.net.au (Kim Saunders)
Subject: Re: drawing pixels in Perl?
Message-Id: <36fb1eca.1576140@news.apex.net.au>

>I'd like to be able to draw images at a very low level, i.e.
>I want to be able to draw individual pixels in the screen.   
>What is the best module to do this with?? 

I'd use the ANSI::C++ module, if you know what I mean... Perl is an
awesome lanuage, but it is really meant (and exceptionally good at)
for playing around with text, strings, files, etc. You can get it to
do some pretty nice network type stuff with all the modules around,
but really, perl is not what you want to use for this. Even if you
figured out how to do it (and you probably could these days), it'd be
way slower than C.

KimS


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

Date: 26 Mar 1999 10:14:13 +0100
From: Tony Curtis <Tony.Curtis@vcpc.univie.ac.at>
Subject: Re: Help: CGI.PM: Table of textfield ?
Message-Id: <83u2v8d34q.fsf@vcpc.univie.ac.at>

Re: Help: CGI.PM: Table of textfield ?, Eisen
<echao@interaccess.com> said:

Eisen> Hi All:

Eisen> I am using CGI.PM to create a form that has a
Eisen> table of textfields, that is a
Eisen> spreadsheet-like matrix of fields that users
Eisen> can enter data into.

Eisen> My problem is that textfield requires a
Eisen> unique name for each field. But I need to
Eisen> handle all the textfields at the same time
Eisen> (i.e. as an array):

Give them enumerated names and then just iterate
over them in the perl to push() them into the array.

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien.  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Thu, 25 Mar 1999 21:50:39 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: HELP: Confused about Hash Table.
Message-Id: <36FB202F.5A3EDC3@mail.cor.epa.gov>

KEhlar wrote:
> 
> In article <jc5bd7.3a3.ln@magna.metronet.com>, tadmc@metronet.com says...
> > KEhlar (KEhlarQUASH@SPAMMERtheglobe.com) wrote:
> >
> > : I can create a hash table with code like this one:
> >
> > :  $index = 0;
> > :  foreach $element (@list1) {
> > :   $hash1{$index} = $element;
> > :   $index++;
> > :  }
> >
> >
> >    Well OK, but that looks like an array (indexed by a number)
> >    masquerading as a hash (indexed by a string) to me.
> >
> >
> > : OR like this one:
> >
> > :  %hash1 = ('1', 'element1', '2', 'element2'....so on);
> >
> >
> >    The first one defined $hash1{0}, this one does not...
> 
> I only used above as examples of ways to create a hash table.  The code that I
> actually wrote is more complicated and contained names and email addresses as
> key/value, so an array would not be an appropriate type to use.  Of course if I
> wanted to write a code like above (where the key is basically the index) I would
> use an array instead of a hash table.

Well okay, but I don't think it's fair to blame Tad for giving advice on what
actually wrote.  How was he supposed to know which pieces were real and which 
were genned up just for your post?  He was trying to be helpful.  Really.
 
> > : In the latter, I can actually split the hash using the "," as the delimiter.
> >
> >    Eh?
> 
> That was my mistake, I should have had the second hash shown as below:
> 
>  %hash1 = ('1,element1', '2,element2'....so on);

Please, no.  If your key is the sequence from 1 to N, you probably want
to use a regular array.  Now in your *unused* example [names and e-mail
addresses], a hash is a good choice.

> Then I can split it:
> 
>  foreach (@hash1) {
>     ($num,$ele)=split /,/;
>         print "$num has $ele\n";
>  }
> 
> Is it more clear what I mean now?

I'm not sure.  Let me take a stab, and you tell me.  You want to be able
to work with a set of keys and values.  So let's define your hash like
this:

%emails = (
    Fred   => 'flinty@bedrock.net',
    Barney => 'shorty@schist.com',
    Wilma  => 'sexpot@altopia.net',
    Dino   => 'rowrrowrrowr@rowr.rowr',
);

Okay, now you've got the keys and values all paired up, and they're set
up in a hash already so you don't have to do any splitting or assignment.
Is this what you meant? 

> My question is basically WHAT would I use (if I can at all) to split the hash
> table created with the first method the way I did with the one created with the
> second method.

I'm still not sure what you want.  If this isn't it, then you're going to
have to give your real example, with some real code you have tried to use,
and the real results you actually were hoping for.
 
> >    Are you processing Perl source code or something?
> 
> I don't understand your question.  I hope this was not meant as a condecending
> remark coming from a professional consultant.  If it was, it was uncalled for.
> I'm new at Perl and simply needed some help.  Everyone started from the buttom,
> even those who are experts today.

No no no, Tad was asking a *real* question.  Programmers do hack source
code and similar black arts.  Have you heard of lex and yacc?  Of course,
for real black magic there's always sendmail...  :-)

David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 26 Mar 1999 09:15:57 GMT
From: hk1973@my-dejanews.com
Subject: How to convert Julian date to week day??
Message-Id: <7dfj86$a4k$1@nnrp1.dejanews.com>

How do I tell which day (Mon - Sun) from a julian date. I have got some perl
script converting date but not to week day (Mon - Sun), can anyone post the
script or tell me the formula about it.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 26 Mar 1999 08:54:12 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: How to know that a pipe opened for writing is broken? (perlfaq does not  give the answer)
Message-Id: <slrn7fmipk.1nd.sholden@pgrad.cs.usyd.edu.au>

Patrice M.I. Parmentier <ppa@itmasters.com> wrote:
>Look at the very simple (wrong) script:
>
>DO NOT EXPLAIN ME WHY IT DOES NOT WORK (perlfaq does).
>I want to know how to change this script in order it does what i would
>want (see below).

perlfaq also explains how to change it so it will work... Simply read the
bit after the bit of the FAQ I posted a minute ago.

Asking the same question twice with two different subjects is a bit excessive.
We aren't here to do your bidding, you know.

-- 
Sam

Many modern computer languages aspire to be minimalistic. They either
succeed in being minimalistic, in which case they're relatively useless,
or they don't succeed in being truly minimalistic, in which case you can
actually solve real problems with them.  --Larry Wall


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

Date: Fri, 26 Mar 1999 09:50:32 +0100
From: "Patrice M.I. Parmentier" <ppa@itmasters.com>
Subject: How to know that a pipe opened for writing is broken? (perlfaq does not  give the answer)
Message-Id: <36FB4A58.9808B88E@itmasters.com>

Look at the very simple (wrong) script:

DO NOT EXPLAIN ME WHY IT DOES NOT WORK (perlfaq does).
I want to know how to change this script in order it does what i would
want (see below).

##################################################
SIG{PIPE} = sub {
 print "SIGPIPE called...\n";
 exit (-666);
};

$pid = open (HPIPE, "| buggything") or die "Cannot pipe buggything\n";

print "pid = $pid\n";

$n = 0;
while (1)
{
 print HPIPE $n++ . "\n";
 print "$n\n";
}
####################################################

I would want a mean to know when the 'buggything' program stopped.

1. Open always succeeds because it returns the result of the fork() that
always succeeds.
(this is what is explained in perlfaq, but this faq tells why the things
go wrong and not how to do the things work fine).
At this point, i cannot know if buggything is started. As the script
must run on unix and f#!..g NT, an analyze of a 'ps' command does not
work.

2. I continously write to the pipe... and i want that my main (parent)
script stops (only) if the 'buggything' program failed. Note that by
default, a command line like 'a | b' stops when b exits.
I would expect that the SIGPIPE handler is called but it does not ; why?
even if the fork succeeds, it should exec the buggything then exits, and
the main scripts should receive a signal ; what is wrong in this last
sentence?

Can somebody know how to write a simple script that writes to an open
pipe an stops when the piped program stops or is it impossible (without
ugly workarounds) ?


--
 Patrice M.I. PARMENTIER




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

Date: 25 Mar 1999 22:20:48 -0800
From: Kaelin Colclasure <kaelin@himalia.talarian.com>
Subject: Re: Looking For a Module?
Message-Id: <q73e2ssren.fsf@himalia.talarian.com>

Personally, I favor Data::Dumper and eval -- assuming that you're not too
concerned about a hostile party with write access to the config file. :-)


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

Date: Fri, 26 Mar 1999 09:37:04 +0100
From: "Uwe W. Gehring" <gehring@politik.uni-mainz.de>
Subject: No clues to Win32::NetResource problem?
Message-Id: <36FB4730.AD3CAE1D@politik.uni-mainz.de>

Hi,

this is a reposting since no one answers to the same posting earlier to
comp.lang.perl.misc.

The Win32::NetResource on AvtiveStates 509 Build does not work properly.
Some functions work (i.e. NetShareAdd, NetShareDel), but others not,
i.e. NetShareGetInfo. The following script returns absolutely nothing -
not even an error. I have a clean installation just added the AdminMisc
Module (which works).

use Win32::NetResource;

$myshare = "Programme";

Win32::NetResource::NetShareGetInfo($myshare,\%share_info)
 || die "Unable to get share information\n";

foreach $i (keys %share_info) {
        print $share_info{$i},"\n";
}

exit;

TIA
-- 

Sincerely
Uwe W. Gehring

Research Assistant
****************************************************
University of Mainz - Institute of Political Science
Saarstr. 21          55099 Mainz             Germany
Tel.: +49 6131 39-5485         Fax: +49 6131 39-2996
E-Mail:                 gehring@politik.uni-mainz.de
WWW:                http://www.uni-mainz.de/~gehring
****************************************************


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

Date: Fri, 26 Mar 1999 15:43:36 +0800
From: "Simon Ng" <simon_ng@twtsg.com.sg>
Subject: Perl Error DBI.pm in @INC
Message-Id: <7dfbrh$2cr$1@mawar.singnet.com.sg>

Hi,

I can't seem to some perl to run and was return with this message.
Can anybody explain. I think i may need to install some kind of DBI module.
If so then where can i download from.

Thanks

CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:


Can't locate DBI.pm in @INC (@INC contains: C:\PERL\lib C:\PERL\site\lib .)
at C:\Inetpub\scripts\simple.pl line 3.
BEGIN failed--compilation aborted at C:\Inetpub\scripts\simple.pl line 3.






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

Date: Thu, 25 Mar 1999 18:48:14 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl script ignoring system() command
Message-Id: <uvhed7.j01.ln@magna.metronet.com>

c_evans@my-dejanews.com wrote:

: .  It must be a server config issue because it works on one server but
: not another. 


   So why did you post to the Perl newsgroup then?

   There are other newsgroups where servers and their
   configuration are discussed:

      comp.infosystems.www.servers.mac
      comp.infosystems.www.servers.misc
      comp.infosystems.www.servers.ms-windows
      comp.infosystems.www.servers.unix

--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 26 Mar 1999 10:52:06 +0100
From: "Patrice M.I. Parmentier" <ppa@itmasters.com>
Subject: Re: Precisions - How does NT do the fork() for an open pipe?
Message-Id: <36FB58C6.9A424EBB@itmasters.com>

On unix systems, everything is ok.
On NT, the problem remains.


> Look at the very simple (wrong) script:
>
> ##################################################
> SIG{PIPE} = sub {
>  print "SIGPIPE called...\n";
>  exit (-666);
> };
>
> $pid = open (HPIPE, "| buggything") or die "Cannot pipe buggything\n";
>
> print "pid = $pid\n";
>
> $n = 0;
> while (1)
> {
>  print HPIPE $n++ . "\n";
>  print "$n\n";
> }
> ####################################################
>
> I would want a mean to know when the 'buggything' program stopped.
>
> 2. I continously write to the pipe... and i want that my main (parent)
> script stops (only) if the 'buggything' program failed. Note that by
> default, a command line like 'a | b' stops when b exits.
> I would expect that the SIGPIPE handler is called but it does not ; why?
> even if the fork succeeds, it should exec the buggything then exits, and
> the main scripts should receive a signal ; what is wrong in this last
> sentence?

Here i can suspect a NT problem since NT does not support the fork()
command. So I really don't know how the open (HPIPE, "| command") is
performed. It is probably the cause of the problem...

--
Patrice M.I. PARMENTIER




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

Date: Thu, 25 Mar 1999 18:34:52 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Running a perl script as a daemon....
Message-Id: <s6hed7.j01.ln@magna.metronet.com>

Diggy Tim (tim@diggy.com) wrote:

: Subject: Re: Running a perl script as a daemon....
                                          ^^^^^^
                                          ^^^^^^

: How do I go about running a perl script from the command line and have it
: sit in the background and not die when I log out.


   What happened when you did a word search in the Perl FAQs
   before posting?


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 25 Mar 1999 21:28:22 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Standard Deviation
Message-Id: <36FB1AF6.F391A962@mail.cor.epa.gov>

Eric Bohlman wrote:
> 
> Andrew Johnson <andrew-johnson@home.com> wrote:
> : sub simple_stats {
> :     my @data = @_;
> :     my $size = @data;
> :     return unless $size;
> :     my ($sum_x, $sum_x2) = (0, 0);
> :     for (@data) {
> :         $sum_x  += $_;
> :         $sum_x2 += $_ ** 2;
> :     }
> :     my $mean  = $sum_x / $size;
> :     my $var   = ($sum_x2 - ($sum_x ** 2 / $size)) / ($size - 1);
> :     my $stdev = sqrt($var);
> :     return ($mean, $var, $stdev);
> : }
> 
> This common textbook formula for computing variances is not particularly
> stable in the face of roundoff error.  There are better "one-pass"
> algorithms, though I can't remember the details off the top of my head.
> A DejaNews search of sci.stat.math and sci.stat.consult should turn up
> the details.

But then, if you want to get technical, standard deviation is not
necessarily a good choice for a measure of dispersion.  And the
mean is often not a good measure of central tendency.  Shall we
write a Math::RobustStats module?  And if so, who would ever use
it besides the two of us?  :-)
 
David
-- 
David L. Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 26 Mar 1999 07:03:41 GMT
From: tmornini@netcom.com (Tom Mornini)
Subject: Storable-0.6@3
Message-Id: <tmorniniF96wy6.9y1@netcom.com>

I'm trying to install Storable as a dependent module for Apache::Session.

It compiles fine on Solaris 2.5.1/Perl 5.00404 and tests OK as well.

On Solaris 7/Perl 5.00502 I get these results:

kirk% make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl -Iblib/arch -Iblib/lib
-I/usr/local/lib/pe
rl5/5.00502/sun4-solaris -I/usr/local/lib/perl5/5.00502 -e 'use
Test::Harness qw
(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/canonical.........dubious
        Test returned status 0 (wstat 4, 0x4)
t/dclone............dubious
        Test returned status 0 (wstat 11, 0xb)
t/forgive...........dubious
        Test returned status 0 (wstat 11, 0xb)
t/freeze............dubious
        Test returned status 0 (wstat 4, 0x4)
t/retrieve..........dubious
        Test returned status 0 (wstat 11, 0xb)
t/store.............dubious
        Test returned status 0 (wstat 4, 0x4)
t/tied..............dubious
        Test returned status 0 (wstat 4, 0x4)
FAILED--7 test scripts could be run, alas--no output ever seen
make: *** [test_dynamic] Error 2

Do you have any idea what might cause this? I have not had any problems
compiling and installing many other modules on this system.

--
-- Tom Mornini
-- InfoMania Printing and Prepress


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

Date: Fri, 26 Mar 1999 10:17:02 +0100
From: Rodighiero Stefano <SRodighiero@crema.unimi.it>
Subject: system() redirecting output
Message-Id: <F46A08B905A3D111AD720020EA0028737B1F91@ganimede.crema.unimi.it>

Hi everybody!

I need a way to redirect output of a shell-command called with system().
I tried with system( "diff >/dev/null", ...) but it doesn't seem to
work.
I can't use `` operator because I need errorlevel returned by the
program.
TIA

Stefano Rodighiero



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

Date: Fri, 26 Mar 1999 09:11:17 +0100
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Values of 'true' and 'false'?
Message-Id: <36FB4125.53772A58@datenrevision.de>

M.J.T. Guy wrote:
> 
> Well, the values are only well defined to the extent of being true or
> false.    So further manipulation using boolean operators is well
> defined.    But you shouldn't do things like
> 
>      length($a==$b)
>      ($a>$b) * 17

But

    $a = ($b == $c);
    ...
    # other stuff
    ...
    if ($a) { &foo; }

is OK, right? Scalars can store boolean values which act in the way
you'd expect them to? (Actually, knowing the exact values was only done
out of curiosity.)

Cheers,
Philip


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

Date: Fri, 26 Mar 1999 09:28:34 GMT
From: terrafly@yahoo.com
Subject: WHO KNOWS THE ANSWER?
Message-Id: <7dfjvp$ak9$1@nnrp1.dejanews.com>

Okay, here goes...

I have a site where I parse the date from a script into the various SSI pages
via an exec cmd type of command. That's working fine.

I also have other perl scripts, and I parse in the various page sections into
the output pages. Example, the menu sits as an EOT as $menu in a file in the
bin called variables.cgi, and where I need it I write "require
'variables.cgi' and then "$menu" and the text within the EOTs appears in
whatever script I happen to be using.

Here's the bugaboo...I am trying to find a way to include the date in my CGI
output pages as well. I cannot find a way to parse it.

Any help?

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 26 Mar 1999 09:26:12 +0100
From: "Patrice M.I. Parmentier" <ppa@itmasters.com>
To: Tad McClellan <tadmc@metronet.com>
Subject: Re: WHY: open (HPIPE, "| notexistfile") or die "..."; DOES NOT DIE ???
Message-Id: <36FB44A3.3CEE781C@itmasters.com>



Tad McClellan wrote:

> Patrice M.I. Parmentier (ppa@itmasters.com) wrote:
> : I want to open a pipe for writing to the stdin of a program:
>
> : open (HPIPE, "| xxxx") or die "...";
>
> : !!! The open never fails, even when xxxx does not exist !!!
> : WHY???
>
>    Yours is a Frequently Asked Question.
>
>    You are not supposed to ask those yet again,

This is the question of the subject of the msg. I know why the main
question is not this one.
Here is the main question:
How to know when a pipe opened for writing is broken? (without closing
it)

>
>
>    Perl FAQ, part 8:
>
>       "Why doesn't open() return an error when a pipe open fails?"

I KNOW THIS FAQ ! BUT MY QUESTION REMAINS:
How to know when a pipe opened for writing is broken?

Look at the script:

###############################################
$SIG{PIPE} = sub {
 print "SIGPIPE called...\n";
 exit (-666);
};

$pid = open (HPIPE, "| buggything") or die "Cannot pipe buggything\n";

print "pid = $pid\n";

$n = 0;
while (1)
{
 print HPIPE $n++ . "\n";
 print "$n\n";
}
###############################################

SIGPIPE is NEVER called.
the print HPIPE writes gygabytes without failing.
I know that the open returns the fork status, which succeeds, but this
is not the problem:

I want a mean to know that my buggything is stopped...
Maybe i could check the close status but i do not want to stop the
process if it is still alive....

I am going to post a more clear msg.

--
 Patrice M.I. PARMENTIER




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

Date: 26 Mar 1999 08:45:01 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: WHY: open (HPIPE, "| notexistfile") or die "..."; DOES NOT DIE ???
Message-Id: <slrn7fmi8d.1b6.sholden@pgrad.cs.usyd.edu.au>

Patrice M.I. Parmentier <ppa@itmasters.com> wrote:
>
>
>Tad McClellan wrote:
>
>> Patrice M.I. Parmentier (ppa@itmasters.com) wrote:
>> : I want to open a pipe for writing to the stdin of a program:
>>
>> : open (HPIPE, "| xxxx") or die "...";
>>
>> : !!! The open never fails, even when xxxx does not exist !!!
>> : WHY???
>>
>>    Yours is a Frequently Asked Question.
>>
>>    You are not supposed to ask those yet again,
>
>This is the question of the subject of the msg. I know why the main
>question is not this one.

So if you knew that why did you specifically ask the question the FAQ
answers and not the question you wanted answered...

>Here is the main question:
>How to know when a pipe opened for writing is broken? (without closing
>it)
>
>>
>>
>>    Perl FAQ, part 8:
>>
>>       "Why doesn't open() return an error when a pipe open fails?"
>
>I KNOW THIS FAQ ! BUT MY QUESTION REMAINS:

Yelling won't help... Reading the FAQ you claim to know might though..

>How to know when a pipe opened for writing is broken?

<snip script>
>
>SIGPIPE is NEVER called.

Yelling won't help... Reading that FAQ would be a good idea... you could have
read it and fixed your code in the time it took you to type your post...

>the print HPIPE writes gygabytes without failing.
>I know that the open returns the fork status, which succeeds, but this
>is not the problem:
>
>I want a mean to know that my buggything is stopped...
>Maybe i could check the close status but i do not want to stop the
>process if it is still alive....

You could try reading that FAQ that you yelled at us all that you knew...

It contains the following sentence :

'To find out if the command succeeded, you have to <snipped since you know
the FAQ and thus should know the next bit> ...'

Why don't you try doing what the FAQ that you know suggests?

-- 
Sam

It has been discovered that C++ provides a remarkable facility for
concealing the trival details of a program--such as where its bugs are.
	--David Keppel


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

Date: Fri, 26 Mar 1999 09:36:24 +0100
From: "Christian Jacob" <christian.jacob@sercon.de>
Subject: Win32 Perl changing Service Account for NT-Services
Message-Id: <uToMEQ2d#GA.337@ntdwwaaw.compuserve.com>

Hi,
is there a module or does anyone know how to change the password for a
service account in NT via Perl ??
Thanks in advance

Christian Jacob




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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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