Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Inheritance confusion

by Thelonious (Scribe)
on May 23, 2005 at 13:07 UTC ( #459547=note: print w/replies, xml ) Need Help??


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?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://459547]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2020-07-07 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?