summaryrefslogtreecommitdiff
path: root/ext/Socket
diff options
context:
space:
mode:
authorChris Nandor <pudge@pobox.com>1998-06-24 15:58:28 -0400
committerGurusamy Sarathy <gsar@cpan.org>1998-06-28 19:46:29 +0000
commitfdb41d65d2165593b3288a1175c6d1bb79774d63 (patch)
treec87ac482bb7ae642b0b80ef0517d9e5652488567 /ext/Socket
parent89ea29081d863efc8d483f9cbe1c4e1dbb831359 (diff)
downloadperl-fdb41d65d2165593b3288a1175c6d1bb79774d63.tar.gz
Add CR LF CRLF to Socket.pm
Message-Id: <v04011709b1b742cd7f0c@[24.48.29.192]> p4raw-id: //depot/perl@1240
Diffstat (limited to 'ext/Socket')
-rw-r--r--ext/Socket/Socket.pm30
1 files changed, 28 insertions, 2 deletions
diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm
index 327ef31b56..3c3380f690 100644
--- a/ext/Socket/Socket.pm
+++ b/ext/Socket/Socket.pm
@@ -1,7 +1,7 @@
package Socket;
-use vars qw($VERSION @ISA @EXPORT);
-$VERSION = "1.6";
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+$VERSION = "1.7";
=head1 NAME
@@ -45,6 +45,15 @@ and your native C compiler. This means that it has a
far more likely chance of getting the numbers right. This includes
all of the commonly used pound-defines like AF_INET, SOCK_STREAM, etc.
+Also, some common socket "newline" constants are provided: the
+constants C<CR>, C<LF>, and C<CRLF>, as well as C<$CR>, C<$LF>, and
+C<$CRLF>, which map to C<\015>, C<\012>, and C<\015\012>. If you do
+not want to use the literal characters in your programs, then use
+the constants provided here. They are not exported by default, but can
+be imported individually, and with the C<:crlf> export tag:
+
+ use Socket qw(:DEFAULT :crlf);
+
In addition, some structure manipulation functions are available:
=over
@@ -239,6 +248,23 @@ require DynaLoader;
SO_USELOOPBACK
);
+@EXPORT_OK = qw(CR LF CRLF $CR $LF $CRLF);
+
+%EXPORT_TAGS = (
+ crlf => [qw(CR LF CRLF $CR $LF $CRLF)]
+ all => [@EXPORT, @EXPORT_OK],
+);
+
+BEGIN {
+ sub CR () {"\015"}
+ sub LF () {"\012"}
+ sub CRLF () {"\015\012"}
+}
+
+*CR = \CR();
+*LF = \LF();
+*CRLF = \CRLF();
+
sub sockaddr_in {
if (@_ == 6 && !wantarray) { # perl5.001m compat; use this && die
my($af, $port, @quad) = @_;