NAME
Net::TFTP - TFTP Client class
SYNOPSIS
use
Net::TFTP;
$tftp
= Net::TFTP->new(
"some.host.name"
,
BlockSize
=> 1024);
$tftp
->ascii;
$tftp
->get(
"remotefile"
,
"localfile"
);
$tftp
->get(
"remotefile"
, \
*STDOUT
);
$fh
=
$tftp
->get(
"remotefile"
);
$tftp
->binary;
$tftp
->put(
"localfile"
,
"remotefile"
);
$tftp
->put(\
*STDOUT
,
"remotefile"
);
$fh
=
$tftp
->put(
"remotefile"
);
$err
=
$tftp
->error
DESCRIPTION
Net::TFTP
is a class implementing a simple Trivial File Transfer Protocol client in Perl as described in RFC1350. Net::TFTP
also supports the TFTP Option Extension (as described in RFC2347), with the following options
RFC2348 Blocksize Option
CONSTRUCTOR
- new ( [ HOST ] [, OPTIONS ])
-
Create a new Net::TFTP object where HOST is the default host to connect to and OPTIONS are the default transfer options. Valid options are
Option Description Default
------ ----------- -------
Timeout Timeout in seconds
before
retry 5
Retries Maximum number of retries 5
Port Port to
send
data to 69
Mode Mode to transfer data in,
"octet"
or
"netascii"
"netascii"
IpMode Indicates whether to operate in IPv6 mode
"v4"
METHODS
- get ( REMOTE_FILE [, LOCAL ] [, OPTIONS ])
-
Get REMOTE_FILE from the server. OPTIONS can be any that are accepted by
new
plus the followingHost Override
default
host
If the LOCAL option is missing the get will return a filehandle. This filehandle must be read ASAP as the server will otherwise timeout.
If the LOCAL option is given then it can be a file name or a reference. If it is a reference it is assumed to be a reference that is valid as a filehandle.
get
will return true if the transfer is successful and undef otherwise.Valid filehandles are
A sub-class of IO::Handle
A tied filehandle
A GLOB reference (eg
\*STDOUT
)
- put ( [ LOCAL, ] REMOTE_FILE [, OPTIONS])
-
Put a file to the server as REMOTE_FILE. OPTIONS can be any that are accepted by
new
plus the followingHost Override
default
host
If the LOCAL option is missing the put will return a filehandle. This filehandle must be written to ASAP as the server will otherwise timeout.
If the LOCAL option is given then it can be a file name or a reference. If it is a reference it is assumed to be a valid filehandle as described above.
put
will return true if the transfer is successful and undef otherwise. - error
-
If there was an error then this method will return an error string.
- host ( [ HOST ] )
- timeout ( [ TIMEOUT ] )
- port ( [ PORT ] )
- mode ( [ MODE ] )
- retries ( [ VALUE ] )
- block_size ( [ VALUE ] )
- debug ( [ VALUE ] )
-
Set or get the values for the various options. If an argument is passed then a new value is set for that option and the previous value returned. If no value is passed then the current value is returned.
- ip_mode ( [ VALUE ] )
-
Set or get which verion of IP to use ("v4" or "v6")
- ascii
- netascii
-
Set the transfer mode to
"netascii"
- binary
- octet
-
Set the transfer mode to
"octet"
AUTHOR
Graham Barr <gbarr@pobox.com>
COPYRIGHT
Copyright (c) 1998,2007 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.