summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-extended/mime-construct/files/Signal.pm
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-extended/mime-construct/files/Signal.pm')
-rw-r--r--meta-networking/recipes-extended/mime-construct/files/Signal.pm132
1 files changed, 0 insertions, 132 deletions
diff --git a/meta-networking/recipes-extended/mime-construct/files/Signal.pm b/meta-networking/recipes-extended/mime-construct/files/Signal.pm
deleted file mode 100644
index 9280e88681..0000000000
--- a/meta-networking/recipes-extended/mime-construct/files/Signal.pm
+++ /dev/null
@@ -1,132 +0,0 @@
1# $Id: Signal.pm,v 1.4 1998-10-27 16:16:13-05 roderick Exp $
2#
3# Copyright (c) 1997 Roderick Schertler. All rights reserved. This
4# program is free software; you can redistribute it and/or modify it
5# under the same terms as Perl itself.
6
7package IPC::Signal;
8
9use 5.003_94; # __PACKAGE__
10use strict;
11use vars qw($VERSION @ISA @EXPORT_OK $AUTOLOAD %Sig_num @Sig_name);
12
13require Exporter;
14
15$VERSION = '1.00';
16@ISA = qw(Exporter);
17@EXPORT_OK = qw(sig_num sig_name sig_translate_setup %Sig_num @Sig_name);
18%Sig_num = ();
19@Sig_name = ();
20
21sub sig_num ($);
22sub sig_name ($);
23
24sub sig_translate_setup () {
25 return if %Sig_num && @Sig_name;
26
27 require Config;
28
29 # In 5.005 the sig_num entries are comma separated and there's a
30 # trailing 0.
31 my $num = $Config::Config{'sig_num'};
32 if ($num =~ s/,//g) {
33 $num =~ s/\s+0$//;
34 }
35
36 my @name = split ' ', $Config::Config{'sig_name'};
37 my @num = split ' ', $num;
38
39 @name or die 'No signals defined';
40 @name == @num or die 'Signal name/number mismatch';
41
42 @Sig_num{@name} = @num;
43 keys %Sig_num == @name or die 'Duplicate signal names present';
44 for (@name) {
45 $Sig_name[$Sig_num{$_}] = $_
46 unless defined $Sig_name[$Sig_num{$_}];
47 }
48}
49
50# This autoload routine just is just for sig_num() and sig_name(). It
51# calls sig_translate_setup() and then snaps the real function definitions
52# into place.
53
54sub AUTOLOAD {
55 if ($AUTOLOAD ne __PACKAGE__ . '::sig_num'
56 && $AUTOLOAD ne __PACKAGE__ . '::sig_name') {
57 require Carp;
58 Carp::croak("Undefined subroutine &$AUTOLOAD called");
59 }
60 sig_translate_setup;
61 *sig_num = sub ($) { $Sig_num{$_[0]} };
62 *sig_name = sub ($) { $Sig_name[$_[0]] };
63 goto &$AUTOLOAD;
64}
65
661
67
68__END__
69
70=head1 NAME
71
72IPC::Signal - Utility functions dealing with signals
73
74=head1 SYNOPSIS
75
76 $number = sig_num $name;
77 $name = sig_name $number;
78
79 sig_translate_setup;
80 $number = $Sig_num{$name};
81 $name = $Sig_name[$number];
82
83=head1 DESCRIPTION
84
85This module contains utility functions for dealing with signals.
86
87Nothing is exported by default.
88
89=over
90
91=item B<sig_num> I<chopped-signal-name>
92
93Returns the signal number of the signal whose name (sans C<SIG>) is
94I<chopped-signal-name>, or undef if there is no such signal.
95
96This function is prototyped to take a single scalar argument.
97
98=item B<sig_name> I<signal-number>
99
100Returns the chopped signal name (like C<HUP>) of signal number
101I<signal-number>, or undef if there is no such signal.
102
103This function is prototyped to take a single scalar argument.
104
105=item B<sig_translate_setup>
106
107If you want to use the @Sig_name and %Sig_num variables directly you must
108call B<sig_translate_setup> to initialize them. This isn't necessary if
109you only use the function interfaces sig_name() and sig_num().
110
111This function is prototyped to take no arguments.
112
113=item B<%Sig_num>
114
115A hash with chopped signal name keys (like C<HUP>) and integer signal
116number values.
117
118=item B<@Sig_name>
119
120An array mapping signal numbers to chopped signal names (like C<HUP>).
121
122=back
123
124=head1 AUTHOR
125
126Roderick Schertler <F<roderick@argon.org>>
127
128=head1 SEE ALSO
129
130perl(1).
131
132=cut