KILL INT can not wake up $SIG{INT}



  • 1. There is a error in a simple source
    Hi, I'm new to perl. The following code is wrong., and I can not spot it. Any suggestion? Thx. #!/usr/bin/perl -w &init_words (); sub init_words{ while ( $filename=<*.secret> ){ open( WORDLIST, $filename ) || die "Can not open $filename: $!"; if ( -M WORDLIST < 7 ){ while ( $name = <WORDLIST> ){ chmop( $name ); $word = <WORDLIST>; chmop( $word ); $word{$name} = $word; } } else{ rename( $filename, "$filename.old" ) || die "Can not rename $filename to $filename.old."; } close( WORDLIST ); } }
  • 2. Win32::EventLog does not die
    The following does not die when $server does not exist. An ideas on what I am doing wrong or what I need to change? use strict; use Win32::EventLog; my $logtype = 'Security'; my $server = 'aserq4fc93'; my $EventLog = Win32::EventLog->new( $logtype, $server ) || die "Cannot open EventLog\n"; Thanks

KILL INT can not wake up $SIG{INT}

Postby kelvin.wu » Tue, 21 Dec 2004 14:36:35 GMT

Hi list,

Anyone has such experience? KILL INT pid cannot wake up $SIG{INT}  sub{}.

my code is like;

$SIG{INT} = sub {#load pm}

$SIG{ALRM} = sub {print "Driver $pm is going to sleep... bye.\n"; exit;};

the pm actually has a system call to execute something
sub xxx {


my $tmp = kill "INT", $pid; ## it returns number of processes, eg: 1
cannot wake up the $SIG{INT}  at all after $SIG{ALRM} has been executed.

does system call cause the problem?


Re: KILL INT can not wake up $SIG{INT}

Postby mgoland » Wed, 22 Dec 2004 06:12:04 GMT

----- Original Message -----
From: Kelvin Wu < XXXX@XXXXX.COM >
Date: Monday, December 20, 2004 0:36 am
Subject: KILL INT can not wake up $SIG{INT}


Only on Window's, but then again I don't think signals are a native implementation in WinPerl.

Well sure, in example you have provided your entire program will exit after SIGALRM.

It shouldn't. Post more of your code if you need more help.

mark G.

Similar Threads:

1.catching multiple $SIG{INT}


in the beginning of the script, i open and read from a large text
file. i want to make this uninterruptable in order to prevent data
corruption if someone types ctrl-c.

i do this in the read subroutine by:
    local $SIG{INT} = "IGNORE";

this works if the person only hits ctrl-c ONCE, but the ctrl-c is
executed immediately if the signal is sent again (i do reset the
signal to DEFAULT after the file is closed).

so my questions is:

    how can perl trap multiple signals, interrupt in particular? 

i am working with 2000+ lines of code with a lot of modules. 

i'm grateful for any help!

_kati wilson

2.Why char** dynamic_string_array(int ROWS, int SIZE) doesn't work properly?

Hi,please help...
It works fine when I define a 2-D array like char code[ROWS][SIZE].
But it won't work when I try to define the array dynamically using a
function. It just crashes.
Does anyone know why?
The compiler i'm using is Dev c++.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int file_length(FILE *file);
void down_string(char *p);
char* issubstring(char *str1,char *str2);
char** dynamic_string_array(int ROWS, int SIZE);

int main(void)
  int row,n,i,coursefound=0,ROWS,SIZE,test;

  FILE *datafile;
  datafile=fopen("3rdyear.csv", "rb");

  printf("Has %d lines\n",ROWS);

  char **Code,**Course,**ClassSize,**Time1,**Time2,**Room,c;
  char search[30];


  for (row=0; row <ROWS; row++) {
  test=fscanf(datafile, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^\n]\n",

  printf("row=%d,scanf converted %d (%s,%s,%s,%s,%s,%s)\n",
  row, test,


printf("Please enter a name\n>");

  for(i=1; i<ROWS; i++) {
      if(issubstring(Course[i],search))  {
                printf("Course %s found!!\nTime 1 is %s\nTime2 is

   if(coursefound==0) printf("No such Course!.\n");



void down_string(char *p)  //turns uppercase letters in a string to
    int i;
        if((p[i]>='A')&&(p[i]<='Z')) p[i]+=32;

char* issubstring(char *str1,char *str2)  //checks if string2 is a
substring of string2
    char tmp1[30],tmp2[30];
    strcpy(tmp1, str1);
    strcpy(tmp2, str2);
    down_string(tmp1);  //turn it to lowercase
    return (strstr(tmp1, tmp2));


char** dynamic_string_array(int ROWS, int SIZE)
  char **array;
  int i;
  array=(char**) malloc(ROWS*sizeof(char));
     array[i]=(char *) malloc(SIZE*sizeof(char));

  return array;

int file_length(FILE *file)
  int lines;
  char dummy[100];


  while( fgets(dummy, 100, file) != NULL)



3.will Hyperlinks work on a CD when created from files stored on Int

relative addressing,(\subdirectory\subdirectory\file.nam) or put them in 
the same folder (file.nam)

mgrady wrote:

> How do you create a hyperlink in (ppt / word) that links to another file and 
> document, when all of the final documents will be stored and accessed from a 
> CD? 

4.pass int* to perl


I need to call perl from c.
To pass an integer, I use to make a newSViv.
How do I do to pass a int* ?
Should I just cast the int* to int ans passed as an SV ?
in perl I need to get the value by $$var.


  Patrick DUPR                      |   |
  Department of Chemistry            |   |    Phone: (44)-(0)-1904-434384
  The University of York             |   |    Fax:   (44)-(0)-1904-432516
  Heslington                         |   |
  York YO10 5DD  United Kingdom      |   |    email:  XXXX@XXXXX.COM 

5.signal processing INT or TERM

perl 5.8.2
OS: AIX fully POSIX compliant

my script moves files from one dir to another.
When I want my script to stop, should I pass it along the signal INT
or TERM?

INT just interrupts the script.  It finishes whatever it's processing
and then it's done.

TERM on the other hand, just sends a TERMination signal, waits a few
seconds, then KILLs the program.  TERM is more common I guess when
starting/stopping unix shell scripts in the init dir.

My fear is that if I pass the TERM signal, maybe the system will chop
off the files that are being moved on the fly.  The "few seconds" are
unpredictable in value at least on my system. So the system might say
'it's been too long, let's kill it."

Any thoughts? Is there a "perlish" way to do it?

6. packing int to hex

7. maximum int value

8. Storing a long value in an int

Return to PERL


Who is online

Users browsing this forum: No registered users and 92 guest