[11866] in Perl-Users-Digest
Perl-Users Digest, Issue: 5466 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 23 16:07:25 1999
Date: Fri, 23 Apr 99 13:00:20 -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 Fri, 23 Apr 1999 Volume: 8 Number: 5466
Today's topics:
Re: Calculating distance between zip codes (M.J.T. Guy)
cgi wrap <cpl11@netcom.ca>
Re: cgi wrap (I R A Aggie)
Re: child's output corrupted by parent's output scraig@my-dejanews.com
chomp-ing from the FRONT end mcti@my-dejanews.com
Re: chomp-ing from the FRONT end (Larry Rosler)
Compiling perl regex lib into other progs <zmievski@ispi.net>
Different between recurrence and looping <carfield@polyu.hknet.com>
Encrypt/Decrypt vilo8720@my-dejanews.com
Encrypt/Decrypt vilo@commercialnetworks.com
Re: FAQ 3.26: Why don't perl one-liners work on my DOS/ (Kevin Reid)
Re: Generating a unique string for order number <gregm@well.com>
Re: Help! Error message when using C-comment stripper f (James R. Goodfriend)
Re: Help! Error message when using C-comment stripper f (Larry Rosler)
Newbie - Perl - Registry -NT mclaughlinj@leaders.ccl.org
Re: Newbie Question: While versus Until scraig@my-dejanews.com
Re: Newbie Question: While versus Until (Larry Rosler)
Perl and ASP <jalil@corp.home.net>
Perl CGI and HTML... <rxmx80@email.sps.mot.com>
Re: Perl Debugger <cassell@mail.cor.epa.gov>
Re: printf problem scraig@my-dejanews.com
Re: printf problem (Tad McClellan)
Server errors...please help mrkn9715@my-dejanews.com
Re: setuid security bypass busted in 5.005_02? (M.J.T. Guy)
Sorting Array of Arrays (Kent Kling)
Truncate doesn't work cryptoman@my-dejanews.com
Upgrading Bash: Is it a good idea? Also, some shell/pe (Kenny McCormack)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Apr 1999 18:32:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Calculating distance between zip codes
Message-Id: <7fqebt$kfb$1@pegasus.csx.cam.ac.uk>
David Cassell <cassell@mail.cor.epa.gov> wrote:
>
>Get the Math::Trig module from CPAN (or ActiveState if you're using
>their build of Perl).
No need to go to CPAN. That's a built-in in current versions of Perl.
Mike Guy
------------------------------
Date: Fri, 23 Apr 1999 14:06:54 -0400
From: cpl11 <cpl11@netcom.ca>
Subject: cgi wrap
Message-Id: <3720B6BD.2DCEFF7F@netcom.ca>
dear friend
what is cgo wrap and what it gonna to affect perl script ?
Thank you
Andrea
------------------------------
Date: 23 Apr 1999 18:35:52 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: cgi wrap
Message-Id: <slrn7i1fh4.ldi.fl_aggie@stat.fsu.edu>
On Fri, 23 Apr 1999 14:06:54 -0400, cpl11
<cpl11@netcom.ca>, in <3720B6BD.2DCEFF7F@netcom.ca> wrote:
+ what is cgo wrap and what it gonna to affect perl script ?
As far as I know, all cgi-wrap does is provide a SUID wrapper around
cgi programs, and allows them to be run as a specific user. You'll be
better served looking at this, or asking in a CGI newsgroup:
<url:http://www.unixtools.org/cgiwrap/>
James
------------------------------
Date: Fri, 23 Apr 1999 19:23:47 GMT
From: scraig@my-dejanews.com
Subject: Re: child's output corrupted by parent's output
Message-Id: <7fqhbu$e1p$1@nnrp1.dejanews.com>
In article <KESEY.99Apr22223512@globe.ece.utexas.edu>,
kesey@globe.ece.utexas.edu (Kesey) wrote:
>
> Somehow the print statements of the parent are finding their way into
> the output of the child.
> parent_1 kidString = parent_1 parent_2 kid_output
> ^^^^^^^^^^^^^^^^^^^
This is normal behavior. At a fork, the child inherits the STDOUT and STDIN
of the parent, including any buffered output. This can mean some output is
printed twice. To avoid this, flush the output buffer just before the fork.
Perlfaq 5 has some info on this.
HTH
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 23 Apr 1999 18:18:14 GMT
From: mcti@my-dejanews.com
Subject: chomp-ing from the FRONT end
Message-Id: <7fqdh1$a72$1@nnrp1.dejanews.com>
is there an easy way to do the same as "chomp" or "chop" but have it remove a
character from the FRONT end of a string, rather than the back end?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 23 Apr 1999 12:26:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: chomp-ing from the FRONT end
Message-Id: <MPG.118a69447362723e989927@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7fqdh1$a72$1@nnrp1.dejanews.com> on Fri, 23 Apr 1999
18:18:14 GMT, mcti@my-dejanews.com <mcti@my-dejanews.com> says...
> is there an easy way to do the same as "chomp" or "chop" but have it remove a
> character from the FRONT end of a string, rather than the back end?
"chomp" and "chop" don't do the same things!
chop (remove the last character blindly):
substr($string, 0, 1) = "";
$string =~ s/.//s;
chomp (remove the substring $/ if it is at the end of the string):
substr($string, 0, length $/) = "" if index($string, $/) == 0;
$string =~ s%$/%%;
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 23 Apr 1999 19:17:42 GMT
From: Andrey Zmievski <zmievski@ispi.net>
Subject: Compiling perl regex lib into other progs
Message-Id: <7fqh0i$dks$1@nnrp1.dejanews.com>
Is it possible to take Perl regex library and use it for other programs? Has
anyone done it? I've looked at the code and it seems pretty much tied to the
Perl engine...
-Andrey
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 24 Apr 1999 02:28:54 +0800
From: Carfield Yim <carfield@polyu.hknet.com>
Subject: Different between recurrence and looping
Message-Id: <3720BBE6.C3DC5EAC@polyu.hknet.com>
It seen that looping can do the work of recurrence call, is there any
different other than concept? Why do we need to study more?
------------------------------
Date: Fri, 23 Apr 1999 19:32:09 GMT
From: vilo8720@my-dejanews.com
Subject: Encrypt/Decrypt
Message-Id: <7fqhrq$eje$1@nnrp1.dejanews.com>
Is there any encryption perl library (or any other utility for perl) to
encrypt data before storing them into file and then decrypt them after
reading them from file? I don't mean crypt() function because that let's you
only encrypt, there is no way of changing encrypted text with crypt() back to
original text. I mean some Encrypt/Decrypt system.
thanks
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 23 Apr 1999 19:35:20 GMT
From: vilo@commercialnetworks.com
Subject: Encrypt/Decrypt
Message-Id: <7fqi1o$emi$1@nnrp1.dejanews.com>
Is there any encryption perl library (or any other utility for perl) to
encrypt data before storing them into file and then decrypt them after
reading them from file? I don't mean crypt() function because that let's you
only encrypt, there is no way of changing encrypted text with crypt() back to
original text. I mean some Encrypt/Decrypt system.
thanks
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 23 Apr 1999 14:02:49 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: FAQ 3.26: Why don't perl one-liners work on my DOS/Mac/VMS system?
Message-Id: <1dqly44.1im9isu1lfyuooN@[192.168.0.1]>
Tom Christiansen <perlfaq-suggestions@perl.com> wrote:
> Why don't perl one-liners work on my DOS/Mac/VMS system?
>
<snip>
>
> # Mac
> print "Hello world\n"
> (then Run "Myscript" or Shift-Command-R)
<snip>
> Under the Mac, it depends which environment you are using. The
> MacPerl shell, or MPW, is much like Unix shells in its support for
> several quoting variants, except that it makes free use of the
> Mac's non-ASCII characters as control characters.
You can run one-liners in the MacPerl standalone application in their
original form. Just press Command-1 (or select "One Liner" from the
Script menu) and type or paste it in.
--
Kevin Reid: | Macintosh:
"I'm me." | Think different.
------------------------------
Date: Fri, 23 Apr 1999 11:21:13 -0700
From: Greg McCann <gregm@well.com>
Subject: Re: Generating a unique string for order number
Message-Id: <3720BA19.CCAFE84D@well.com>
Benjamin Franz wrote:
> >Yes, process ids repeat, but (except in science fiction and on horribly
> >misconfigured machines) time doesn't. Two things may be submitted at
> >the same time, but then their PID would be different. Two things may be
> >submitted with the same PID, but then their time would be different. So
> >concatenating time and process id would give a unique id wouldn't it?
>
> Yes, with a caveat. If your machine is fast enough and busy enough to
> cycle its complete PID space in less than one wall clock second and you
> use a low resolution time source such as 'time', you could get the same
> PID and time for two difference processes. But you are not likely to
> encounter a situation like that in practice.
Not on *nix. However on NT, PIDs are not consecutive numbers. NT has a scheme
(incomprehensible to me) by which PIDs are not consecutive and are recycled
rather quickly. For example if I run...
perl -e "print $$"
from the command prompt on my NT, the PIDs repeat a predictable sequence after a
mere 17 (seventeen) iterations! On a busy server it is quite conceivable that
this could happen within one second.
However, this is just my development system and the final application will be
deployed on *nix. So what I have tentatively decided on is...
# generate unique order number
my $order_time = time;
my $order_pid = '0' x (5 - length($$)) . $$;
my $order_no = '0' x (10 - length($order_time)) . $order_time;
$order_no = substr($order_no, 0, 5) . '-' . substr($order_no, 5, 5) . '-' .
$order_pid;
BTW, I'm assuming that PIDs do not get larger than 5 digits - is that safe?
Greg
------------------------------
Date: 23 Apr 1999 18:42:18 GMT
From: GoodfriB@jntf.osd.mil (James R. Goodfriend)
Subject: Re: Help! Error message when using C-comment stripper from perlfaq
Message-Id: <7fqeua$ftl$1@news1.rmi.net>
In article <7fmbin$7gt$4@client2.news.psi.net>, abigail@fnx.com says...
>Well, the program in the faq is only 4 lines long. So, how are we supposed
>to know what those other 15 lines are doing? If you can't be bothered
>to post code, yet insist on quoting error messages that reference line
>numbers, don't expect much help. The ESP modules are still in a very
>alpha state.
I'm feeling less addled/tired/lazy this morning and I'll copy over the
relevant routine this time. The errors are showing up on the s/// line...I
suspect perl is objecting to the backreference ($2) but I don't know how to
make sure the variable isn't null/suppress the message. The code gives the
desired result...it's the warning I'm worried about
sub stripCcomments {
# accepts a reference to a filehandle and returns an array of the lines in
# that file, with C comments stripped.
my $cfile = shift;
undef $/;
$_ = <$cfile>;
s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\]*'|\n+|.[^/"'\\]*)#
$2#g;
$/ = "\n";
my $lines = split /\n/;
return @lines;
}
...hope that's enough code that soembody can help me.
-Bob
------------------------------
Date: Fri, 23 Apr 1999 12:18:33 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help! Error message when using C-comment stripper from perlfaq
Message-Id: <MPG.118a67606152ac08989926@nntp.hpl.hp.com>
In article <7fqeua$ftl$1@news1.rmi.net> on 23 Apr 1999 18:42:18 GMT,
James R. Goodfriend <GoodfriB@jntf.osd.mil> says...
...
> s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\]*'|\n+|.[^/"'\\]*)#
> $2#g;
Ah. It is obvious. If you match any of the alternatives except the
second one, $2 will be undefined.
You might want to think about the special variable $+, which is useful
in some such situations.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 23 Apr 1999 17:51:23 GMT
From: mclaughlinj@leaders.ccl.org
Subject: Newbie - Perl - Registry -NT
Message-Id: <7fqbup$8ra$1@nnrp1.dejanews.com>
phew...
I need to update 300 workstation registry values. I wrote a perl script that
updates the registry on my local machine just fine. Is there a way I can
update the 300 user workstation via Perl? My confusion is, they don't have
Perl on their local machine. If you could point me to any documentation I'd
appreciate. I have looked and search the net but did not find anything I
understood. I'd like to hook the login script for all users...
-or- how does one update remote registries via perl
thanks, jeff
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 23 Apr 1999 18:17:58 GMT
From: scraig@my-dejanews.com
Subject: Re: Newbie Question: While versus Until
Message-Id: <7fqdgi$a6o$1@nnrp1.dejanews.com>
In article <PQ0U2.266$5z.95073@WReNphoon1-bin>,
stephen@oasis.novia.net (stephen) wrote:
> until ($b = 0) {
^^^
> print $a[$b-1];
> $b--;
> }
>
> What I got was an infinite loop.
You meant to use $b == 0, which tests if $b is 0.
Instead, $b = 0 sets $b to 0, and returns a false value. The until loop keeps
going because the condition is never true.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 23 Apr 1999 12:01:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie Question: While versus Until
Message-Id: <MPG.118a63699b033147989924@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7fqa6g$370$1@uwm.edu> on 23 Apr 1999 17:21:20 GMT, Thelma
Lubkin <thelma@alpha2.csd.uwm.edu> says...
> Larry Rosler <lr@hpl.hp.com> wrote:
> : In article <PQ0U2.266$5z.95073@WReNphoon1-bin> on Fri, 23 Apr 1999
> : 08:01:36 -0800, stephen <stephen@oasis.novia.net> says...
...
> :> until ($b = 0) {
>
> : What warning did you get about this line of code? Oh, you didn't have
> : warnings enabled? Then do it again, now -- and every time!
>
> I ran this under perl -c, with -w and use strict both on, and I
> got a simple 'syntax ok' message with no warnings--it did of course go
> into an infinite loop if I tried to execute. Strange...
What perl version didn't warn? I just rechecked this under 5.002,
5.003, 5.004_03, and 5.005_03, and each one warned about the use of a
constant in a conditional context.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 23 Apr 1999 18:36:40 GMT
From: "Jalil Feghhi" <jalil@corp.home.net>
Subject: Perl and ASP
Message-Id: <924892600.94768@zeppelin.svr.home.net>
Is it possible to use Perl (instead of VBScript or JScript) in ASP pages?
-Jalil
------------------------------
Date: Fri, 23 Apr 1999 14:32:12 -0500
From: Wesley Bohannon <rxmx80@email.sps.mot.com>
Subject: Perl CGI and HTML...
Message-Id: <3720CA79.1D71ADB2@email.sps.mot.com>
How do you send the following HTML code from a Perl CGI and have the
browser execute it rather than just print it?
<!--#include virtual="/Engineering/Test/testengfooter.txt"-->
This is a common file for our web page format and I can't figure out why
it works for standard HTML, but doesn't work when it is sent thru CGI??
Any help out there?
Thanks,
Wesley Bohannon.
------------------------------
Date: Fri, 23 Apr 1999 11:02:22 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl Debugger
Message-Id: <3720B5AE.93E3307E@mail.cor.epa.gov>
Paul Mabley wrote:
>
> Why can't I view the values of 'my' variables in the perl debugger? My
> understanding was that you simply entered X <var_name> at the prompt.
> I have searched around for info on this problem but all I could find was a
> brief mention of a bug in the perl5 debugger. Is this a bug and, if it is,
> is there a work-around?
First, this is not a bug in the debugger.
Second, you are confusing what `my' does. X [vars] is the
same as saying V _currentpackage_ [vars] . But `my' doesn't
put variables into the symbol table of the current package.
It *really* localizes them.
OTOH, local() does. Confusing, ain't it? :-)
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Fri, 23 Apr 1999 18:47:54 GMT
From: scraig@my-dejanews.com
Subject: Re: printf problem
Message-Id: <7fqf8o$buf$1@nnrp1.dejanews.com>
In article <372051E1.D3D038A1@comptel.com>,
Mika Lehto <mika.lehto@comptel.com> wrote:
> ....
> $string_format = "Values: %s %s %s\n";
> $string_values = "\$values[0], \$values[1], \$values[2]";
>
> @values = unpack(a1a2a3, $row);
> ....
>
> Question is that how can I print the contents of the $values[0],
> $values[1] and $values[2] with using variables $string_format and
> $string_values ?
Why use $string_values at all?
printf $string_format, @values;
or even
printf $string_format, unpack "a1a2a3", $row;
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 23 Apr 1999 09:04:21 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: printf problem
Message-Id: <l4rpf7.b39.ln@magna.metronet.com>
Mika Lehto (mika.lehto@comptel.com) wrote:
: $string_format = "Values: %s %s %s\n";
: $string_values = "\$values[0], \$values[1], \$values[2]";
: @values = unpack(a1a2a3, $row);
^^^^^^
^^^^^^ bareword!
: printf("$string_format", $string_values) does not work.
---------------------------
#!/usr/bin/perl -w
use strict;
my @values = unpack('a1a2a3', 'abbccc');
my $string_format = "Values: %s %s %s\n";
my @string_values = ($values[0], $values[1], $values[2]);
printf($string_format, @string_values);
---------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 23 Apr 1999 19:25:17 GMT
From: mrkn9715@my-dejanews.com
Subject: Server errors...please help
Message-Id: <7fqheo$e43$1@nnrp1.dejanews.com>
Getting the server error messages...CGIwrap Error: System Error: execv()
failed Error: No such file or directory (2)
I've tried everything ! Permissions set to 755 or 777. Check paths to perl.
The only script that actually works is one the ISP placed, but none of the
several scripts I used seem to work (one is even identical to the working
script).
I have gone through the code side by side with working script and non-working
script but STILL can't find the problem. What is a Wrap error ?
Any help is appriciated !
Please reply direct back to me.
Ken Newman
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 23 Apr 1999 18:23:30 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: setuid security bypass busted in 5.005_02?
Message-Id: <7fqdr2$k15$1@pegasus.csx.cam.ac.uk>
Kitt Hirasaki <kitt@pixar.com> wrote:
>
>system("echo"); # Chokes -- says $ENV{PATH} insecure!
It doesn't do that for me. What is the *exact* error message?
What are the details of your platform (perl -V) ?
What other environment variables do you have set?
Mike Guy
------------------------------
Date: Fri, 23 Apr 1999 18:45:40 GMT
From: kkling@tnsi.com (Kent Kling)
Subject: Sorting Array of Arrays
Message-Id: <3720bdb4.1511936@proxy.reston.tnsi.com>
I have the following code:
#!/usr/bin/perl -w
open( FD, "</u/kkling/myfile.txt");
$row=0;
while ( <FD> )
{
$row++;
my @line = split;
@LoL[$row] = [ @line ];
}
/u/kkling/myfile.txt looks like
7033250001 100 123
7031239900 56 23
7021231231 123 190
5141231233 12 723
2121212809 912 542
how can I sort these? Do anyone have a clue how I can use sort on a
List of Lists ( Array of Arrays ) @LoL ?
Kent Kling
------------------------------
Date: Fri, 23 Apr 1999 19:09:35 GMT
From: cryptoman@my-dejanews.com
Subject: Truncate doesn't work
Message-Id: <7fqghb$d39$1@nnrp1.dejanews.com>
Hi,
What I am trying to do is remove some lines in a text's file but it doesn't
work. I am using Perl 5.005_01 on Unix.The script I wrote is:
Open (Test, "+<test.txt") or die can't open test: $!";
...
$LineAddr = tell(Test);
truncate (Test, $LineAddr);
It works but at the next line of the line deleted it leavez some strange
caracters: @@@@@@@@@@@@@@@@@@. And the number of that caracter (@) depenses
on number of caracter you deleted. Isn't it strange?
I would like to know it is a bug from function "truncate" or it is normal. If
you can suggest a solution or you could tell me which module could do my work
it will be very appreciated.
Thanks!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 23 Apr 1999 14:45:36 -0500
From: gazelle@yin.interaccess.com (Kenny McCormack)
Subject: Upgrading Bash: Is it a good idea? Also, some shell/perl questions...
Message-Id: <7fqil0$q13$1@yin.interaccess.com>
My initial question is this: Red Hat 5.2 ships with bash 1.14. This
is an old version and has a bug in it, as described below. However, I
am leary of upgrading (to 2.x) because of all the things that may
depend on the shell. I.e., upgrading the shell is kind of like
upgrading the libc (e.g., from libc5 to libc6) - you don't know what
you'll break in the process. So, my question is: Can I do this?
Should I worry?
Now, consider the following sh/bash script:
#!/bin/sh
# Test something related to bash's handling of interrupts while
# running an external program that does its own interrupt handling.
trap "echo Got it!" 2
perl -e 'system "cat";print "Perl exiting...\n";'
echo done
Observe that Perl internally sets up a handler for SIGINT when running
the system ... command. When I run the above script, I type in a few
lines to the 'cat' command and they are echoed back, then I hit ^C.
When I run this under bash 1.14, the 'echo done' executes, but the
'echo Got it!' does not. Under bash 2.0, I get "Got it!", then "done".
In both cases, I get "Perl exiting" (before either of the other strings).
What this shows is that the SIGINT is not delivered to the shell when
the shell is running a foreground task that does sets up an interrupt
handler (in bash 1.14).
Again, I would like to upgrade to bash 2.0 to fix this, but am "scared to".
Also, here is a Perl question (hence the cross-post):
Along the way of testing this, I tried the following Perl script:
#!/usr/bin/perl
sub handler {
local($sig = $g) = $
print "Caught a SIG$sig - shutting down\n";
exit 0;
}
$SIG{'INT'}
$SIG = 'handler';
system 'cat';
print "Perl exiting...\n";
I would like my handler to be called when the user ^C's the cat program.
Is this possible?
------------------------------
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 5466
**************************************