package Custom:FTP; use base qw( Net::FTP ); sub login { my $self = shift; my @opts = @_; if (_not_prod()) { $opts[0] = 'testuser'; $opts[1] = 'testpassword'; } return $self->SUPER::login(@opts); } sub _not_prod { # check production }