in reply to Inheritance confusion

Why do you need to override the new method? Maybe this would work:
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 }
I also agree with the poster above who mentioned using a config file. That seems the safer place to check if it's production, and just return different server/user/pass values if it is the devel server.

Replies are listed 'Best First'.
Re^2: Inheritance confusion
by the_slycer (Chaplain) on May 21, 2005 at 02:00 UTC
    We need to modify the *server* it's connecting to as well, which is done in the constructor.
    I'd love to externalize the config, that has it's own issues as well (mainly time related)