This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
This is my patch patch.1g for perl5.001.
[perl5.git] / ext / Socket / Socket.pm
CommitLineData
a0d0e21e
LW
1package Socket;
2use Carp;
3
4require Exporter;
5require AutoLoader;
6require DynaLoader;
fec02dd3 7@ISA = qw(Exporter DynaLoader);
a0d0e21e
LW
8@EXPORT = qw(
9 AF_802
10 AF_APPLETALK
11 AF_CCITT
12 AF_CHAOS
13 AF_DATAKIT
14 AF_DECnet
15 AF_DLI
16 AF_ECMA
17 AF_GOSIP
18 AF_HYLINK
19 AF_IMPLINK
20 AF_INET
21 AF_LAT
22 AF_MAX
23 AF_NBS
24 AF_NIT
25 AF_NS
26 AF_OSI
27 AF_OSINET
28 AF_PUP
29 AF_SNA
30 AF_UNIX
31 AF_UNSPEC
32 AF_X25
33 MSG_DONTROUTE
34 MSG_MAXIOVLEN
35 MSG_OOB
36 MSG_PEEK
37 PF_802
38 PF_APPLETALK
39 PF_CCITT
40 PF_CHAOS
41 PF_DATAKIT
42 PF_DECnet
43 PF_DLI
44 PF_ECMA
45 PF_GOSIP
46 PF_HYLINK
47 PF_IMPLINK
48 PF_INET
49 PF_LAT
50 PF_MAX
51 PF_NBS
52 PF_NIT
53 PF_NS
54 PF_OSI
55 PF_OSINET
56 PF_PUP
57 PF_SNA
58 PF_UNIX
59 PF_UNSPEC
60 PF_X25
61 SOCK_DGRAM
62 SOCK_RAW
63 SOCK_RDM
64 SOCK_SEQPACKET
65 SOCK_STREAM
66 SOL_SOCKET
67 SOMAXCONN
68 SO_ACCEPTCONN
69 SO_BROADCAST
70 SO_DEBUG
71 SO_DONTLINGER
72 SO_DONTROUTE
73 SO_ERROR
74 SO_KEEPALIVE
75 SO_LINGER
76 SO_OOBINLINE
77 SO_RCVBUF
78 SO_RCVLOWAT
79 SO_RCVTIMEO
80 SO_REUSEADDR
81 SO_SNDBUF
82 SO_SNDLOWAT
83 SO_SNDTIMEO
84 SO_TYPE
85 SO_USELOOPBACK
86);
87
88sub AUTOLOAD {
a0d0e21e
LW
89 local($constname);
90 ($constname = $AUTOLOAD) =~ s/.*:://;
91 $val = constant($constname, @_ ? $_[0] : 0);
92 if ($! != 0) {
93 if ($! =~ /Invalid/) {
94 $AutoLoader::AUTOLOAD = $AUTOLOAD;
95 goto &AutoLoader::AUTOLOAD;
96 }
97 else {
98 ($pack,$file,$line) = caller;
99 croak "Your vendor has not defined Socket macro $constname, used";
100 }
101 }
102 eval "sub $AUTOLOAD { $val }";
103 goto &$AUTOLOAD;
104}
105
748a9306
LW
106
107# pack a sockaddr_in structure for use in bind() calls.
108# (here to hide the 'S n C4 x8' magic from applications)
109sub sockaddr_in{
110 my($af, $port, @quad) = @_;
111 my $pack = 'S n C4 x8'; # lookup $pack from hash using $af?
112 pack($pack, $af, $port, @quad);
113}
114
115
a0d0e21e
LW
116bootstrap Socket;
117
118# Preloaded methods go here. Autoload methods go after __END__, and are
119# processed by the autosplit program.
120
1211;
122__END__