Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Parent cannot call Child method

by jellisii2 (Hermit)
on Mar 17, 2016 at 13:28 UTC ( [id://1158083]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Parent cannot call Child method
in thread Parent cannot call Child method

Did you, as Eily suggested, use parent qw(Parent); in MyParent::MyChild?

Replies are listed 'Best First'.
Re^4: Parent cannot call Child method
by TorontoJim (Beadle) on Mar 17, 2016 at 13:34 UTC
    Yes, this is the start of MyChild after reading Eily's post:
    package MyParent::MyChild; use strict; no strict "refs"; use Carp qw(croak); use parent qw(MyParent); my $VERSION = .01; sub new { my ($class) = @_; my $self = {}; bless $self, $class; return $self; }

      I can call MyParent::MyChild->new() just fine with this MyChild code, but I had to modify MyParent (remove the return line in new) so that It would compile. But since MyParent::MyChild defines its own new method, MyParent.pm should not even be needed for that call to succeed ...

        I'm glad I'm not the only one finding this strange. I think I'll let it sit for a couple days then come back to it fresh.

        Thank you for trying it out, at least I know I'm heading in the right-ish direction.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1158083]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-20 03:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found