in reply to My first attempt at inheritance

You only need to make 2 minor adjustments.
First, change $dh->read_pl() to $dh->read

Then fix the @ISA assignment by using parent.

#!/usr/bin/perl use strict; use warnings; use autodie; use IO::Dir; my $dh = IO::Dir::pl->new('.'); while (my $file_name = $dh->read){ print STDOUT "$file_name\n"; } package IO::Dir::pl; use parent -norequire, qw(IO::Dir); sub read{ my $self = shift; warn "Ok We got here.\n"; return undef; }

Replies are listed 'Best First'.
Re^2: My first attempt at inheritance
by fishmonger (Chaplain) on Jun 01, 2013 at 14:15 UTC

    I probably should have logged-in before posting that comment.

    Hello Bill, I see we both get around the different forums.

    FishMonger
    aka Ron Bergin

      Thanks to all! After reading up on all your suggestions, I plan on using the first (BEGIN). The error in my method name was left over from a failed attempt to find my problem myself.

      Ron, I'm afraid that you will always be "the fishmonger".

      Bill