I have a program that using the two modules named as ParantClass and Child1Class. i am sending the values from perl program to Child1Class module.ParantClass Module gets the value from Child1Class module and return back the output.
But i couldnt get the answer
The Error is
root@local class# perl UseInheritClass.pl Now I am in Child Module Send a values to Parant Class from Child1 I Entered in to the Parant Class Method ::: UseParant :::500 and are Going to Chid Class So Take Care of Data Get Value from Parant Module ::: ::: Can't locate object method "useChild1" via package "ParantClass" at UseInheritClass.pl line 4.
the following program i wrote for run this file
File1 ::: ParantClass.pm
#!/usr/bin/perl package ParantClass; sub new { my $self = {}; $self->{Parant_Var1}=undef; $self->{Parant_Var2}=undef; bless($self); return $self; } sub UseParant { my $self = shift; if(@_) { $self->{Parant_Var1}=shift; $self->{Parant_Var2}=shift; my $SentToChild1=$self->{Parant_Var1}; my $SendToChild2=$self->{Parant_Var2}; $SendToChild1=$sendToChild1+500; $SendToChild2=$sendToChild2+"1"; print "I Entered in to the Parant Class Method ::: Use +Parant :::$SentToChild1 and $SentToChild2 are Going to Chid Class So + Take Care of Data\n\n"; push(@GoesChild,$sendToChild1); push(@GoesChild,$sendToChild2); } return @GoesChild1; } return 1;

The Second Program id :::: Child1Class.pm
#!/usr/bin/perl package Child1Class; use ParantClass; our ($GetValue1,$GetValue2); sub new { my $self=ParantClass->new(); print "Now I am in Child Module\n\n"; print "Send a values to Parant Class from Child1 "; ($GetValue1,$GetValue2)=$self->UseParant(500,"Child"); print "Get Value from Parant Module ::: $GetValue1 ::: $GetVal +ue2\n\n"; return $self; } sub UseChild1 { my ($value1,$value2)=ParantClass->UseParant(1000,"From Child") +; print "Parant Class Values=$value1 ----- $value2 \n\n"; #my $self = shift; print "This Values go to perl program and display the Values : +:::\n\n\n"; } return 1;

The Third Program is ::: UseInheritClass.pl
#!/usr/bin/perl use Child1Class; $object = Child1Class->new(); print $object->useChild1();
help me to rectify this error. thank you

In reply to Error in Inheritance Class by editi

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.