in reply to Extend a module

package your::Net:FTP; use strict; use warnings; # make your::Net::FTP inherit all the methods of Net::FTP use base qw( Net:FTP ); # now you're free to redefine/override what ever you want # our new method replacement sub new { # call the original Net::FTP new method my $ftp_obj = shift->SUPER::new(@_) or return 0; # add our custom code $ftp_obj->{my_data} = 'test'; return $ftp_obj; } # and method all our own sub my_function { my $ftp_obj = shift; # do some stuff }

When you 'use base' your custom module automatically 'inherits' all the methods of it's parent. You're free to replace any of them (or add new methods of your own). If you need to call methods of the parent package directly, then prefix the method name with 'SUPER::' and you'll get the original method.