Hi,

I have a number of object class's that work fine, however I am attempting to build a class that will inherite methods from its children, I have tried including the required methods in the ISA array, however the compiler keeps informing me that it 'cant locate object method method_name' in class test'

I am using the following code
use lib ('G:\Perl Live\OO Packages'); use Mailsort; use strict; my $file = 'J:\sample file.csv'; my $ob = new Mailsort($file); #unable to call this method which is in class Mailsort_scj $ob->update_database('DSA','a database'); print $ob->{DATABASE}."\n";

the header from package Mailsort is as
package Mailsort; use lib ('G:\Perl Live\OO Packages'); require Exporter; require Mailsort_scj; require Filedetails; use strict; use Carp; my @ISA = qw(Exporter Filedetails Mailsort_scj); sub new{ my ($proto,$type) =@_; my $typein = ref($type) || $type; my $params = new Mailsort_scj($typein); &initialise($params); bless ($params,$typein); return($params); }
the header from class Mailsort_scj is as follows;
package Mailsort_scj; require Exporter; require Filedetails; use strict; use Carp; my @ISA = qw(Exporter Filedetails Mailsort_scj); my @EXPORT = qw(update_database update_options update_tntoptions update_inputformat create_scj update_Foreign_Addresses Redirect_Rejects); sub new{ my ($proto,$filein) = @_; my $type = ref($proto) || $proto; my $params = new Filedetails; $params->{FileName_IN} = $filein; &initialise($params); bless $params,$type; return $params; } sub update_database{ my ($class,$type,$value) = @_; my $valuein = ref($value) || $value; $class->{Database}{$type} = $valuein; }

any pointers would be greatly appreciated; thanks Skywalker

In reply to how to method Inheritance by skywalker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.