FTP: Difference between revisions
m
→{{header|Perl}}: use a working server, cleaner code
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: re add directory change command) |
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: use a working server, cleaner code) |
||
Line 529:
=={{header|Perl}}==
<lang
# set server and credentials
my $host =
my $user = 'anonymous';
my $
my $f = Net::FTP->new($host) or die
$f->login($user, $password) or die
▲#Set to passive mode
$f->passive();
# change remote directory, list contents
$f->cwd(
printf "Currently %d files in the 'upload' directory.\n", @files;
▲my @dir = $f->ls();
my $local = $f->get("README");▼
say("Your file was stored as $local in the current directory! ");▼
# download file in binary mode
$f->cwd('/');
$f->type('binary');
{{out}}
<pre>Currently 20 files in the 'upload' directory
▲Your file was stored as README in the current directory!
=={{header|Perl 6}}==
|