56
56
<li><a href="http://search.cpan.org">CPAN</a></li>
57
<li><a href="http://www.perl.org">Perl.org</a></li>
57
58
<li><a href="http://www.perl.com">Perl.com</a></li>
58
<li><a href="http://www.perl.org">Perl.org</a></li>
59
<li><a href="http://perlbuzz.com">Perl Buzz</a></li>
60
<li><a href="http://www.perlfoundation.org/perl5/index.cgi">Perl 5 Wiki</a></li>
61
<li><a href="http://jobs.perl.org">Perl Jobs</a></li>
59
62
<li><a href="http://www.pm.org">Perl Mongers</a></li>
60
63
<li><a href="http://www.perlmonks.org">Perl Monks</a></li>
61
64
<li><a href="http://planet.perl.org">Planet Perl</a></li>
66
69
<li>Site maintained by<br><a href="http://perl.jonallen.info">Jon Allen</a>
67
70
(<a href="http://perl.jonallen.info">JJ</a>)</li>
68
<li class="spaced">Last updated on<br>23 April 2006</li>
71
<li class="spaced">Last updated on<br>23 December 2007</li>
69
72
<li class="spaced">See the <a href="http://perl.jonallen.info/projects/perldoc">project page</a> for
76
79
<div id="centerContent">
77
80
<div id="contentHeader">
78
81
<div id="contentHeaderLeft"><a href="#" onClick="showLeft()">Show navigation</a></div>
79
<div id="contentHeaderCentre">-- Perl 5.8.8 documentation --</div>
82
<div id="contentHeaderCentre">-- Perl 5.10.0 documentation --</div>
80
83
<div id="contentHeaderRight"><a href="#" onClick="showRight()">Show toolbar</a></div>
82
85
<div id="breadCrumbs"><a href="../index.html">Home</a> > <a href="../index-modules-A.html">Core modules</a> > <a href="../index-modules-N.html">N</a> > Net::Cmd</div>
84
87
<div id="contentBody"><div class="title_container"><div class="page_title">Net::Cmd</div></div><ul><li><a href="#NAME">NAME</a><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><li><a href="#USER-METHODS">USER METHODS</a><li><a href="#CLASS-METHODS">CLASS METHODS</a><li><a href="#EXPORTS">EXPORTS</a><li><a href="#AUTHOR">AUTHOR</a><li><a href="#COPYRIGHT">COPYRIGHT</a></ul><a name="NAME"></a><h1>NAME</h1>
85
88
<p>Net::Cmd - Network Command class (as used by FTP, SMTP etc)</p>
86
89
<a name="SYNOPSIS"></a><h1>SYNOPSIS</h1>
87
<pre class="verbatim"> <a class="l_k" href="../functions/use.html">use</a> <a class="l_w" href="../Net/Cmd.html">Net::Cmd</a><span class="sc">;</span></pre>
90
<pre class="verbatim"> <a class="l_k" href="../functions/use.html">use</a> <span class="w">Net::Cmd</span><span class="sc">;</span></pre>
88
91
<pre class="verbatim"> <span class="i">@ISA</span> = <span class="q">qw(Net::Cmd)</span><span class="sc">;</span></pre>
89
92
<a name="DESCRIPTION"></a><h1>DESCRIPTION</h1>
90
<p><code class="inline"><a class="l_w" href="../Net/Cmd.html">Net::Cmd</a></code> is a collection of methods that can be inherited by a sub class
91
of <code class="inline"><a class="l_w" href="../IO/Handle.html">IO::Handle</a></code>. These methods implement the functionality required for a
93
<p><code class="inline"><span class="w">Net::Cmd</span></code>
94
is a collection of methods that can be inherited by a sub class
95
of <code class="inline"><span class="w">IO::Handle</span></code>
96
. These methods implement the functionality required for a
92
97
command based protocol, for example FTP and SMTP.</p>
93
98
<a name="USER-METHODS"></a><h1>USER METHODS</h1>
94
<p>These methods provide a user interface to the <code class="inline"><a class="l_w" href="../Net/Cmd.html">Net::Cmd</a></code> object.</p>
99
<p>These methods provide a user interface to the <code class="inline"><span class="w">Net::Cmd</span></code>
96
102
<li><a name="debug-(-VALUE-)"></a><b>debug ( VALUE )</b>
97
<p>Set the level of debug information for this object. If <code class="inline">VALUE</code>
103
<p>Set the level of debug information for this object. If <code class="inline"><span class="w">VALUE</span></code>
99
105
then the current state is returned. Otherwise the state is changed to
100
<code class="inline">VALUE</code>
101
and the previous state returned. </p>
106
<code class="inline"><span class="w">VALUE</span></code>
107
and the previous state returned.</p>
102
108
<p>Different packages
103
109
may implement different levels of debug but a non-zero value results in
104
110
copies of all commands and responses also being sent to STDERR.</p>
105
<p>If <code class="inline">VALUE</code>
111
<p>If <code class="inline"><span class="w">VALUE</span></code>
106
112
is <code class="inline"><a class="l_k" href="../functions/undef.html">undef</a></code> then the debug level will be set to the default
107
113
debug level for the class.</p>
108
114
<p>This method can also be called as a <i>static</i> method to set/get the default
123
129
<li><a name="status-()"></a><b>status ()</b>
124
130
<p>Returns the most significant digit of the current status code. If a command
125
is pending then <code class="inline">CMD_PENDING</code>
131
is pending then <code class="inline"><span class="w">CMD_PENDING</span></code>
128
134
<li><a name="datasend-(-DATA-)"></a><b>datasend ( DATA )</b>
129
135
<p>Send data to the remote server, converting LF to CRLF. Any line starting
130
136
with a '.' will be prefixed with another '.'.
131
<code class="inline">DATA</code>
137
<code class="inline"><span class="w">DATA</span></code>
132
138
may be an array or a reference to an array.</p>
134
140
<li><a name="dataend-()"></a><b>dataend ()</b>
135
141
<p>End the sending of data to the remote server. This is done by ensuring that
136
142
the data already sent ends with CRLF then sending '.CRLF' to end the
137
transmission. Once this data has been sent <code class="inline">dataend</code>
138
calls <code class="inline">response</code>
143
transmission. Once this data has been sent <code class="inline"><span class="w">dataend</span></code>
144
calls <code class="inline"><span class="w">response</span></code>
140
returns true if <code class="inline">response</code>
146
returns true if <code class="inline"><span class="w">response</span></code>
141
147
returns CMD_OK.</p>
144
150
<a name="CLASS-METHODS"></a><h1>CLASS METHODS</h1>
145
151
<p>These methods are not intended to be called by the user, but used or
146
over-ridden by a sub-class of <code class="inline"><a class="l_w" href="../Net/Cmd.html">Net::Cmd</a></code></p>
152
over-ridden by a sub-class of <code class="inline"><span class="w">Net::Cmd</span></code>
148
155
<li><a name="debug_print-(-DIR%2c-TEXT-)"></a><b>debug_print ( DIR, TEXT )</b>
149
<p>Print debugging information. <code class="inline">DIR</code>
156
<p>Print debugging information. <code class="inline"><span class="w">DIR</span></code>
150
157
denotes the direction <i>true</i> being
151
data being sent to the server. Calls <code class="inline">debug_text</code>
158
data being sent to the server. Calls <code class="inline"><span class="w">debug_text</span></code>
152
159
before printing to
176
183
<li><a name="parse_response-(-TEXT-)"></a><b>parse_response ( TEXT )</b>
177
<p>This method is called by <code class="inline">response</code>
184
<p>This method is called by <code class="inline"><span class="w">response</span></code>
178
185
as a method with one argument. It should
179
186
return an array of 2 values, the 3-digit status code and a flag which is true
180
187
when this is part of a multi-line response and this line is not the list.</p>
183
190
<p>Retrieve one line, delimited by CRLF, from the remote server. Returns <i>undef</i>
184
191
upon failure.</p>
185
192
<p><b>NOTE</b>: If you do use this method for any reason, please remember to add
186
some <code class="inline">debug_print</code>
193
some <code class="inline"><span class="w">debug_print</span></code>
187
194
calls into your method.</p>
189
196
<li><a name="ungetline-(-TEXT-)"></a><b>ungetline ( TEXT )</b>
190
197
<p>Unget a line of text from the server.</p>
192
199
<li><a name="rawdatasend-(-DATA-)"></a><b>rawdatasend ( DATA )</b>
193
<p>Send data to the remote server without performing any conversions. <code class="inline">DATA</code>
200
<p>Send data to the remote server without performing any conversions. <code class="inline"><span class="w">DATA</span></code>
204
211
command, you may read from this filehandle using read() or <>. The
205
212
filehandle will return EOF when the final dot is encountered.
206
213
Similarly, you may write to the filehandle in order to send data to
207
the server after issuing a commmand that expects data to be written.</p>
214
the server after issuing a command that expects data to be written.</p>
208
215
<p>See the Net::POP3 and Net::SMTP modules for examples of this.</p>
211
218
<a name="EXPORTS"></a><h1>EXPORTS</h1>
212
<p><code class="inline"><a class="l_w" href="../Net/Cmd.html">Net::Cmd</a></code> exports six subroutines, five of these, <code class="inline">CMD_INFO</code>
213
, <code class="inline">CMD_OK</code>
219
<p><code class="inline"><span class="w">Net::Cmd</span></code>
220
exports six subroutines, five of these, <code class="inline"><span class="w">CMD_INFO</span></code>
221
, <code class="inline"><span class="w">CMD_OK</span></code>
215
<code class="inline">CMD_MORE</code>
216
, <code class="inline">CMD_REJECT</code>
217
and <code class="inline">CMD_ERROR</code>
223
<code class="inline"><span class="w">CMD_MORE</span></code>
224
, <code class="inline"><span class="w">CMD_REJECT</span></code>
225
and <code class="inline"><span class="w">CMD_ERROR</span></code>
218
226
, correspond to possible results
219
of <code class="inline">response</code>
220
and <code class="inline">status</code>
221
. The sixth is <code class="inline">CMD_PENDING</code>
227
of <code class="inline"><span class="w">response</span></code>
228
and <code class="inline"><span class="w">status</span></code>
229
. The sixth is <code class="inline"><span class="w">CMD_PENDING</span></code>
223
231
<a name="AUTHOR"></a><h1>AUTHOR</h1>
224
232
<p>Graham Barr <gbarr@pobox.com></p>
225
233
<a name="COPYRIGHT"></a><h1>COPYRIGHT</h1>
226
<p>Copyright (c) 1995-1997 Graham Barr. All rights reserved.
234
<p>Copyright (c) 1995-2006 Graham Barr. All rights reserved.
227
235
This program is free software; you can redistribute it and/or modify
228
236
it under the same terms as Perl itself.</p>
231
<p><i>$Id: //depot/libnet/Net/Cmd.pm#34 $</i></p>
233
238
<div id="contentFooter"><a href="http://www.perl.org"><img src="../perlpowered.png" border=0></a></div>