← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 05.Domain_and_Item.t
  Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:23:14 2010

File /usr/local/lib/perl5/5.10.1/darwin-2level/IO/Socket.pm
Statements Executed 354
Statement Execution Time 3.53ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2111.87ms75.6msIO::Socket::::connectIO::Socket::connect
111769µs1.94msIO::Socket::::BEGIN@12IO::Socket::BEGIN@12
8221358µs380µsIO::Socket::::peernameIO::Socket::peername
422186µs186µsIO::Socket::::CORE:connectIO::Socket::CORE:connect (opcode)
63286µs130µsIO::Socket::::blockingIO::Socket::blocking
21277µs77µsIO::Socket::::CORE:socketIO::Socket::CORE:socket (opcode)
21169µs181msIO::Socket::::newIO::Socket::new
21144µs121µsIO::Socket::::socketIO::Socket::socket
22223µs1.89msIO::Socket::::importIO::Socket::import
21223µs23µsIO::Socket::::CORE:getpeernameIO::Socket::CORE:getpeername (opcode)
11121µs52µsIO::Socket::::BEGIN@11IO::Socket::BEGIN@11
1119µs39µsIO::Socket::::BEGIN@13IO::Socket::BEGIN@13
1119µs22µsIO::Socket::::BEGIN@17IO::Socket::BEGIN@17
1118µs22µsIO::Socket::::BEGIN@16IO::Socket::BEGIN@16
1116µs9µsIO::Socket::::BEGIN@14IO::Socket::BEGIN@14
2226µs6µsIO::Socket::::register_domainIO::Socket::register_domain
1124µs4µsIO::Socket::::CORE:packIO::Socket::CORE:pack (opcode)
0000s0sIO::Socket::::acceptIO::Socket::accept
0000s0sIO::Socket::::atmarkIO::Socket::atmark
0000s0sIO::Socket::::bindIO::Socket::bind
0000s0sIO::Socket::::closeIO::Socket::close
0000s0sIO::Socket::::configureIO::Socket::configure
0000s0sIO::Socket::::connectedIO::Socket::connected
0000s0sIO::Socket::::getsockoptIO::Socket::getsockopt
0000s0sIO::Socket::::listenIO::Socket::listen
0000s0sIO::Socket::::protocolIO::Socket::protocol
0000s0sIO::Socket::::recvIO::Socket::recv
0000s0sIO::Socket::::sendIO::Socket::send
0000s0sIO::Socket::::setsockoptIO::Socket::setsockopt
0000s0sIO::Socket::::shutdownIO::Socket::shutdown
0000s0sIO::Socket::::sockdomainIO::Socket::sockdomain
0000s0sIO::Socket::::socketpairIO::Socket::socketpair
0000s0sIO::Socket::::socknameIO::Socket::sockname
0000s0sIO::Socket::::sockoptIO::Socket::sockopt
0000s0sIO::Socket::::socktypeIO::Socket::socktype
0000s0sIO::Socket::::timeoutIO::Socket::timeout
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# IO::Socket.pm
2#
3# Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved.
4# This program is free software; you can redistribute it and/or
5# modify it under the same terms as Perl itself.
6
7package IO::Socket;
8
9123µsrequire 5.006;
10
11355µs284µs
# spent 52µs (21+31) within IO::Socket::BEGIN@11 which was called # once (21µs+31µs) by IO::Socket::INET::BEGIN@11 at line 11
use IO::Handle;
# spent 52µs making 1 call to IO::Socket::BEGIN@11 # spent 31µs making 1 call to Exporter::import
123205µs32.60ms
# spent 1.94ms (769µs+1.17) within IO::Socket::BEGIN@12 which was called # once (769µs+1.17ms) by IO::Socket::INET::BEGIN@11 at line 12
use Socket 1.3;
# spent 1.94ms making 1 call to IO::Socket::BEGIN@12 # spent 631µs making 1 call to Exporter::import # spent 32µs making 1 call to UNIVERSAL::VERSION
13322µs269µs
# spent 39µs (9+30) within IO::Socket::BEGIN@13 which was called # once (9µs+30µs) by IO::Socket::INET::BEGIN@11 at line 13
use Carp;
# spent 39µs making 1 call to IO::Socket::BEGIN@13 # spent 30µs making 1 call to Exporter::import
14333µs212µs
# spent 9µs (6+3) within IO::Socket::BEGIN@14 which was called # once (6µs+3µs) by IO::Socket::INET::BEGIN@11 at line 14
use strict;
# spent 9µs making 1 call to IO::Socket::BEGIN@14 # spent 3µs making 1 call to strict::import
151800nsour(@ISA, $VERSION, @EXPORT_OK);
16320µs236µs
# spent 22µs (8+14) within IO::Socket::BEGIN@16 which was called # once (8µs+14µs) by IO::Socket::INET::BEGIN@11 at line 16
use Exporter;
# spent 22µs making 1 call to IO::Socket::BEGIN@16 # spent 14µs making 1 call to Exporter::import
1731.67ms235µs
# spent 22µs (9+13) within IO::Socket::BEGIN@17 which was called # once (9µs+13µs) by IO::Socket::INET::BEGIN@11 at line 17
use Errno;
# spent 22µs making 1 call to IO::Socket::BEGIN@17 # spent 13µs making 1 call to Exporter::import
18
19# legacy
20
211600nsrequire IO::Socket::INET;
221120µsrequire IO::Socket::UNIX if ($^O ne 'epoc' && $^O ne 'symbian');
23
24110µs@ISA = qw(IO::Handle);
25
261300ns$VERSION = "1.31";
27
281600ns@EXPORT_OK = qw(sockatmark);
29
30
# spent 1.89ms (23µs+1.87) within IO::Socket::import which was called 2 times, avg 946µs/call: # once (16µs+1.22ms) by IO::Socket::UNIX::BEGIN@11 at line 11 of IO/Socket/UNIX.pm # once (7µs+653µs) by IO::Socket::INET::BEGIN@11 at line 11 of IO/Socket/INET.pm
sub import {
3122µs my $pkg = shift;
3227µs if (@_ && $_[0] eq 'sockatmark') { # not very extensible but for now, fast
33 Exporter::export_to_level('IO::Socket', 1, $pkg, 'sockatmark');
34 } else {
3522µs my $callpkg = caller;
3624µs252µs Exporter::export 'Socket', $callpkg, @_;
# spent 52µs making 2 calls to Exporter::export, avg 26µs/call
37 }
38}
39
40
# spent 181ms (69µs+181) within IO::Socket::new which was called 2 times, avg 90.7ms/call: # 2 times (69µs+181ms) by IO::Socket::INET::new at line 37 of IO/Socket/INET.pm, avg 90.7ms/call
sub new {
41211µs my($class,%arg) = @_;
42217µs247µs my $sock = $class->SUPER::new();
# spent 47µs making 2 calls to IO::Handle::new, avg 23µs/call
43
44215µs4169µs $sock->autoflush(1);
# spent 156µs making 2 calls to IO::Handle::autoflush, avg 78µs/call # spent 13µs making 2 calls to SelectSaver::DESTROY, avg 6µs/call
45
4625µs ${*$sock}{'io_socket_timeout'} = delete $arg{Timeout};
47
48222µs2181ms return scalar(%arg) ? $sock->configure(\%arg)
# spent 181ms making 2 calls to Net::HTTP::configure, avg 90.6ms/call
49 : $sock;
50}
51
521200nsmy @domain2pkg;
53
54
# spent 6µs within IO::Socket::register_domain which was called 2 times, avg 3µs/call: # once (3µs+0s) by LWP::Protocol::implementor at line 22 of IO/Socket/INET.pm # once (3µs+0s) by IO::Socket::INET::BEGIN@11 at line 18 of IO/Socket/UNIX.pm
sub register_domain {
5522µs my($p,$d) = @_;
56211µs $domain2pkg[$d] = $p;
57}
58
59sub configure {
60 my($sock,$arg) = @_;
61 my $domain = delete $arg->{Domain};
62
63 croak 'IO::Socket: Cannot configure a generic socket'
64 unless defined $domain;
65
66 croak "IO::Socket: Unsupported socket domain"
67 unless defined $domain2pkg[$domain];
68
69 croak "IO::Socket: Cannot configure socket in domain '$domain'"
70 unless ref($sock) eq "IO::Socket";
71
72 bless($sock, $domain2pkg[$domain]);
73 $sock->configure($arg);
74}
75
76
# spent 121µs (44+77) within IO::Socket::socket which was called 2 times, avg 61µs/call: # 2 times (44µs+77µs) by IO::Socket::INET::configure at line 180 of IO/Socket/INET.pm, avg 61µs/call
sub socket {
7724µs @_ == 4 or croak 'usage: $sock->socket(DOMAIN, TYPE, PROTOCOL)';
7824µs my($sock,$domain,$type,$protocol) = @_;
79
80294µs277µs socket($sock,$domain,$type,$protocol) or
# spent 77µs making 2 calls to IO::Socket::CORE:socket, avg 39µs/call
81 return undef;
82
8324µs ${*$sock}{'io_socket_domain'} = $domain;
8422µs ${*$sock}{'io_socket_type'} = $type;
8522µs ${*$sock}{'io_socket_proto'} = $protocol;
86
8729µs $sock;
88}
89
90sub socketpair {
91 @_ == 4 || croak 'usage: IO::Socket->socketpair(DOMAIN, TYPE, PROTOCOL)';
92 my($class,$domain,$type,$protocol) = @_;
93 my $sock1 = $class->new();
94 my $sock2 = $class->new();
95
96 socketpair($sock1,$sock2,$domain,$type,$protocol) or
97 return ();
98
99 ${*$sock1}{'io_socket_type'} = ${*$sock2}{'io_socket_type'} = $type;
100 ${*$sock1}{'io_socket_proto'} = ${*$sock2}{'io_socket_proto'} = $protocol;
101
102 ($sock1,$sock2);
103}
104
105
# spent 75.6ms (1.87+73.7) within IO::Socket::connect which was called 2 times, avg 37.8ms/call: # 2 times (1.87ms+73.7ms) by IO::Socket::INET::connect at line 257 of IO/Socket/INET.pm, avg 37.8ms/call
sub connect {
10621µs @_ == 2 or croak 'usage: $sock->connect(NAME)';
10721µs my $sock = shift;
10822µs my $addr = shift;
10922µs my $timeout = ${*$sock}{'io_socket_timeout'};
1102300ns my $err;
1112400ns my $blocking;
112
113212µs253µs $blocking = $sock->blocking(0) if $timeout;
# spent 53µs making 2 calls to IO::Socket::blocking, avg 27µs/call
1142189µs2166µs if (!connect($sock, $addr)) {
# spent 166µs making 2 calls to IO::Socket::CORE:connect, avg 83µs/call
115228µs251µs if (defined $timeout && ($!{EINPROGRESS} || $!{EWOULDBLOCK})) {
# spent 51µs making 2 calls to Errno::FETCH, avg 26µs/call
1162193µs require IO::Select;
117
118211µs2135µs my $sel = new IO::Select $sock;
# spent 135µs making 2 calls to IO::Select::new, avg 68µs/call
119
12023µs undef $!;
121277µs673.0ms if (!$sel->can_write($timeout)) {
# spent 72.9ms making 2 calls to IO::Select::can_write, avg 36.4ms/call # spent 56µs making 2 calls to Errno::FETCH, avg 28µs/call # spent 20µs making 2 calls to IO::Socket::CORE:connect, avg 10µs/call
122 $err = $! || (exists &Errno::ETIMEDOUT ? &Errno::ETIMEDOUT : 1);
123 $@ = "connect: timeout";
124 }
125 elsif (!connect($sock,$addr) &&
126 not ($!{EISCONN} || ($! == 10022 && $^O eq 'MSWin32'))
127 ) {
128 # Some systems refuse to re-connect() to
129 # an already open socket and set errno to EISCONN.
130 # Windows sets errno to WSAEINVAL (10022)
131 $err = $!;
132 $@ = "connect: $!";
133 }
134 }
135 elsif ($blocking || !($!{EINPROGRESS} || $!{EWOULDBLOCK})) {
136 $err = $!;
137 $@ = "connect: $!";
138 }
139 }
140
14128µs250µs $sock->blocking(1) if $blocking;
# spent 50µs making 2 calls to IO::Socket::blocking, avg 25µs/call
142
1432900ns $! = $err if $err;
144
145210µs $err ? undef : $sock;
146}
147
148# Enable/disable blocking IO on sockets.
149# Without args return the current status of blocking,
150# with args change the mode as appropriate, returning the
151# old setting, or in case of error during the mode change
152# undef.
153
154
# spent 130µs (86+44) within IO::Socket::blocking which was called 6 times, avg 22µs/call: # 2 times (34µs+19µs) by IO::Socket::connect at line 113, avg 27µs/call # 2 times (35µs+16µs) by IO::Socket::connect at line 141, avg 25µs/call # 2 times (17µs+9µs) by LWP::Protocol::http::_new_socket at line 48 of LWP/Protocol/http.pm, avg 13µs/call
sub blocking {
15564µs my $sock = shift;
156
1576136µs644µs return $sock->SUPER::blocking(@_)
# spent 44µs making 6 calls to IO::Handle::blocking, avg 7µs/call
158 if $^O ne 'MSWin32';
159
160 # Windows handles blocking differently
161 #
162 # http://groups.google.co.uk/group/perl.perl5.porters/browse_thread/thread/b4e2b1d88280ddff/630b667a66e3509f?#630b667a66e3509f
163 # http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/ioctlsocket_2.asp
164 #
165 # 0x8004667e is FIONBIO
166 #
167 # which is used to set blocking behaviour.
168
169 # NOTE:
170 # This is a little confusing, the perl keyword for this is
171 # 'blocking' but the OS level behaviour is 'non-blocking', probably
172 # because sockets are blocking by default.
173 # Therefore internally we have to reverse the semantics.
174
175 my $orig= !${*$sock}{io_sock_nonblocking};
176
177 return $orig unless @_;
178
179 my $block = shift;
180
181 if ( !$block != !$orig ) {
182 ${*$sock}{io_sock_nonblocking} = $block ? 0 : 1;
183 ioctl($sock, 0x8004667e, pack("L!",${*$sock}{io_sock_nonblocking}))
184 or return undef;
185 }
186
187 return $orig;
188}
189
190
191sub close {
192 @_ == 1 or croak 'usage: $sock->close()';
193 my $sock = shift;
194 ${*$sock}{'io_socket_peername'} = undef;
195 $sock->SUPER::close();
196}
197
198sub bind {
199 @_ == 2 or croak 'usage: $sock->bind(NAME)';
200 my $sock = shift;
201 my $addr = shift;
202
203 return bind($sock, $addr) ? $sock
204 : undef;
205}
206
207sub listen {
208 @_ >= 1 && @_ <= 2 or croak 'usage: $sock->listen([QUEUE])';
209 my($sock,$queue) = @_;
210 $queue = 5
211 unless $queue && $queue > 0;
212
213 return listen($sock, $queue) ? $sock
214 : undef;
215}
216
217sub accept {
218 @_ == 1 || @_ == 2 or croak 'usage $sock->accept([PKG])';
219 my $sock = shift;
220 my $pkg = shift || $sock;
221 my $timeout = ${*$sock}{'io_socket_timeout'};
222 my $new = $pkg->new(Timeout => $timeout);
223 my $peer = undef;
224
225 if(defined $timeout) {
226 require IO::Select;
227
228 my $sel = new IO::Select $sock;
229
230 unless ($sel->can_read($timeout)) {
231 $@ = 'accept: timeout';
232 $! = (exists &Errno::ETIMEDOUT ? &Errno::ETIMEDOUT : 1);
233 return;
234 }
235 }
236
237 $peer = accept($new,$sock)
238 or return;
239
240 return wantarray ? ($new, $peer)
241 : $new;
242}
243
244sub sockname {
245 @_ == 1 or croak 'usage: $sock->sockname()';
246 getsockname($_[0]);
247}
248
249
# spent 380µs (358+23) within IO::Socket::peername which was called 82 times, avg 5µs/call: # 41 times (267µs+23µs) by IO::Socket::INET::peeraddr at line 291 of IO/Socket/INET.pm, avg 7µs/call # 41 times (91µs+0s) by IO::Socket::INET::peerport at line 298 of IO/Socket/INET.pm, avg 2µs/call
sub peername {
2508234µs @_ == 1 or croak 'usage: $sock->peername()';
2518245µs my($sock) = @_;
25282378µs223µs ${*$sock}{'io_socket_peername'} ||= getpeername($sock);
# spent 23µs making 2 calls to IO::Socket::CORE:getpeername, avg 11µs/call
253}
254
255sub connected {
256 @_ == 1 or croak 'usage: $sock->connected()';
257 my($sock) = @_;
258 getpeername($sock);
259}
260
261sub send {
262 @_ >= 2 && @_ <= 4 or croak 'usage: $sock->send(BUF, [FLAGS, [TO]])';
263 my $sock = $_[0];
264 my $flags = $_[2] || 0;
265 my $peer = $_[3] || $sock->peername;
266
267 croak 'send: Cannot determine peer address'
268 unless(defined $peer);
269
270 my $r = defined(getpeername($sock))
271 ? send($sock, $_[1], $flags)
272 : send($sock, $_[1], $flags, $peer);
273
274 # remember who we send to, if it was successful
275 ${*$sock}{'io_socket_peername'} = $peer
276 if(@_ == 4 && defined $r);
277
278 $r;
279}
280
281sub recv {
282 @_ == 3 || @_ == 4 or croak 'usage: $sock->recv(BUF, LEN [, FLAGS])';
283 my $sock = $_[0];
284 my $len = $_[2];
285 my $flags = $_[3] || 0;
286
287 # remember who we recv'd from
288 ${*$sock}{'io_socket_peername'} = recv($sock, $_[1]='', $len, $flags);
289}
290
291sub shutdown {
292 @_ == 2 or croak 'usage: $sock->shutdown(HOW)';
293 my($sock, $how) = @_;
294 ${*$sock}{'io_socket_peername'} = undef;
295 shutdown($sock, $how);
296}
297
298sub setsockopt {
299 @_ == 4 or croak '$sock->setsockopt(LEVEL, OPTNAME, OPTVAL)';
300 setsockopt($_[0],$_[1],$_[2],$_[3]);
301}
302
303110µs14µsmy $intsize = length(pack("i",0));
# spent 4µs making 1 call to IO::Socket::CORE:pack
304
305sub getsockopt {
306 @_ == 3 or croak '$sock->getsockopt(LEVEL, OPTNAME)';
307 my $r = getsockopt($_[0],$_[1],$_[2]);
308 # Just a guess
309 $r = unpack("i", $r)
310 if(defined $r && length($r) == $intsize);
311 $r;
312}
313
314sub sockopt {
315 my $sock = shift;
316 @_ == 1 ? $sock->getsockopt(SOL_SOCKET,@_)
317 : $sock->setsockopt(SOL_SOCKET,@_);
318}
319
320sub atmark {
321 @_ == 1 or croak 'usage: $sock->atmark()';
322 my($sock) = @_;
323 sockatmark($sock);
324}
325
326sub timeout {
327 @_ == 1 || @_ == 2 or croak 'usage: $sock->timeout([VALUE])';
328 my($sock,$val) = @_;
329 my $r = ${*$sock}{'io_socket_timeout'};
330
331 ${*$sock}{'io_socket_timeout'} = defined $val ? 0 + $val : $val
332 if(@_ == 2);
333
334 $r;
335}
336
337sub sockdomain {
338 @_ == 1 or croak 'usage: $sock->sockdomain()';
339 my $sock = shift;
340 ${*$sock}{'io_socket_domain'};
341}
342
343sub socktype {
344 @_ == 1 or croak 'usage: $sock->socktype()';
345 my $sock = shift;
346 ${*$sock}{'io_socket_type'}
347}
348
349sub protocol {
350 @_ == 1 or croak 'usage: $sock->protocol()';
351 my($sock) = @_;
352 ${*$sock}{'io_socket_proto'};
353}
354
355111µs1;
356
357__END__
358
359=head1 NAME
360
361IO::Socket - Object interface to socket communications
362
363=head1 SYNOPSIS
364
365 use IO::Socket;
366
367=head1 DESCRIPTION
368
369C<IO::Socket> provides an object interface to creating and using sockets. It
370is built upon the L<IO::Handle> interface and inherits all the methods defined
371by L<IO::Handle>.
372
373C<IO::Socket> only defines methods for those operations which are common to all
374types of socket. Operations which are specified to a socket in a particular
375domain have methods defined in sub classes of C<IO::Socket>
376
377C<IO::Socket> will export all functions (and constants) defined by L<Socket>.
378
379=head1 CONSTRUCTOR
380
381=over 4
382
383=item new ( [ARGS] )
384
385Creates an C<IO::Socket>, which is a reference to a
386newly created symbol (see the C<Symbol> package). C<new>
387optionally takes arguments, these arguments are in key-value pairs.
388C<new> only looks for one key C<Domain> which tells new which domain
389the socket will be in. All other arguments will be passed to the
390configuration method of the package for that domain, See below.
391
392 NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
393
394As of VERSION 1.18 all IO::Socket objects have autoflush turned on
395by default. This was not the case with earlier releases.
396
397 NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
398
399=back
400
401=head1 METHODS
402
403See L<perlfunc> for complete descriptions of each of the following
404supported C<IO::Socket> methods, which are just front ends for the
405corresponding built-in functions:
406
407 socket
408 socketpair
409 bind
410 listen
411 accept
412 send
413 recv
414 peername (getpeername)
415 sockname (getsockname)
416 shutdown
417
418Some methods take slightly different arguments to those defined in L<perlfunc>
419in attempt to make the interface more flexible. These are
420
421=over 4
422
423=item accept([PKG])
424
425perform the system call C<accept> on the socket and return a new
426object. The new object will be created in the same class as the listen
427socket, unless C<PKG> is specified. This object can be used to
428communicate with the client that was trying to connect.
429
430In a scalar context the new socket is returned, or undef upon
431failure. In a list context a two-element array is returned containing
432the new socket and the peer address; the list will be empty upon
433failure.
434
435The timeout in the [PKG] can be specified as zero to effect a "poll",
436but you shouldn't do that because a new IO::Select object will be
437created behind the scenes just to do the single poll. This is
438horrendously inefficient. Use rather true select() with a zero
439timeout on the handle, or non-blocking IO.
440
441=item socketpair(DOMAIN, TYPE, PROTOCOL)
442
443Call C<socketpair> and return a list of two sockets created, or an
444empty list on failure.
445
446=back
447
448Additional methods that are provided are:
449
450=over 4
451
452=item atmark
453
454True if the socket is currently positioned at the urgent data mark,
455false otherwise.
456
457 use IO::Socket;
458
459 my $sock = IO::Socket::INET->new('some_server');
460 $sock->read($data, 1024) until $sock->atmark;
461
462Note: this is a reasonably new addition to the family of socket
463functions, so all systems may not support this yet. If it is
464unsupported by the system, an attempt to use this method will
465abort the program.
466
467The atmark() functionality is also exportable as sockatmark() function:
468
469 use IO::Socket 'sockatmark';
470
471This allows for a more traditional use of sockatmark() as a procedural
472socket function. If your system does not support sockatmark(), the
473C<use> declaration will fail at compile time.
474
475=item connected
476
477If the socket is in a connected state the peer address is returned.
478If the socket is not in a connected state then undef will be returned.
479
480=item protocol
481
482Returns the numerical number for the protocol being used on the socket, if
483known. If the protocol is unknown, as with an AF_UNIX socket, zero
484is returned.
485
486=item sockdomain
487
488Returns the numerical number for the socket domain type. For example, for
489an AF_INET socket the value of &AF_INET will be returned.
490
491=item sockopt(OPT [, VAL])
492
493Unified method to both set and get options in the SOL_SOCKET level. If called
494with one argument then getsockopt is called, otherwise setsockopt is called.
495
496=item socktype
497
498Returns the numerical number for the socket type. For example, for
499a SOCK_STREAM socket the value of &SOCK_STREAM will be returned.
500
501=item timeout([VAL])
502
503Set or get the timeout value associated with this socket. If called without
504any arguments then the current setting is returned. If called with an argument
505the current setting is changed and the previous value returned.
506
507=back
508
509=head1 SEE ALSO
510
511L<Socket>, L<IO::Handle>, L<IO::Socket::INET>, L<IO::Socket::UNIX>
512
513=head1 AUTHOR
514
515Graham Barr. atmark() by Lincoln Stein. Currently maintained by the
516Perl Porters. Please report all bugs to <perl5-porters@perl.org>.
517
518=head1 COPYRIGHT
519
520Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved.
521This program is free software; you can redistribute it and/or
522modify it under the same terms as Perl itself.
523
524The atmark() implementation: Copyright 2001, Lincoln Stein <lstein@cshl.org>.
525This module is distributed under the same terms as Perl itself.
526Feel free to use, modify and redistribute it as long as you retain
527the correct attribution.
528
529=cut
# spent 186µs within IO::Socket::CORE:connect which was called 4 times, avg 47µs/call: # 2 times (166µs+0s) by IO::Socket::connect at line 114 of IO/Socket.pm, avg 83µs/call # 2 times (20µs+0s) by IO::Socket::connect at line 121 of IO/Socket.pm, avg 10µs/call
sub IO::Socket::CORE:connect; # xsub
# spent 23µs within IO::Socket::CORE:getpeername which was called 2 times, avg 11µs/call: # 2 times (23µs+0s) by IO::Socket::peername at line 252 of IO/Socket.pm, avg 11µs/call
sub IO::Socket::CORE:getpeername; # xsub
# spent 4µs within IO::Socket::CORE:pack which was called # once (4µs+0s) by IO::Socket::INET::BEGIN@11 at line 303 of IO/Socket.pm
sub IO::Socket::CORE:pack; # xsub
# spent 77µs within IO::Socket::CORE:socket which was called 2 times, avg 39µs/call: # 2 times (77µs+0s) by IO::Socket::socket at line 80 of IO/Socket.pm, avg 39µs/call
sub IO::Socket::CORE:socket; # xsub