[10984] in Perl-Users-Digest
Perl-Users Digest, Issue: 4584 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 8 07:07:11 1999
Date: Fri, 8 Jan 99 04:00:13 -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, 8 Jan 1999 Volume: 8 Number: 4584
Today's topics:
Re: How to NOT use GOTO (Bart Lateur)
Re: is there a hex print of strings? <jlarke@ans.net>
kicking off daemons from Perl - defunct processes <htvoon@uk.ibm.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 08 Jan 1999 11:00:27 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: How to NOT use GOTO
Message-Id: <369ae236.4386035@news.skynet.be>
John T. Jarrett wrote:
>opendir(DIR, $UserDir) || goto &makeit;
> print "Content-type: text/html\n\n";
> print <<__W2__;
> <H1>User Name / Directory Name Taken</H1>
> Please press Back on your browser and try a
> different User Name.
>__W2__
> exit;
>}
Try putting something like this in a sub (that takes care of ALL output
for the script):
opendir(DIR, $UserDir) and return print <<__W2__;
Content-type: text/html
<H1>User Name / Directory Name Taken</H1>
Please press Back on your browser and try a
different User Name.
__W2__
&makeit;
Bart.
------------------------------
Date: 08 Jan 1999 06:39:13 -0500
From: Jason Larke <jlarke@ans.net>
Subject: Re: is there a hex print of strings?
Message-Id: <vat67aidme6.fsf@anthem.aa.ans.net>
>>>>> On Fri, 8 Jan 1999 00:31:34 -0500, stevenba@ccpl.carr.org
>>>>> (Steven Barbash) said:
SB> Is there a function or module or ... that inputs a string and
SB> outputs its hex value?
SB> What I want is like this:
SB> source: "this is a test" output:
SB> "7468697320697320612074657374"
SB> Doc refs, samples, etc all welcome, as are related issues.
The Perl Cookbook includes code to do this, more or less. Here's
my version. Variable names have been pointless changed. Viva Tom
and Nathan.
#!/usr/local/bin/perl -w
use strict;
my ($char,$hex);
my $string="This is a test.";
my @decimals=unpack("H*", $string);
print "@decimals\n";
--
Jason Larke- jlarke@ans.net- Just a happy little pimp for mayhem
http://www.nnaf.net/~jlarke/ Send mail for PGP public key.
I don't speak for ANS or the international communist conspiracy.
"People change, and smile: but the agony abides."-T.S. Eliot, The Dry Salvages
------------------------------
Date: Fri, 08 Jan 1999 11:00:59 +0000
From: Ton Voon <htvoon@uk.ibm.com>
Subject: kicking off daemons from Perl - defunct processes
Message-Id: <3695E56B.BC81EBD3@uk.ibm.com>
Hi!
I have a problem where I am trying to collect output from a shell script
that is kicking off a daemon. The perl script looks like:
#!/usr/local/bin/perl
open(F,"/usr/local/bin/daemon 2>&1 |");
while (chop($_=<F>)) {
print "Output: $_",$/;
}
close(F);
$return_code=$?;
The /usr/local/bin/daemon just prints some output and kicks off a
daemon, such as iptrace.
print "Starting iptrace"
iptrace /tmp/trace.log
print "Finished"
If you run the perl script, it will just hang at the <F> bit. The daemon
script goes defunct and is waiting for the perl script to reap it. The
only way I found of fixing this is to close the stdin/out/err
filehandles in the daemon script before iptrace is executed:
exec 0<&-
exec 1<&-
exec 2<&-
However, I would like a solution at the perl end so that scripts aren't
modified. What can I do?
AIX 4.2.1 and Perl 5.004
Ton Voon
------------------------------
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 4584
**************************************