in reply to Inheritance confusion

Just inherit properly, using the glob as the underlying data structure. The only thing you'll have to pay attention to is how you access and set your data:

package My::FTP; use base 'Net::FTP'; sub new { # my($class,$host,%args) = @_; my $self = Net::FTP::new(@_) or die $@; ${*$self}{_custom_data} = 'CUSTOM DATA'; return $self; } sub custom { my $self = shift; return ${*$self}{_custom_data},"\n"; } package main; my $ftp = My::FTP->new(shift); $ftp->login(shift,shift) or die $ftp->message; print $ftp->pwd,$/; print $ftp->custom,$/; print ref $ftp,$/; __END__ / CUSTOM DATA My::FTP

Hope this helps.

Replies are listed 'Best First'.
Re^2: Inheritance confusion
by GoCool (Scribe) on May 25, 2005 at 16:35 UTC
    try $ftp->{parent}->ls() instead of $ftp->ls()
    that should work, right?