Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I code a new method for an existing Class?

Little tricks

How do I code a new method for an existing Class?

by  cdlvj  Posted    (Edited  )
The code inherits the methods from the Net::FTP class and adds an additional get method.

Name the file MyFTP.pm and place in the lib (dir) and Net (dir).

Code:
package Net::MyFTP;
use Net::FTP;
@ISA = ("Net::FTP");

sub MyGET {
        my $ftp = shift;
        my($remote,$local,$where) = @_;
      # log all access to stdout
        print "FTP - $remote";
        ftp->get($remote,$local,$where);
        return 1;
    }

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top