in reply to Net:::FTP and the warn function

You can also use Net::FTP built-in error reporting mechanisms: $ftp->ok(), $ftp->message(), $ftp->code(). All of those methods refer to the status of the last $ftp call that was made. (see Net::Cmd for info on the ok, message, and code methods that are common to most Net:: modules).
$ftp->some_command(); if($ftp->code()==425){ # handle a "Can't open data connection." type error } #etc...
The FTP error codes are detailed in RFC 959.