Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / man / man3 / Net::Cmd.3
CommitLineData
920dae64
AT
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "Net::Cmd 3"
132.TH Net::Cmd 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide"
133.SH "NAME"
134Net::Cmd \- Network Command class (as used by FTP, SMTP etc)
135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS"
137.Vb 1
138\& use Net::Cmd;
139.Ve
140.PP
141.Vb 1
142\& @ISA = qw(Net::Cmd);
143.Ve
144.SH "DESCRIPTION"
145.IX Header "DESCRIPTION"
146\&\f(CW\*(C`Net::Cmd\*(C'\fR is a collection of methods that can be inherited by a sub class
147of \f(CW\*(C`IO::Handle\*(C'\fR. These methods implement the functionality required for a
148command based protocol, for example \s-1FTP\s0 and \s-1SMTP\s0.
149.SH "USER METHODS"
150.IX Header "USER METHODS"
151These methods provide a user interface to the \f(CW\*(C`Net::Cmd\*(C'\fR object.
152.IP "debug ( \s-1VALUE\s0 )" 4
153.IX Item "debug ( VALUE )"
154Set the level of debug information for this object. If \f(CW\*(C`VALUE\*(C'\fR is not given
155then the current state is returned. Otherwise the state is changed to
156\&\f(CW\*(C`VALUE\*(C'\fR and the previous state returned.
157.Sp
158Different packages
159may implement different levels of debug but a non-zero value results in
160copies of all commands and responses also being sent to \s-1STDERR\s0.
161.Sp
162If \f(CW\*(C`VALUE\*(C'\fR is \f(CW\*(C`undef\*(C'\fR then the debug level will be set to the default
163debug level for the class.
164.Sp
165This method can also be called as a \fIstatic\fR method to set/get the default
166debug level for a given class.
167.IP "message ()" 4
168.IX Item "message ()"
169Returns the text message returned from the last command
170.IP "code ()" 4
171.IX Item "code ()"
172Returns the 3\-digit code from the last command. If a command is pending
173then the value 0 is returned
174.IP "ok ()" 4
175.IX Item "ok ()"
176Returns non-zero if the last code value was greater than zero and
177less than 400. This holds true for most command servers. Servers
178where this does not hold may override this method.
179.IP "status ()" 4
180.IX Item "status ()"
181Returns the most significant digit of the current status code. If a command
182is pending then \f(CW\*(C`CMD_PENDING\*(C'\fR is returned.
183.IP "datasend ( \s-1DATA\s0 )" 4
184.IX Item "datasend ( DATA )"
185Send data to the remote server, converting \s-1LF\s0 to \s-1CRLF\s0. Any line starting
186with a '.' will be prefixed with another '.'.
187\&\f(CW\*(C`DATA\*(C'\fR may be an array or a reference to an array.
188.IP "dataend ()" 4
189.IX Item "dataend ()"
190End the sending of data to the remote server. This is done by ensuring that
191the data already sent ends with \s-1CRLF\s0 then sending '.CRLF' to end the
192transmission. Once this data has been sent \f(CW\*(C`dataend\*(C'\fR calls \f(CW\*(C`response\*(C'\fR and
193returns true if \f(CW\*(C`response\*(C'\fR returns \s-1CMD_OK\s0.
194.SH "CLASS METHODS"
195.IX Header "CLASS METHODS"
196These methods are not intended to be called by the user, but used or
197over-ridden by a sub-class of \f(CW\*(C`Net::Cmd\*(C'\fR
198.IP "debug_print ( \s-1DIR\s0, \s-1TEXT\s0 )" 4
199.IX Item "debug_print ( DIR, TEXT )"
200Print debugging information. \f(CW\*(C`DIR\*(C'\fR denotes the direction \fItrue\fR being
201data being sent to the server. Calls \f(CW\*(C`debug_text\*(C'\fR before printing to
202\&\s-1STDERR\s0.
203.IP "debug_text ( \s-1TEXT\s0 )" 4
204.IX Item "debug_text ( TEXT )"
205This method is called to print debugging information. \s-1TEXT\s0 is
206the text being sent. The method should return the text to be printed
207.Sp
208This is primarily meant for the use of modules such as \s-1FTP\s0 where passwords
209are sent, but we do not want to display them in the debugging information.
210.IP "command ( \s-1CMD\s0 [, \s-1ARGS\s0, ... ])" 4
211.IX Item "command ( CMD [, ARGS, ... ])"
212Send a command to the command server. All arguments a first joined with
213a space character and \s-1CRLF\s0 is appended, this string is then sent to the
214command server.
215.Sp
216Returns undef upon failure
217.IP "unsupported ()" 4
218.IX Item "unsupported ()"
219Sets the status code to 580 and the response text to 'Unsupported command'.
220Returns zero.
221.IP "response ()" 4
222.IX Item "response ()"
223Obtain a response from the server. Upon success the most significant digit
224of the status code is returned. Upon failure, timeout etc., \fIundef\fR is
225returned.
226.IP "parse_response ( \s-1TEXT\s0 )" 4
227.IX Item "parse_response ( TEXT )"
228This method is called by \f(CW\*(C`response\*(C'\fR as a method with one argument. It should
229return an array of 2 values, the 3\-digit status code and a flag which is true
230when this is part of a multi-line response and this line is not the list.
231.IP "getline ()" 4
232.IX Item "getline ()"
233Retrieve one line, delimited by \s-1CRLF\s0, from the remote server. Returns \fIundef\fR
234upon failure.
235.Sp
236\&\fB\s-1NOTE\s0\fR: If you do use this method for any reason, please remember to add
237some \f(CW\*(C`debug_print\*(C'\fR calls into your method.
238.IP "ungetline ( \s-1TEXT\s0 )" 4
239.IX Item "ungetline ( TEXT )"
240Unget a line of text from the server.
241.IP "rawdatasend ( \s-1DATA\s0 )" 4
242.IX Item "rawdatasend ( DATA )"
243Send data to the remote server without performing any conversions. \f(CW\*(C`DATA\*(C'\fR
244is a scalar.
245.IP "read_until_dot ()" 4
246.IX Item "read_until_dot ()"
247Read data from the remote server until a line consisting of a single '.'.
248Any lines starting with '..' will have one of the '.'s removed.
249.Sp
250Returns a reference to a list containing the lines, or \fIundef\fR upon failure.
251.IP "tied_fh ()" 4
252.IX Item "tied_fh ()"
253Returns a filehandle tied to the Net::Cmd object. After issuing a
254command, you may read from this filehandle using \fIread()\fR or <>. The
255filehandle will return \s-1EOF\s0 when the final dot is encountered.
256Similarly, you may write to the filehandle in order to send data to
257the server after issuing a commmand that expects data to be written.
258.Sp
259See the Net::POP3 and Net::SMTP modules for examples of this.
260.SH "EXPORTS"
261.IX Header "EXPORTS"
262\&\f(CW\*(C`Net::Cmd\*(C'\fR exports six subroutines, five of these, \f(CW\*(C`CMD_INFO\*(C'\fR, \f(CW\*(C`CMD_OK\*(C'\fR,
263\&\f(CW\*(C`CMD_MORE\*(C'\fR, \f(CW\*(C`CMD_REJECT\*(C'\fR and \f(CW\*(C`CMD_ERROR\*(C'\fR, correspond to possible results
264of \f(CW\*(C`response\*(C'\fR and \f(CW\*(C`status\*(C'\fR. The sixth is \f(CW\*(C`CMD_PENDING\*(C'\fR.
265.SH "AUTHOR"
266.IX Header "AUTHOR"
267Graham Barr <gbarr@pobox.com>
268.SH "COPYRIGHT"
269.IX Header "COPYRIGHT"
270Copyright (c) 1995\-1997 Graham Barr. All rights reserved.
271This program is free software; you can redistribute it and/or modify
272it under the same terms as Perl itself.
273.PP
274\&\fI$Id: //depot/libnet/Net/Cmd.pm#34 $\fR