murfet has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to learn Perl OO, with the following two files, both in /usr/lib/perl5/site_perl/5.6.0/i386-linux/Banach/Web

---- t.pm -----
package Banach::Web::t;<BR> 1;<BR>
---- s.pm -----
package Banach::Web::s; @ISA=qw(Banach::Web::t); 1;
---- test.cgi ----
#!/usr/bin/perl -wT use Banach::Web::s;
------------------
And test.cgi bails with:

Can't locate package Banach::Web::t for @Banach::Web::s::ISA at ./test.cgi line 3.

Why, oh why?

Replies are listed 'Best First'.
Re (tilly): @ISA not behaving in OO test
by tilly (Archbishop) on Jan 01, 2001 at 07:11 UTC
    First of all I should mention that <code>...</code> tags make it easier for people to download and try your code out.

    Anyways if you did a:

    use diagnostics;
    you would get the information that you were trying to put a package in @ISA that doesn't seem to exist. Which is (from Perl's point of view) exactly what is going on. Nowhere do you load Banach/Web/t.pm, and so that namespace is not in use. Just slip:
    use Banach::Web::t;
    into Banach/Web/s.pm and your problems should go away.

    An incidental hint. If you are developing code you should probably not work directly in your installed directory. Instead look into using the lib pragma.

Re: @ISA not behaving in OO test
by salvadors (Pilgrim) on Jan 01, 2001 at 20:51 UTC
    In s.pm you need the line: use Banach::Web::t;

    Otherwise ISA doesn't know what a Banach::Web::t is, or how to be one!

    Tony